I want to use a variable inside and outside my class
Simply I have the application below, and I want from another application to check the value of the integer (action). how can I do this without doing this :
Properties prop =new Properties();
which opens the frame and this is what i dont want to do.
// Here Is my program
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclass Propertiesextends JFrame
{
private JRadioButton adfButton, normalButton, hiddenButton;
private ButtonGroup radioGroup;
publicint action;
// GUI
public Properties()
{
super ("Properties");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container container = getContentPane();
container.setLayout(new FlowLayout() );
JLabel message =new JLabel("Choose a way for scanning : \n");
container.add(message);
adfButton =new JRadioButton("\nADF scanning",true );
container.add( adfButton);
normalButton =new JRadioButton("Normal scanning",false );
container.add( normalButton );
hiddenButton =new JRadioButton("Hidden Interface scanning",false);
container.add( hiddenButton );
getAction handler =new getAction();
adfButton.addItemListener( handler );
normalButton.addItemListener( handler );
hiddenButton.addItemListener( handler );
radioGroup =new ButtonGroup();
radioGroup.add( adfButton );
radioGroup.add( normalButton );
radioGroup.add( hiddenButton );
setSize( 300, 200 );
setVisible(true );
}// end constructor
publicclass getActionimplements ItemListener
{
publicvoid itemStateChanged( ItemEvent event )
{
if (event.getSource()==adfButton)
action = 1;
elseif ( event.getSource()== normalButton )
action = 2;
elseif ( event.getSource()== hiddenButton )
action = 3;
}
}
publicstaticvoid main( String args[] )
{
Properties application =new Properties();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}

