Visual Class Component as local variable [message #612978] |
Tue, 30 May 2006 02:35 |
Eclipse User |
|
|
|
Originally posted by: arivera.ucentral.cl
I want to know if I can set as local variable a component inserted from
the control palette. For example a JSeparator, is not necesary to be
declared as a field of my class or a JLabel, ...
Example:
Visual Editor generates this code
import...
public class MyFrame extends JFrame {
private JPanel jPanel1 = null;
private JLabel jLabel1 = null;
private JSeparator jSeparator = null;
//...
JPanel getJPanel1() {
if ()//...
jPanel1.add(getJLabel1());
//..
}
private JLabel getJLabel1() {
//...
}
}
while i would like something like this...
public class MyFrame extends JFrame {
private JPanel jPanel1 = null;
//...
JPanel getJPanel1() {
if ()//...
JLabel jLabel1 = new JLabel("Label text"); // JLabel1 is local
jPanel1.add(jLabel1);
//..
}
}
there is any option to do that? or I have to do it manually
|
|
|
Powered by
FUDForum. Page generated in 0.09465 seconds