How to do scrolling in swings

this is the code,i'm not getting scrolling,if i add more no. of components.
Pl.help me
import java.awt.*;
import javax.swing.*;
import javax.swing.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.JOptionPane.*;
import java.io.*;
import javax.swing.colorchooser.*;
import javax.swing.filechooser.*;
import javax.accessibility.*;
import javax.swing.border.*;
import java.sql.*;
public class Signup extends JFrame
     JLabel p1,p2,p3,p4,p5,p6,uid,upass,cpass,fname,sname,hint,sl,ed,age,adr,cit,zip;
     JTextField uname,fnamet,snamet,hintt,adrt,adrt1,city,zipcode;
     JPasswordField upassw,cpassw;     
     JComboBox sex,education,agegr;
     Signup()
     Container c=getContentPane();
     c.setLayout(null);
     c.setBackground(Color.white);
p1=new JLabel("Create Your Icafe!ID",10);
     p2=new JLabel("Personal Information");
     p3=new JLabel("User Address");
     p4=new JLabel("Tell Us About Your Hobbiess (Optional) ");
     p5=new JLabel("Tell us something about what you like. This will help us choose the kind of content to display on           your pages.");
     p6=new JLabel("--------------------------------------------------------------------------------");
uid=new JLabel("User Id");
     upass=new JLabel("Password");
     cpass=new JLabel("Confirmation Password");
     fname=new JLabel("UserName");
     sname=new JLabel("SurName");
     hint=new JLabel("Hint Question");
sl=new JLabel("Sex");
     ed=new JLabel("Education");     
     age=new JLabel("Age Group");     
     adr=new JLabel("Address");
cit=new JLabel("City");
zip=new JLabel("ZipCode");
     uname=new JTextField(10);
     uname.requestFocus();     
     uname.setToolTipText("UserName");
upassw=new JPasswordField(10);
     upassw.setToolTipText("Password");
     upassw.setEchoChar('*');
     cpassw=new JPasswordField(10);
     cpassw.setToolTipText("Confirmation Password");
     cpassw.setEchoChar('*');
     fnamet=new JTextField(10);
     fnamet.setToolTipText("FullName");
     snamet=new JTextField(10);
     snamet.setToolTipText("SurName");
     hintt=new JTextField(10);
     hintt.setToolTipText("Hint Question");     
String[] gender={"[Select one]","Male","Female"};
     sex = new JComboBox(gender);          
String[] edu={"[Select one]","S.S.C","Inter","Graduate","Post Graduate"};
     education= new JComboBox(edu);     
String[] ageg={"[Select one]","0 - 15","16 - 35","36 - 70","70 - 100"};
     agegr= new JComboBox(ageg);     
adrt=new JTextField(15);
     adrt.setToolTipText("Address");
     adrt1=new JTextField(15);
     adrt1.setToolTipText("Address");
     city=new JTextField(15);
     city.setToolTipText("City");
zipcode=new JTextField(15);
     zipcode.setToolTipText("ZipCode");
     p1.setBounds(200,70,160,30);
     uid.setBounds(350,100,160,30);
     uname.setBounds(400,100,160,30);
     upass.setBounds(335,140,160,30);
     upassw.setBounds(400,140,160,30);
     cpass.setBounds(260,180,160,30);
     cpassw.setBounds(400,180,160,30);
     p2.setBounds(200,220,160,30);
     fname.setBounds(330,260,160,30);
     fnamet.setBounds(400,260,160,30);
     sname.setBounds(335,300,160,30);
     snamet.setBounds(400,300,160,30);
hint.setBounds(315,340,160,30);     
hintt.setBounds(400,340,160,30);
     sl.setBounds(370,380,160,30);     
     sex.setBounds(400,380,160,30);
     ed.setBounds(335,420,160,30);     
     education.setBounds(400,420,160,30);
age.setBounds(330,460,160,30);
agegr.setBounds(400,460,160,30);
p3.setBounds(200,500,160,30);
     adr.setBounds(340,540,160,30);
     adrt.setBounds(400,540,160,30);
     adrt1.setBounds(400,580,160,30);
     cit.setBounds(370,620,160,30);
     city.setBounds(400,620,160,30);
