1

I am using Netbeans 7.3 which comes with a WYSIWYG gui designer. I am using it to design my java application via swing. I have a JFrame with a gridlayout, in it i have a Jplanel1 with a gridBagLayout. Inside that i have a Jpanel2 with a free design layout.

To be clearer:

JFrame
-->GridLayout
   JPanel2
   --> GridBagLayout
       JPanel3
       -->JLabel1

Now when i try to edit the JLabel1 text, the JPanel2 maximises in the design view. I am unable to go back to view the entire design. (only was is to undo). The same phenomenon happens if i try to change the text via properties of JLabel1.

What am i doing wrong here? Thanks in advance for any help. Please take a note that this has something to do with Netbeans design editor view, not when my application is complied and run.

This is my entire code generated by NetBeans IDE

http://pastebin.com/H4qVkuHb

kype
  • 555
  • 1
  • 6
  • 24
  • What constraints you using to add the `JLabel` to the `JPanel` with `GridBagLayout` ? – nIcE cOw Oct 12 '13 at 11:16
  • @nIcEcOw The JPanel3 (which holds the JLabel) is of group layout. The JPanel2, which holds the JPanel3 is gridBagLayout. And as far as my knowledge goes, its using default constraints. This is the only code which sets the constraints in my block of code jPanel2.add(jPanel3, new java.awt.GridBagConstraints()); – kype Oct 12 '13 at 11:22
  • Ahha, my bad, my knowledge in `GroupLayout` hasn't even started yet. For me this `Layout` belongs to the `IDE`, though many a good fellow stack-overflow users are too good in this layout. They might can help :-) But still without code, it will be tough for any one to tell, what is happening behind the scenes :-) – nIcE cOw Oct 12 '13 at 11:27
  • No worries. Thanks for your help anyways. Updated my main post with link to full code generated for others to help if possible – kype Oct 12 '13 at 11:35
  • Edit i think it has something to do with jLabel being big and thus maximising the Jpanel – kype Oct 12 '13 at 11:41
  • 1
    Seems like you using the old version of `GroupLayout` as `NetBeans` forums are saying [this](http://forums.netbeans.org/topic24755.html) – nIcE cOw Oct 12 '13 at 12:08
  • Thanks. Im figuring the main problem is using GridBagLayout which is a pretty complicated layout. However thats the only layout that keeps my panels at the centre upon window resize. – kype Oct 12 '13 at 12:36
  • It appears aligned to me, though if I change the `JLabel1`'s text to `Beitu University Limited`, then it does goes to a bit left, along with `JLabel2`. Though it appears to be that `jpanel1` is having `GroupLayout`, `jpanel3` is also with `GroupLayout`, though only `jpanel1` has `GridBagLayout`. So since `JLabel` in question is added to the `JPanel` with `GroupLayout`, so it can be an issue with that layout too. Though for the rest, you're MOST WELCOME and KEEP SMILING :-) – nIcE cOw Oct 12 '13 at 12:42

0 Answers0