KwickClips Java · 39 sec · free
Why can my code not find the control after I changed its text?
Short answer. Text and variable name are two different things. Change Variable Name changes the code name.
What prefix is used for a text field?
txt, for example txtP.
Three controls
| Control | Prefix |
|---|---|
| JLabel | lbl |
| JTextField | txt |
| JButton | btn |
Remember
| Text is what users see |
| Variable name is for code |
Changed the text but code cannot find it? Why? Prefix names the control type. Drag controls from the Palette. Edit Text changes what users see. Variable Name changes the code name. Text is what users see. Variable name is used in code.
This clip is from the full lesson: GUI Applications in NetBeans: JFrame, JPanel, JTable and JOptionPane — 7 minutes, with the tables, the quick answers and the whole lesson in text.
Useful for: CBSE Class 11 Information Technology (802), CBSE Class 11 Information Technology (802)
More KwickClips from this lesson
What is a JFrame?40 sec
Which class groups controls together?39 sec
Why does nothing happen when I click the button?41 secVoice-over is AI-generated; the script is written and checked by Kajal Ma'am. Confirm anything you plan around against your official board document. We never ask for a password or an OTP.

