0

ではなくTextArea にしたい。画面全体が黒く白い文字が表示されるフルスクリーンを作成したいと思います。WindowTextArea

どうすればこれを達成できますか?

4

2 に答える 2

3

これを試して..

JTextArea txt = new JTextArea();
txt.setBackground(Color.BLACK);
txt.setForeground(Color.WHITE);
于 2012-07-22T17:21:35.177 に答える
1

スイングコンポーネント用

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 コンポーネントが階層のある場所でこれらのクラスを拡張するためです。JComponentComponent

于 2012-07-22T17:24:03.910 に答える