codice:
public class CertificateAuthorityGUI implements ActionListener{
	/**
	 * constructor ControlGUI - initialize the variables Frame and Panel.
	 */
	public CertificateAuthorityGUI(){
		frame = new JFrame();
		panel = new JPanel();
		createFrame();
	}
	/**
	 * method createFrame initialize the properties of the JFrame.
	 */
	public void createFrame(){
		frame = new JFrame("Control Validity of a Certificate");
		frame.setSize(700,400);
		frame.add(searchPanel());
		frame.setVisible(true);	
	}
	/**
	 * method searchPanel() draws the components that are shown on the frame.
	 * @return panel
	 */
	public JPanel searchPanel(){
		panel.setBackground(Color.pink);
		panel.add(new Label("Input Country :"));
		panel.add(this.cb = new JComboBox(countryList));
		this.cb.setSelectedIndex(-1);
		this.cb.addActionListener(this);
		panel.add(new Label("Common name :"));
		panel.add(this.nameField = new JTextField("Insert name",40));
		panel.add(new Label("Organization :"));
		panel.add(this.orgField = new JTextField("Insert Organization name",40));
		panel.add(this.button = new JButton("Click to Create a Certificate"));
		this.button.addMouseListener(new MouseAdapter(){
				public void mousePressed(MouseEvent e){
					writedName=nameField.getText();
					writedOrg = orgField.getText();
					String name = "CN="+writedName+" , O="+writedOrg+" , CO="+choosenCountry;
					ca.set(name);
				}});
		
		return panel;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		cb = (JComboBox)e.getSource();
		this.choosenCountry = (String) cb.getSelectedItem();	
	}
	private String[] countryList = {"CH", "IT", "GB", "US", "FR", "ES", "DE"};
	private JFrame frame;
	private JPanel panel;
	private String writedOrg;
	private String writedName;
	private String choosenCountry;
	private JTextField nameField;
	private JTextField orgField;
	private JButton button;
	private JComboBox cb;
	private String name;
	private CertificateAuthorityViewer ca;		
}
dall'altra parte ho semplicemente set(String s) e String get()
ho provato ad inizializzare l'oggetto ca nel costruttore, nell'evento, per niente ...