Hi, I've come into a sort of odd problem/glitch and was wondering if anyone be of some help.
I'm in the process of making a simple web-browser that is being displayed using a JFrame. In the JFrame so far there are various Jbuttons, JTextAreas, JLabels and so on.
When I run my program (I am doing frame.setVisible(true)) , about 80% of the time, the JFrame will not accurately display everything within it.
For instance, I have both a back and submit button in the JFrame. The back button will always show, but occasionally the submit button will appear to be blank even though the text "submit" is explicitly assigned to it. I am beginning to think that this may be an issue with my computer, but I have not tested this on other computers so I don't know if it's just mine.
However, if I maximize the window and then restore the size, the seemingly-non-existent components of the JFrame magically appear.
Included also are some screenshots (of the JFrame both with all elements and without some elements):
With all the elements of the JFrame visible:
With only some visible: (The Label that has text "Label" and part of the send Button are missing)
I still don't get why only some of the text disappears... Also if it helps I'm running Windows XP SP2 with a NVidia GeForceGo 7900 GS graphics card (supports SLI)
Any help would be great, Thanks!
Edit: Another note, I'm using Eclipse SDK
[ April 16, 2008: Message edited by: Kevin Doo ] [ April 16, 2008: Message edited by: ]
Are you calling frame.pack() before showing it? Show some piece (or all) of you code. This may be easier to help you.
Joined: Apr 16, 2008
Here's the code. I tried it today using Linux and it always displayed perfectly with no problems.
However, when I run the same program on Windows XP SP 2, the issue above occurs (look at the difference between the two pictures). I was told by the TA's in my class that the error is mainly Window's version of java is slightly buggy when it comes to using JFrame.
Although it is not in the code, I tried doing link1.setPreferredSize(new Dimension etc.) and it yielded the same result. I am beginning to think it is more of an issue with my computer than anything else.
Oh, and yes I do call frame.pack(). However, I just realized that I did not do a setPreferredSize on the JPanel. Could that be a problem?