hi
this is jus a question. if you are doing a program that uses a GUI, with the radiobutton, checkboxes and so on
why do you have add an import for all the jradiobutton and jcheckbox. is is necessary to add an import for each of them

import is optional.
You can always code the fully-qualified name javax.swing.JRadioButton every time you need it, but that can be very tedious.
So you have the option to import javax.swing.JRadioButton at the start of your .java file and then you can just use the short name JRadioButton
Similarly you can import the names of every swing class with import javax.swing.*
(but be careful - for example if you import java.awt.* then List can be seen as the awt control, not the Collection).

The choice is yours for each .java file ... use the fully qualified name, or use inport .

thanks james

hey james

another question, is it necessary need to import a gridlayout

It's the same answer for any class in the Java API.

... more precisely:

its the same answer for any class in any package other than the current package.
Except there is an implicit import for java.lang.* so you can refer to classes like String without having to do anything.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.