- TextField.selectionBackground : テキストフィールド選択時の背景色
- TextField.selectionForeground : テキストフィールド選択時の文字色
サンプルコード
import java.awt.* import javax.swing.* import groovy.swing.* // テキストフィールドのデフォルトの選択色を設定する UIManager.put("TextField.selectionBackground", new Color(0xcc, 0xdd, 0xff)) UIManager.put("TextField.selectionForeground", new Color(0xff, 0xff, 0x88)) sb = new SwingBuilder() sb.edt { frame( title: "example - selection colors for Textfield", show: true, resizable: true, pack: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ textField(id:"tf1", text:"example textfield1", constraints: BorderLayout.NORTH ) textField(id:"tf2", text:"example textfield2", constraints: BorderLayout.CENTER ) tf1.selectAll() } }実行時画面

動作環境
groovy 2.2.2, JDK 1.7 update55
0 件のコメント:
コメントを投稿