Results 1 to 2 of 2
  1. #1
    sajib_bd is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Unhappy add scrollbar in JFrame with null Layout

    I am using following code to create a frame. I want to add scrollbar on it.

    jobConfFrame=new JFrame("Resource Configuration Panel");
    jobConfFrame.setLocationRelativeTo(null);
    jobConfFrame.setDefaultCloseOperation(jobConfFrame .DISPOSE_ON_CLOSE);
    jobConfFrame.setSize(400,400);
    jobConfFrame.setResizable(false);
    jobConfFrame.setVisible(true);
    jobConfFrame.getContentPane().setLayout(null);

    I tried to add a scrollbar, but for some reason it was not visible on the frame (may be for the null layout). If you have any idea to solve the problem, please send the solution.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default

    Read the API for JScrollPane and follow the link to the Swing tutorial on How to Use Scroll Panes. Note that if you use a null layout (which I strongly recommend against) you have to assume the responsibility of supplying a preferredSize for the scorll pane's viewport view.

    db

Similar Threads

  1. JFrame Layout
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 16
    Last Post: 06-16-2010, 02:48 AM
  2. Edit layout Layout please help me
    By manhtungtnk28@gmail.com in forum New To Java
    Replies: 4
    Last Post: 11-23-2009, 09:41 AM
  3. [SOLVED] JFrame Layout
    By AndrewM16921 in forum New To Java
    Replies: 4
    Last Post: 04-09-2009, 02:11 AM
  4. how to add scrollbar in netbeans
    By kumar_gemi in forum NetBeans
    Replies: 1
    Last Post: 03-12-2009, 07:50 PM
  5. Using java.awt.Scrollbar
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-03-2008, 10:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •