|
I am currently writing a gui program which has the following classes.
class 1 which contructs the GUI (menubar, jtoolbar, Jlabels etc..) using several methods. one of these methods is the following. method createlabels jp = JPanel() jp.setLayout( GridLayout( 1,0,0,50) ) jl = JLabel( filesselected, JLabel.LEFT ) jl2 = JLabel( totalfiles, JLabel.LEFT ) jp.add( jl, BorderLayout.EAST ) jp.add( jl2,BorderLayout.CENTER ) class 2 implements ActionListener which implements actionlistener and takes care of the menubar & jtoolbar selections. class OptionSelected implements ActionListener properties inheritable comp = String opt = String method actionPerformed( e = ActionEvent ) select when opt = "New" then jl.setText( opt ) when opt = "Open" then jl.setText( opt ) Otherwise exit 0 end When compiling said program the following error message appears, Error: The method jl.setText( java.lang.string ) cannot be found in class 2 or super class. I understand what this means but how can I change the text of a JLabel (jl in this case) when a selection (as above) is made. Any help is appreciated Thanks, Quique ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
|
thanks, I try this out.
Quique -----Mensaje original----- De: [hidden email] [mailto:[hidden email]]En nombre de [hidden email] Enviado el: miƩrcoles, 17 de agosto de 2005 04:47 Para: [hidden email] Asunto: RE: Netrexx and Swing problem > thanks, the properties of class 1 shows the below mentioned, is this not > correct? No, it cannot see it in another class. In these cases, I tend to have the event handler in a dependent class and make the property inheritable, so you can address it with parent.jl1 (for example) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
| Free forum by Nabble | Edit this page |
