Reputation: 33
I want to make my TextArea
black instead of white. I wish to make the Window
fullscreen where the whole screen would be the TextArea
that's black and would have white letters.
How can I achieve this?
Upvotes: 0
Views: 981
Reputation: 2339
For swing components
JTextArea txt = new JTextArea();
//Set background black
txt.setBackground(Color.BLACK);
//Set Foreground(text) white
txt.setForeground(Color.WHITE);
Same goes for the awt components
TextArea txt = new TextArea();
//Set background black
txt.setBackground(Color.BLACK);
//Set Foreground(text) white
txt.setForeground(Color.WHITE);
The setForeground
and setBackground
methods belong to the JComponent
/Component
class and hence accessible to every component, as all the Swing/AWT component, at some place up the hierarchy, will extend these classes.
Upvotes: 1
Reputation: 33534
Try this..
JTextArea txt = new JTextArea();
txt.setBackground(Color.BLACK);
txt.setForeground(Color.WHITE);
Upvotes: 3