我想更改此 JTextField 的格式,尤其是字体大小和颜色。
这是代码:
JTextField textField = new JTextField(10);
JTextArea msgArea = new JTextArea(10, 30);
最佳答案
您可以通过设置 Font
来更改颜色颜色。
Font f = new Font("Arial", Font.BOLD, 15);
textField.setFont(f);
textField.setForeground(Color.RED);
msgArea.setFont(f);
msgArea.setForeground(Color.BLUE);
关于java - 更改 JTextField 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17008512/