Java Code Examples for javax.swing.JButton.getClientProperty()

The following are Jave code examples for showing how to use getClientProperty() of the javax.swing.JButton class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: xitk   File: SecurePasswordInputPanel.java   Source Code and License Vote up 6 votes
@Override
public void actionPerformed(ActionEvent event) {
    JButton btn = (JButton) event.getSource();
    String pressedKey = (String) btn.getClientProperty("key");

    if (CAPS.equals(pressedKey)) {
        for (JButton button : buttons) {
            String text = button.getText();
            text = caps ? text.toLowerCase() : text.toUpperCase();
            button.setText(text);
        }
        caps = !caps;
        return;
    }

    if (BACKSPACE.equals(pressedKey)) {
        if (password.length() > 0) {
            password = password.substring(0, password.length() - 1);
        }
    } else if (CLEAR.equals(pressedKey)) {
        password = "";
    } else {
        password += btn.getText();
    }
    passwordField.setText(password);
}
 
Example 2
Project: the-one-mdonnyk   File: NodeChooser.java   Source Code and License Vote up 5 votes
/**
 * Action listener method for buttons and node set chooser
 */
public void actionPerformed(ActionEvent e) {
	if (e.getSource() instanceof JButton) {
		JButton source = (JButton)e.getSource();
		DTNHost host = (DTNHost)source.getClientProperty(HOST_KEY);
		gui.setFocus(host);
	}
	else if (e.getSource() == groupChooser) {
		setNodes(groupChooser.getSelectedIndex() * MAX_NODE_COUNT);
	}
}
 
Example 3
Project: the-one-mdonnyk   File: EventLogPanel.java   Source Code and License Vote up 5 votes
/**
 * Action listener for log entry (host & message) buttons
 */
public void actionPerformed(ActionEvent e) {
	JButton source = (JButton)e.getSource();
	
	if (source.getClientProperty(HOST_PROP) != null) {
		// button was a host button -> focus it on GUI
		gui.setFocus((DTNHost)source.getClientProperty(HOST_PROP));
	}
	else if (source.getClientProperty(MSG_PROP) != null) {
		// was a message button -> show information about the message
		Message m = (Message)source.getClientProperty(MSG_PROP);
		gui.getInfoPanel().showInfo(m);
	}
}
 
Example 4
Project: Bachelor-Thesis   File: NodeChooser.java   Source Code and License Vote up 5 votes
/**
 * Action listener method for buttons and node set chooser
 */
public void actionPerformed(ActionEvent e) {
	if (e.getSource() instanceof JButton) {
		JButton source = (JButton)e.getSource();
		DTNHost host = (DTNHost)source.getClientProperty(HOST_KEY);
		gui.setFocus(host);
	}
	else if (e.getSource() == groupChooser) {
		setNodes(groupChooser.getSelectedIndex() * MAX_NODE_COUNT);
	}
}
 
Example 5
Project: Bachelor-Thesis   File: EventLogPanel.java   Source Code and License Vote up 5 votes
/**
 * Action listener for log entry (host & message) buttons
 */
public void actionPerformed(ActionEvent e) {
	JButton source = (JButton)e.getSource();
	
	if (source.getClientProperty(HOST_PROP) != null) {
		// button was a host button -> focus it on GUI
		gui.setFocus((DTNHost)source.getClientProperty(HOST_PROP));
	}
	else if (source.getClientProperty(MSG_PROP) != null) {
		// was a message button -> show information about the message
		Message m = (Message)source.getClientProperty(MSG_PROP);
		gui.getInfoPanel().showInfo(m);
	}
}