Swing/ButtonPainted のバックアップ差分(No.1)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/ButtonPainted へ行く。
- 1 (2010-12-13 (月) 00:08:28)
- 2 (2011-04-27 (水) 19:19:50)
- 3 (2011-12-16 (金) 15:04:52)
- 4 (2013-01-06 (日) 21:37:52)
- 5 (2014-11-17 (月) 18:56:58)
- 6 (2015-01-27 (火) 17:02:35)
- 7 (2015-03-09 (月) 14:46:02)
- 8 (2015-03-16 (月) 17:52:38)
- 9 (2017-02-10 (金) 15:05:57)
- 10 (2017-12-24 (日) 15:11:51)
- 11 (2019-12-08 (日) 15:33:05)
- 12 (2021-06-09 (水) 18:10:54)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:JButtonの描画 #navi(../) RIGHT:Posted by [[terai]] at 2009-08-24 *JButtonの描画 [#b1486d31] JButtonの状態描画をテストします。 -&jnlp; -&jar; -&zip; #screenshot **サンプルコード [#l599c4e7] #code{{ java.util.List<JCheckBox> clist = Arrays.asList( new JCheckBox(new AbstractAction("setFocusPainted") { public void actionPerformed(ActionEvent e) { boolean flg = ((JCheckBox)e.getSource()).isSelected(); for(JButton b:list) b.setFocusPainted(flg); p.revalidate(); } }), new JCheckBox(new AbstractAction("setBorderPainted") { public void actionPerformed(ActionEvent e) { boolean flg = ((JCheckBox)e.getSource()).isSelected(); for(JButton b:list) b.setBorderPainted(flg); p.revalidate(); } }), new JCheckBox(new AbstractAction("setContentAreaFilled") { public void actionPerformed(ActionEvent e) { boolean flg = ((JCheckBox)e.getSource()).isSelected(); for(JButton b:list) b.setContentAreaFilled(flg); p.revalidate(); } }), new JCheckBox(new AbstractAction("setRolloverEnabled") { public void actionPerformed(ActionEvent e) { boolean flg = ((JCheckBox)e.getSource()).isSelected(); for(JButton b:list) b.setRolloverEnabled(flg); p.revalidate(); } }) ); }} **解説 [#ua38e7ee] 上記のサンプルでは、JButtonの状態(たとえばフォーカスの有無を描画するか?など)をテストします。これらはLook & Feelによって効果が異なる場合があるようです。 - [http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/AbstractButton.html#setFocusPainted(boolean) setFocusPainted] - [http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/AbstractButton.html#setBorderPainted(boolean) setBorderPainted] - [http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/AbstractButton.html#setContentAreaFilled(boolean) setContentAreaFilled] - [http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/AbstractButton.html#setRolloverEnabled(boolean) setRolloverEnabled] //**参考リンク **コメント [#u75fef0a] #comment