Created
April 14, 2009 06:06
-
-
Save koichiro/95002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
static class JCheckboxWithLabel extends JCheckbox { | |
public JLabel label; | |
public JCheckboxWithLabel(String label) { | |
super(); | |
label = new JLabel(label); | |
} | |
} | |
static public void main(String[] args) { | |
ActionListener l = new ActionListener() { | |
public void actionPerformed(ActionEvent e) { | |
JCheckboxWithLabel checkbox = (JCheckboxWithLabel) e.getSource(); | |
checkbox.label.setBackground(/* てきとーに色 */); | |
} | |
} | |
JCheckboxWithLabel checkbox1 = new JCheckboxWithLabel("checkbox1"); | |
JCheckboxWithLabel checkbox2 = new JCheckboxWithLabel("checkbox2"); | |
JCheckboxWithLabel checkbox3 = new JCheckboxWithLabel("checkbox3"); | |
checkbox1.addActionListener(l); | |
checkbox2.addActionListener(l); | |
checkbox3.addActionListener(l); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment