Results 1 to 2 of 2
  1. #1
    Josep_16's Avatar
    Josep_16 is offline Member
    Join Date
    Mar 2011
    Posts
    40
    Rep Power
    0

    Default Swing components are not well-displayed

    Hello. I don't know if this has ever happened to any of you or not, but it's draving me crazy because I have no idea where's the source of the problem... The thing is that ALL my swing components, such as JTextFields, JButtons, JComboBoxes, JRadioButtons, are not displayed at once in the applet; but, when I get the cursor over the swing component's site, it appears (not with JLabels though). It has nothing to do with the Layout or the situation of the component's, nor the execution environment of the applet, because it happens in the Appletviewer, in Google Chrome, and in Mozilla Firefox, nor the kind of component. I'll show you some screenshoots of a JPanel with a GridLayout.

    Getting the cursor over it for the first time:



    After some time clicking:



    All I can arrive to see (it stills missing the top row and some JLabels):



    Hope you know how to solve this. I don't think it's something related with the code, because it even happens with the most simple JButton.
    If you need anything else just ask me.

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,227
    Rep Power
    6

    Default

    This happens when you add components to a top level container AFTER the container is visible.

    Hope you know how to solve this. I don't think it's something related with the code, because it even happens with the most simple JButton. If you need anything else just ask me.
    If you still don't know how to fix at after my above suggestion, then create a simple SSCCE that only contains a single button and no other code so we can see what you are doing wrong.

Similar Threads

  1. Swing Components Placing
    By ne2000 in forum Eclipse
    Replies: 2
    Last Post: 06-23-2008, 08:00 AM
  2. How to print Swing components
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:04 PM
  3. Where is it best to declare swing components?
    By MacNstuff in forum AWT / Swing
    Replies: 1
    Last Post: 02-06-2008, 12:59 AM
  4. Java Components are not displayed(sometimes)
    By archanajathan in forum AWT / Swing
    Replies: 3
    Last Post: 11-05-2007, 08:34 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
  •