java - NetBeans form designer: Change layout after call to initComponents -
I have a class that spreads javax.swing.JPanel
, it has a pocket button I have created a class in Netbeans Designer , like I have a initComponents ()
function called a Class Constructor.
What do I have to do when / when a function is called, then I change the layout of the second button, and the two buttons. Just do it:
add public zero seconds () {javax.swing.JButton secondButton = new javax.swing.JButton (); Add (Second Button, Java.A.T.BirdLyut.Setter); }
does not work, the new button is not visible I tried calling to invalid ()
, but no luck
- How can I re-evaluate the layout?
- If it is said that the function is called more than once, then which part of the layout / button is required to call the settlement ()?
- If I can not use NetBean Designer, will it be easy to handle?
before adding the button to you BorderLayout.CENTER
You have to set the panel layout. In addition, you must first add and add the button again and apply the modified ()
method to the panel.
Change your addSecond () method below and it should work. / P>
Private Zero addSecond () {JButton secondButton = New JButton ("Button - 2"); This.setLayout (new border layout ()); Delete (firstButton); Addition (First Button, Border Layout, North); Add (Second Button, Border Layout, CA); Re-verified (); }
Comments
Post a Comment