zip.setBounds(590,620,160,30);
zipcode.setBounds(640,620,160,30);
     Font font = new Font("SansSerif",Font.BOLD, 12);
     setFont(font);
     c.add(p1);
     c.add(uid);
     c.add(uname);     
     c.add(upass);
     c.add(upassw);
c.add(cpass);
     c.add(cpassw);
c.add(p2);
c.add(fname);     
     c.add(fnamet);
c.add(sname);
c.add(snamet);
     c.add(hint);
c.add(hintt);     
c.add(sl);
c.add(sex);
c.add(ed);
     c.add(education);
c.add(age);
     c.add(agegr);
c.add(p3);
c.add(adr);
     c.add(adrt);
     c.add(adrt1);
c.add(cit);
c.add(city);
c.add(zip);
c.add(zipcode);
     setResizable(false);
     //int a=DO_NOTHING_ON_CLOSE;
     //setDefaultCloseOperation(a);
     show();
     setSize(800,500);
Border raisedBorder = new BevelBorder(BevelBorder.RAISED);     
     //setContentPane(jsp);     
public static void main (String arg[])
     try{
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     }catch(Exception s)
     Signup swu=new Signup();

1. don't use setBorders, use LayoutManagers instead
2. put the stuff that you want to be scrollable in
a JScrollPane.
see the JavaTutorial for details
Spieler

