Results 1 to 2 of 2
  1. #1
    deshprateek is offline Member
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Default How to place components on JPanel

    Dear friends,
    i have a problem that i cant place components in proper order on JPanel. I dont know how to use method .setBounds() of a perticular component while placing on JPanel.

    Please help me
    as soon as possible

    Thank you.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You may get better help if you post your code since that way we can see what you are doing right and what you are doing wrong. For instance, I would assume that you are adding components to a JPanel that uses the "null" layout (myPanel.setLayout(null);), but I could be wrong. You could have left the JPanel's layout alone, and thus are using the default FlowLayout.

    Regardless, the most important thing that you can do here is to go to the Sun Swing tutorials and read up on the layout managers and how to use them. you are far better off not using null layout and setBounds but instead using proper layouts such as GridLayout, BorderLayout, FlowLayout, and BoxLayout. I'd avoid GridBagLayout and SpringLayout for now.

    Good luck and HTH.

Similar Threads

  1. how to place the controls >
    By makpandian in forum AWT / Swing
    Replies: 1
    Last Post: 12-18-2008, 07:17 AM
  2. help?! paint on top of swing components on JPanel
    By beam2008 in forum AWT / Swing
    Replies: 1
    Last Post: 12-05-2008, 05:15 AM
  3. How can i copy a folder from one place to another..
    By rajeshgubba in forum New To Java
    Replies: 4
    Last Post: 06-14-2008, 03:21 AM
  4. How to place the GUI components in correct order
    By impact in forum New To Java
    Replies: 2
    Last Post: 05-04-2008, 07:41 AM
  5. Removing components from JPanel
    By Echilon in forum New To Java
    Replies: 0
    Last Post: 12-30-2007, 05:05 PM

Posting Permissions

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