Results 1 to 4 of 4
  1. #1
    phantomcraft is offline Member
    Join Date
    Feb 2013
    Location
    The Netherlands
    Posts
    17
    Rep Power
    0

    Default JFrame doesnt show

    Java Code:
    JFrame frame = new JFrame();
            frame.setTitle("Limepop early alpha");
            frame.setSize(sizeX, sizeY);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
    I tought i had everything correct?

  2. #2
    jbarke12 is offline Member
    Join Date
    May 2013
    Location
    Charleston, South Carolina USA
    Posts
    82
    Rep Power
    0

    Default Re: JFrame doesnt show

    It does work if sizex and sizeY are defined. Also I would remove frame.pack() to view the true size of the frame.

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

    Default Re: JFrame doesnt show

    Use setPreferredSize(new Dimension(sizeX, sizeY));

    and keep pack()

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

  4. #4
    jbarke12 is offline Member
    Join Date
    May 2013
    Location
    Charleston, South Carolina USA
    Posts
    82
    Rep Power
    0

    Default Re: JFrame doesnt show

    That is actually the better practice

Similar Threads

  1. Last JLabel I add to JPanel doesnt show up
    By Ambergahill in forum New To Java
    Replies: 6
    Last Post: 01-29-2014, 08:07 PM
  2. JButton doesnt show unless you move mouse over it
    By liluma in forum AWT / Swing
    Replies: 4
    Last Post: 12-06-2011, 03:33 AM
  3. Applet doesnt start or it doesnt show
    By 3dprogger in forum Java Applets
    Replies: 2
    Last Post: 01-07-2011, 07:03 PM
  4. combobox doesnt show!
    By LennyKosmos in forum New To Java
    Replies: 2
    Last Post: 10-26-2010, 08:07 PM
  5. doesnt show exact size
    By clydedoris in forum NetBeans
    Replies: 3
    Last Post: 07-13-2010, 06:59 AM

Posting Permissions

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