ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { boolean oldhasChanged = hasChanged; hasChanged = chkBoxPrivateEntry.isSelected() != person.isPrivateEntry(); firePropertyChange("hasChanged", oldhasChanged, hasChanged); } };
chkBoxPrivateEntry.setSelected(person.isPrivateEntry()); ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { boolean oldhasChanged = hasChanged; hasChanged = chkBoxPrivateEntry.isSelected() != person .isPrivateEntry(); firePropertyChange("hasChanged", oldhasChanged, hasChanged); } };
	private void drawPanel() {		setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20));		JPanel buttonPanel = new JPanel();		buttonPanel.setLayout(new GridLayout(0, 2));		JLabel label = new JLabel(JFritz.getMessage("private_entry") + ": ");		buttonPanel.add(label);		chkBoxPrivateEntry = new JCheckBox();	    ChangeListener changeListener = new ChangeListener() {	        public void stateChanged(ChangeEvent changeEvent) {	        	boolean oldhasChanged = hasChanged;	        	hasChanged = chkBoxPrivateEntry.isSelected() != person.isPrivateEntry();	    		firePropertyChange("hasChanged", oldhasChanged, hasChanged);	        }	      };		chkBoxPrivateEntry.addChangeListener(changeListener);		buttonPanel.add(chkBoxPrivateEntry);		label = new JLabel(JFritz.getMessage("firstName") + ": ");		buttonPanel.add(label);		tfFirstName = new JTextField(person.getFirstName());		tfFirstName.addCaretListener(this);		buttonPanel.add(tfFirstName);		label = new JLabel(JFritz.getMessage("lastName") + ": ");		buttonPanel.add(label);		tfLastName = new JTextField(person.getLastName());		tfLastName.addCaretListener(this);		buttonPanel.add(tfLastName);		label = new JLabel(JFritz.getMessage("company") + ": ");		buttonPanel.add(label);		tfCompany = new JTextField(person.getCompany());		tfCompany.addCaretListener(this);		buttonPanel.add(tfCompany);		label = new JLabel(JFritz.getMessage("street") + ": ");		buttonPanel.add(label);		tfStreet = new JTextField(person.getStreet());		tfStreet.addCaretListener(this);		buttonPanel.add(tfStreet);		label = new JLabel(JFritz.getMessage("postalCode") + ": ");		buttonPanel.add(label);		tfPostalCode = new JTextField(person.getPostalCode());		tfPostalCode.addCaretListener(this);		buttonPanel.add(tfPostalCode);		label = new JLabel(JFritz.getMessage("city") + ": ");		buttonPanel.add(label);		tfCity = new JTextField(person.getCity());		tfCity.addCaretListener(this);		buttonPanel.add(tfCity);		label = new JLabel(JFritz.getMessage("emailAddress") + ": ");		buttonPanel.add(label);		tfEmail = new JTextField(person.getEmailAddress());		tfEmail.addCaretListener(this);		buttonPanel.add(tfEmail);		JPanel numberPanel = createNumberPanel();		numberPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));		setLayout(new BorderLayout());		add(buttonPanel, BorderLayout.NORTH);		add(numberPanel, BorderLayout.CENTER);		setPreferredSize(new Dimension(350, -1));		setMinimumSize(new Dimension(350, 0));		setMaximumSize(new Dimension(350, 0));	}