Results 1 to 4 of 4
  1. #1
    t500yo is offline Member
    Join Date
    Jun 2010
    Posts
    14
    Rep Power
    0

    Unhappy Swing: unstabel window paint?

    Good day everyone,
    I have got a little problem with java/swing. When I create a window with JFrame, a JMenuBar and a JPanel the windows does not load well.
    I only have got two windows which have both a JMenuBar and a JPanel. The main window has the problem that the JPanel does not load all the time and the about box (main window > JMenuBar > Help > About...) is sometimes too small, sometimes as big as the whole screen and sometimes the JMenuBar has space above it... The strange thing is that if you reopen the same window in the same session, it can look different and when you resize a window, you'll see it as it was meant to be..? I tried to repaint the components, but that did not help. So what did I do wrong?
    In the attachment you'll find my source as well as the .class files.

    I'm working on a ubuntu 10.4 system with
    javac 1.6.0_20
    java version "1.6.0_18"
    OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1)
    OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)

    Ow, It is for school btw. Not really homework, but an extra project. I only have had a single Java starters course and this is a product of one day reading all kind of tutorials, one half a day typing and testing and three days trying to solve this error.
    Attached Files Attached Files

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,310
    Blog Entries
    7
    Rep Power
    20

    Default

    I didn't read all of your code but I noticed that an AnaFoldMain extends an AbstractWindow which extends from a JFrame but it also has a JFrame. That doesn't sound right to me.

    kind regards,

    Jos

  3. #3
    t500yo is offline Member
    Join Date
    Jun 2010
    Posts
    14
    Rep Power
    0

    Default

    Hey Jos,
    Thank you for you reply! It seems you were right.
    I deleted "extends JFrame" and altered the rest of my code so that there were no errors when compiling and now it works fine.
    Bedankt!
    Groeten, Jos (yea, thats is my name as well)

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,310
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by t500yo View Post
    Hey Jos,
    Thank you for you reply! It seems you were right.
    I deleted "extends JFrame" and altered the rest of my code so that there were no errors when compiling and now it works fine.
    Bedankt!
    Groeten, Jos (yea, thats is my name as well)
    Geen dank; graag gedaan. When something has a 'is a' relation as well as a 'has a' relation with its own type it is either a Decorator (Wrapper) or Composite or there's something rotten in the state of Denmark ;-)

    kind regards,

    Jos

Similar Threads

  1. Replies: 4
    Last Post: 01-10-2010, 07:48 AM
  2. change url in parent window from child window
    By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-09-2009, 12:17 PM
  3. how can i move one frame window to another window
    By santhosh_el in forum AWT / Swing
    Replies: 8
    Last Post: 06-10-2009, 03:36 PM
  4. help?! paint on top of swing components on JPanel
    By beam2008 in forum AWT / Swing
    Replies: 1
    Last Post: 12-05-2008, 04:15 AM
  5. XTerm window appearing in full screen swing app
    By clarose in forum AWT / Swing
    Replies: 1
    Last Post: 11-17-2008, 10:56 PM

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
  •