Similar Messages

  • How to automatically scroll text in JScrollPane

    Hi there
    I have a very simple question...
    How to automatically scroll text in JScrollPane?
    Text in the TextArea is constantly getting updated... but the scroll bars dont' move as the text changes. Instead I ahve to scroll and see the changes everytime. How can I make the viewport or the scrollpane to show the latest content?
    Thanks in advance.
    Dexter

    This question is asked daily (it seems) on the forum. Hopefully the TextAreaScroll class will explain whats going on:
    **  Short answer is to use the following after the append:
    **  textArea.setCaretPosition(textArea.getDocument().getLength()
    **  However, if you really want to know what is going on, then I have
    **  I have observed the following behaviour in JDK1.4.2
    **  JTextArea will scroll automatically when text is appended, if:
    **  a) the caret is at the end of the text area, and
    **  b) the append is done in the event thread
    **  Note: Initializing a text area at creation time by any of the following
    **  aproaches will cause the caret to be positioned at the start and therefore
    **  scrolling will not happen automatically:
    **  a) JTextArea textArea = new JTextArea("Initial text", ...);
    **  b) textArea.setText("Initial text");
    **  c) textArea.read(someFile, null);
    **  The append method can be forced to execute in the Event thread by using
    **  SwingUtilities.invokeLater();
    **  Alternatively you can force a scroll by repositioning the caret.
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Date;
    import javax.swing.*;
    import javax.swing.text.*;
    public class TextAreaScroll
         public static void main(String[] args)
              final JTextArea textAreaWest = new JTextArea(10, 25);
              JScrollPane scrollPaneWest = new JScrollPane( textAreaWest );
              final JTextArea textAreaEast = new JTextArea(10, 25);
              JScrollPane scrollPaneEast = new JScrollPane( textAreaEast );
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.getContentPane().add(scrollPaneWest, BorderLayout.WEST);
              frame.getContentPane().add(scrollPaneEast, BorderLayout.EAST);
              frame.pack();
              frame.setVisible(true);
              //  The West text area will be updated by a Timer. Timer code is
              //  executed in the Event thread so it will scroll correctly.
              new Timer(1000, new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        if (textAreaWest.getDocument().getLength() == 0)
                             textAreaWest.append("West will scroll correctly");
                        textAreaWest.append( "\n" + new Date().toString());
              }).start();
              //  The East text area is not updated in the Event thread.
              //  It will not scroll correctly.
              while (true)
                   try
                        if (textAreaEast.getDocument().getLength() == 0)
                             textAreaEast.append("East will not scroll correctly");
                        textAreaEast.append( "\n" + new Date().toString() );
                        //  Using this method causes the text area to scroll because
                        //  this method will invoke SwingUtilities.invokeLater(...)
                        textAreaEast.setCaretPosition( textAreaEast.getDocument().getLength() );
                        //  Using SwingUtilities.invokeLater causes the code to execute
                        //  on the Event thread
                        //  (comment all the above lines before testing)
                        SwingUtilities.invokeLater( new Runnable()
                             public void run()
                                  textAreaEast.append( "\n" + new Date().toString() );
                        Thread.sleep(1000);
                   catch (InterruptedException ie) {}
    }

  • Erratic scrolling of Swing scrn for jdk131

    Hi,
    While upgrading my Project from ibmjdk122 to ibmjdk131, I am facing problem with Erratic scrolling of Swing screens which scrolled fine for ibmjdk122.
    I replaced registerKeyboardAction() method with getInputMap() and getActionMap().
    As an action is used in new method getActionMap(), I created an action using AbstractAction as mentioned by Shannon Hickey.
    The problem is AbstractAction is defining a method actionperformed(), which is already defined in the same class where I am using them.
    Eventhough, it is compiling,while running, it is just hanging.
    Any solution how to use the existing actionperformed() method to create the required Action for getActionMap()?
    or is any other way to solve this problem?
    the method registerKeyboardAction() is mentioned as obsolete in jdk131 documentation, hence I feel that cud be causing the above problem.
    But shd an obsolete method compile if it is no longer functional ( it compiles OK for ibmjdk131) - If No.... what is the diff betn an obsolete method & depricated method.
    Pls help.
    Thanks in advance.
    Krishna V

    Hi @Rafi2014 ,
    Welcome to the HP forum!
    To get your issue more exposure I would suggest posting it in the commercial forums since the {insert product model} is a commercial product. You can do this at Commercial/Notebook - HP ProBook, EliteBook, Compaq, Slate/Tablet PC, Armada, LTE
    The support page for your product may be helpful in the meantime: Hp Probook 450.
    You will need to select your correct model of HP 450 and follow the on screen prompts to display the support page.
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

  • How to bind JtextFields in Swing to Table fields in the database

    Can some one give the code of how to bind JtextFields in Swing to Table fields in the database
    Am really new to java programming and have interest in learning

    The standard JDK doesn't do this for you. If you search on Google, you may find some 3rd party packages that will do this.
    You need to create your own form add execute the appropriate SQL yourself. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access to get started.

  • How do I scroll in newsstand app to see all my magazines?

    I can only see my latest downloaded 16 magazines in my newsstand app. Left, right, top and bottom scrolling doesn't move anything. How do I scroll to look at my older downloaded magazines?

    It will go to full screen but here is the website from the pic.
    http://www.tnt.tv/dramavision.jsp?cid=39883
    I also have problem with this website I can't even see the controls on this one and i can't pause or got to the full screen
    http://www.nbc.com/parenthood/video/the-big-o-4610/1217133/?__source=parenthood%7Chome%7Cf eatured%7Crecent&dst=rss%7Cnbc%7C

  • How to vertically scroll pdf in a webpage ios7

    how to vertically scroll pdf in a webpage ios7

    artifrommumbai wrote:
    scrollbars dont appear, they appear on other IE browsers.
    There is no such thing as IE for iOS.
    There are alternate browsers for iOS - I use iCab Mobile and Chrome on occasion - check the app store. Most are free or very inexpensive.

  • How can I scroll to future years (12 months at a time) in latest version of iOS on Windows PC?

    How can I scroll to future years (12 months at a time) in latest version of iOS iCloud on Windows PC?

    Any replies please??????

  • How do you scroll? Or crop a pic?

    How do you scroll on a page? Say as if the page continues after you get to the bottom of the iPad screen. Also, how do you crop a pic. Every time I try to drag to crop it just enlarges the pic.

    Scrolling down a page is normally done by using one finger on the screen to swipe/drag upwards (or downwards to scroll up). In terms of cropping a picture, what app are you using ? You can't crop in the Photos app (until iOS 5 arrives in the Autumn).

  • How can I scroll messages and folders in Mail with Maverick? It's unacceptable for Apple

    How can I scroll messages and folders in Mail with Maverick? It's unacceptable for Apple to have allowed this to happen

    This problem has been discussed extensively in this thread:
    https://discussions.apple.com/thread/5481937?start=0&tstart=0

  • How do you scroll down in dropdown menus?

    On long dropdown menus where you normally get a scroll bar. Im not seeing a scroll bar in my iPad 2. How do you scroll down in these menus?

    Use two fingers on the screen to scroll.

  • How do you scroll down in new itunes?

    how do i scroll down i tunes. just tried to download a song n it asked me to retick terms n conditions but i cant get to end of page to do it.;

    Use two fingers on the screen to scroll.

  • How do I scroll down compose mail screen in aol. I just increase size

    How do I scroll down in aol compose mail? I just keep enlarging screen when I try

    Hi Happybude1,
    If you can't see the scroll bars you can enable them in the General System Preferences.
    OS X Mountain Lion: Change how scroll bars work
    http://support.apple.com/kb/PH10895
    Use General Preferences to customize scroll bars in windows.
        Choose Apple menu > System Preferences, and then click General.
        Set the scrolling options. For more information about the scrolling options, click the Help button.
    Some apps let you scroll through a document in other ways, such as by dragging in the document, using arrow keys, or pressing the Space bar.
    I like to have mine set for Show scroll bars:  Always.
    Thank you for thinking of Apple Support Communities for your support needs.
    Nubz

  • How do you scroll down on Voice Over

    How do you scroll down on VoiceOver?

    hi,
    when you get to the settings option , do not tap the screen instead swiftly touch and drag the screen wiht three fingers , and you can actully go toaccesibility .
    i was crazy wiht this thing for 2 days but somehow could get an answer.
    pl try this

  • How to Hide Scroll Bars in Hierachy Tree?

    Hi!
    How to Hide Scroll Bars in Hierachy Tree?
    Thanks!

    when I populate the Tree Item with populate_tree(). I get a hierarchical tree. when the tree populates, two scroll bars (on it right and bottom) are displayed. Can I hide them?

  • How to add scroll bar in child form ( vb6.0 )

    look at this picture link (i think you will understand the issue)
    http://tinypic.com/r/25k232u/8
    These information(class1,class2 ……) are loaded from database and this time the information is too much and it moves down to the appearing part of the window and unable to view these items
    How to add scroll bar in visual basic child form so that the data items can be viewed by scroll in case it go beyond the screen.

    Hi,
    Welcome to MSDN.
    I am afraid that these forums donot support VB6 any more, you could refer to this thread:
    Where to post your VB 6 questions
    You could consider posting this issue in these forums below:
    These forums do not support Visual Basic 6, however there are many third-party support sites that do. If you have a VB6-related question please visit these popular forums:
    VB Forums
    VB City
    Thanks for your understanding.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Exit or Badi for ME21N /  ME22N to update Shipping data

    Hi gurus, when i try to modify or create any purchasing order i need to force to 'X' the field - Order Combination Indicator - ( MEPO1331-KZAZU ) i try to implement badi ME_PROCESS_PO_CUST - method PROCESS_ITEM ed exit - EXIT_SAPMM06E_013 - but nothi

  • Display with vertical lines

    I have vertical lines on my screen. Tried hard reset but no success.

  • How to configure the work manager java code to eclipse?

    Hello all,                I am working with the syclo work manager app. I have successfully installed all components required.                I imported the work manager mobile application and I want to import the standard work manager java code, wha

  • Feature in XI

    Hi, What about new feature idea of improvement in XI. What kind of projects i will expect in feature. I heard its moving towards ESOA how it is useful for XI Guys.

  • The mother-in-law bug

    Hi to all. This is my first, and I hope last, topic on this forum. iPhone is a wonderful piece of art, and it works very well. There's only one flaw, that I can't understand. Everytime my mother-in-law calls me, my iPhone freezes: on the screen compa