participate


Swing - Solved - Strange behaviour in NetBeans 5.5 (and SE 6) [Locked]
This topic is locked
<<   Back to Forum  |   Give us Feedback
This topic has 4 replies on 1 page.
Franzisk
Posts:80
Registered: 30/01/07
Solved - Strange behaviour in NetBeans 5.5 (and SE 6)   
Feb 9, 2007 6:03 AM

 
I am using NB 5.5 and I created a new JInternalFrame and choose Free Design then it created the Layout like following (works perfectly this way):
javax.swing.GroupLayout caixaOcorrenciaLayout = new javax.swing.GroupLayout(caixaOcorrencia);
        caixaOcorrencia.setLayout(caixaOcorrenciaLayout);
        caixaOcorrenciaLayout.setHorizontalGroup(
            caixaOcorrenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, caixaOcorrenciaLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(caixaOcorrenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING))
                .addGap(16, 16, 16)
                .addGroup(caixaOcorrenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cbOcorrencia, javax.swing.GroupLayout.Alignment.LEADING, 0, 461, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, caixaOcorrenciaLayout.createSequentialGroup()
                        .addComponent(campoNumeroNota, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, Short.MAX_VALUE)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoCNPJ, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, caixaOcorrenciaLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(caixaOcorrenciaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(campoTextoLivre, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 461, Short.MAX_VALUE)
                            .addGroup(caixaOcorrenciaLayout.createSequentialGroup()
                                .addComponent(calData, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoHora, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbObservacao, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(12, 12, 12))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, caixaOcorrenciaLayout.createSequentialGroup()
                .addContainerGap(421, Short.MAX_VALUE)
                .addComponent(btnConfirmar, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );


But when I added a JPanel to a JTabbedPane (in an old JInternalFrame I had already) and choose Free Design, it created the Layout as following:
org.jdesktop.layout.GroupLayout painelOcorrenciaLayout = new org.jdesktop.layout.GroupLayout(painelOcorrencia);
        painelOcorrencia.setLayout(painelOcorrenciaLayout);
        painelOcorrenciaLayout.setHorizontalGroup(
            painelOcorrenciaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(painelOcorrenciaLayout.createSequentialGroup()
                .add(20, 20, 20)
                .add(jLabel42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 110, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 300, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );


I dont want to use JDesktop, I want to use the Swing package, but what can I do since NB does that (the codification) by it self?

Thanks
F.

Message was edited by:
Franzisk
 
kirillg
Posts:627
Registered: 8/1/06
Re: Solved - Strange behaviour in NetBeans 5.5 (and SE 6)   
Feb 9, 2007 11:03 AM (reply 1 of 4)  (In reply to original post )

 
I am using NB 5.5 and I created a new JInternalFrame
and choose Free Design then it created the Layout
like following (works perfectly this way):

I dont want to use JDesktop, I want to use the Swing
package, but what can I do since NB does that (the
codification) by it self?

Don't use Free Design if you don't want to use GroupLayout.
 
amayer
Posts:1
Registered: 2/22/07
Re: Solved - Strange behaviour in NetBeans 5.5 (and SE 6)   
Feb 22, 2007 12:21 AM (reply 2 of 4)  (In reply to original post )

 
I dont want to use JDesktop, I want to use the Swing
package, but what can I do since NB does that (the
codification) by it self?

I assume your question is that you don't want to use the org.jdesktop.layout.GroupLayout class, but the new Java6 javax.swing.GroupLayout. To switch between the two, do the following:

1. Open the respective form.
2. In the projects pane, open the sub-items of the form class (the small "+" before the entry).
3. Click on the "Form" element (for example, if you have an "AboutDialog.java", there are the "AboutDialog" and the "Form AboutDialog" elements there.)
4. In the properties of the "Form", switch the "Layout Generation Style" to "Standard Java 6 Code".

This one had me quite a bit; I've had the converse problem, wanting to make an application compatible with Java 5. The thing is, it doesn't change anything for already-generated forms if you change this setting in the global options... and you can't change it manually, as you said, because it's in the generated code.
 
Knut_Erik_Borgen
Posts:1
Registered: 3/17/05
Re: Solved - Strange behaviour in NetBeans 5.5 (and SE 6)   
Jan 21, 2009 3:48 AM (reply 3 of 4)  (In reply to #2 )

 
There seems there is a way to trigger it to make clean code again. I found the following line in the .form file:

<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>

Set it to '2' and it will generate in 1.5 mode with compability libraries - switch to 1 and the code will use javax.swing again.

Knubo
 
PhHein
Posts:10,727
Registered: 8/16/01
Re: Solved - Strange behaviour in NetBeans 5.5 (and SE 6)   
Jan 21, 2009 3:55 AM (reply 4 of 4)  (In reply to #3 )

 
Stop reviving years old threads, please. I'm locking.
 
This topic has 4 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 59
  • Guests : 125

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums