Or put it in an initialization block by surrounding the code with { } Scott
> On Nov 12, 2021, at 5:00 AM, Pieter van den Hombergh > <pieter.van.den.hombe...@gmail.com> wrote: > > > you are calling a method in the class body, but there you can only do > declarations (of fields and methods). To do this kind of call you must be > inside a method. Move the call to setEnabled(...)to inside a method or into > the constructor. The most appropriate method for this might be something > init() like. > > Op vr 12 nov. 2021 05:25 schreef Zulfi Khan <zulfi6...@yahoo.com.invalid>: >> Hi, >> I am working on Apache NetBeans 12.5. >> I have created Jbutton and JTextField controls and changed their default >> variable names to: >> >> private javax.swing.JButton btnCalInterest; >> private javax.swing.JTextField cNumTF; >> >> public class RButtArrListJFrame extends javax.swing.JFrame { >> : >> : >> btnCalInterest.setEnabled(false); >> cNumTF.setEnabled(false); >> >> >> I am getting following error messages: >> >> <identifier> expected >> >> illegal start of types >> >> package CNumTF does not exist >> >> Surround with .... >> >> >> >> I have attached the images of variable names and error messages. >> >> Somebody please guide me. >> >> Zulfi. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org >> For additional commands, e-mail: users-h...@netbeans.apache.org >> >> For further information about the NetBeans mailing lists, visit: >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists