the panel stays blank.
I've tried different layout managers as well, but lets assume its Flow for example's sake.
I did an extensive Google search, and this is a common question, however the common solution by revalidate() and repaint() methods does not work!

I made the following test program in NetBeans to demonstrate the problem:

Code:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

Thanks but I've started there, and I have studied it. Hows this relevant to the problem anyway? I have objects that aren't being shown, I'm not concerned about the alignment at this point.

Thanks for trying but its not helpful.

[EDIT]
Apparently my JPanel did not inherit the layout from the parent content pane. I had a JLabel display just now, but I won't rush calling it solved.

06-13-2010, 05:07 AM

Fubarable

Quote:

Originally Posted by r00tb33r

OK, I'm not and now that you say that I won't.

Really? I even highlighted it for you in the original post. I really can't add much if you aren't even looking. ...
I will provide excerpts from my first post however:

Code:

...
getContentPane().setLayout(new java.awt.FlowLayout());
...

You are adding JLabels to panel not to the contentPane, and panel most definitely does not use FlowLayout but rather GroupLayout. Do you want me to point out the relevant code?

Quote:

Thanks for trying but its not helpful.

Saying this will not motivate me to try to help further. If you are unsure about something we say, please ask for clarification, but it's not in your best interest to criticize free help that we give in our spare time.

06-13-2010, 05:15 AM

curmudgeon

I think he's right. If you get rid of all that GroupLayout crap-code, your code works.

Just a thought, you tried running the example program in my first post? I think it demonstrates the problem rather clearly.

Thanks but I've started there, and I have studied it. Hows this relevant to the problem anyway? I have objects that aren't being shown, I'm not concerned about the alignment at this point.

And yes, I ran your code, and yes, layouts and your understanding of them are fundamental to the problem. Again, you're farking your code by using GroupLayout here. But you can choose not to listen to my recommendations if you wish. Up to you.

06-16-2010, 06:03 AM

r00tb33r

Actually the problem came from Swing's strange inheritance of properties from parent objects, or rather the lack of it.
I'm a bit more used to VCL inheritance behavior where by default child objects inherit all formatting properties. Lesson learned.