白ではなくTextArea
黒にしたい。画面全体が黒く、白い文字が表示されるフルスクリーンを作成したいと思います。Window
TextArea
どうすればこれを達成できますか?
これを試して..
JTextArea txt = new JTextArea();
txt.setBackground(Color.BLACK);
txt.setForeground(Color.WHITE);
スイングコンポーネント用
JTextArea txt = new JTextArea();
//Set background black
txt.setBackground(Color.BLACK);
//Set Foreground(text) white
txt.setForeground(Color.WHITE);
同じことがawtコンポーネントにも当てはまります
TextArea txt = new TextArea();
//Set background black
txt.setBackground(Color.BLACK);
//Set Foreground(text) white
txt.setForeground(Color.WHITE);
setForeground
およびメソッドは/クラスsetBackground
に属しているため、すべてのコンポーネントからアクセスできます。これは、すべての Swing/AWT コンポーネントが階層のある場所でこれらのクラスを拡張するためです。JComponent
Component