\r
import java.awt.Color;\r
import java.awt.Dimension;\r
+import java.awt.event.ActionEvent;\r
import java.awt.event.ActionListener;\r
import java.awt.event.ItemListener;\r
import java.awt.event.MouseAdapter;\r
import java.awt.event.MouseEvent;\r
\r
+import javax.swing.AbstractAction;\r
import javax.swing.BoxLayout;\r
import javax.swing.JCheckBox;\r
import javax.swing.JLabel;\r
private void _JCheckBoxPanelRev(String s, int labelWidth) {\r
this.setLayout(new BoxLayout(this,BoxLayout.LINE_AXIS));\r
\r
- this.add(jcheckbox = new JCheckBox());\r
+ jcheckbox = new JCheckBox();\r
+ this.add(jcheckbox);\r
\r
jlabel = new JLabel(s);\r
Dimension d = jlabel.getPreferredSize();\r
}\r
\r
public void setForeground(Color fg) {\r
- if (this.jlabel != null)\r
+ if (this.jlabel != null) {\r
this.jlabel.setForeground(fg);\r
+ }\r
}\r
\r
\r
public void mouseClicked(MouseEvent e) {\r
if ( jcheckbox != null ) {\r
jcheckbox.setSelected( ! jcheckbox.isSelected());\r
+ \r
+ // イベントをチェックボックスに投げる\r
+ ActionEvent ev = new ActionEvent(jcheckbox,ActionEvent.ACTION_PERFORMED,"");\r
+ for ( ActionListener al : jcheckbox.getActionListeners() ) {\r
+ al.actionPerformed(ev);\r
+ }\r
}\r
}\r
};\r
+ \r
}\r