Results 1 to 4 of 4

Thread: Swing help

  1. #1
    Nhatmeister is offline Member
    Join Date
    Aug 2013
    Posts
    11
    Rep Power
    0

    Default Swing help

    I have a JFrame object 'window', a JPanel object 'hand' and another JPanel object 'card'.
    I added the 'card' to 'hand' then 'hand' to 'window'. However, the 'card' size is always the same, no matter what I do to setSize();

    window size is 1000, 900
    hand size is 700,700
    card size is 250, 250

    Could someone shed some lights ???

    Thanks

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Swing help

    Some Swing layouts ignore the preferred size of their children.
    Get in the habit of using standard Java naming conventions!

  3. #3
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,709
    Rep Power
    5

    Default Re: Swing help

    Especially the null-layout kind which people new to Swing mistakenly think is easier to use.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,411
    Rep Power
    5

    Default Re: Swing help

    Are you doing a setPreferredSize()? What layout are you using?

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. help with Swing (GUI)
    By Bagzli in forum New To Java
    Replies: 8
    Last Post: 04-04-2011, 12:18 AM
  2. Swing
    By tmotse in forum AWT / Swing
    Replies: 0
    Last Post: 03-31-2010, 10:18 AM
  3. Swing Ide?
    By makpandian in forum AWT / Swing
    Replies: 2
    Last Post: 12-28-2008, 05:07 PM
  4. AWT or Swing
    By bugger in forum AWT / Swing
    Replies: 4
    Last Post: 11-22-2007, 09:44 AM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 07:02 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
  •