java怎么将JTextField的边框设跟字体设置成黑色,如最后的那个图
package counterGui;
import javax.swing.*;
import java.awt.*;
public class counter extends JFrame {
public counter() {
setLayout(null);
setTitle("GUI实验题");
setLocation(200, 200);
setSize(500, 400);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JTextArea textField = new JTextArea("数据转换");
Font x = new Font("Serif", Font.BOLD,20);
textField.setFont(x); //文本加粗跟设置字体大小
textField.setBounds(200, 10, 120, 25);
textField.setOpaque(false); //设置背景透明
textField.setForeground(Color.red); //字体颜色
add(textField);
JTextField outputField = new JTextField(100);
outputField.setBounds(0, 40, 550, 50);
outputField.setText("12345678");
outputField.setEnabled(false);
add(outputField);
JRadioButton button1 = new JRadioButton("2");
JRadioButton button2 = new JRadioButton("8");
JRadioButton button3= new JRadioButton("10");
JRadioButton button4 = new JRadioButton("16");
button1.setBounds(140, 90, 50, 40);
button2.setBounds(200, 90, 50, 40);
button3.setBounds(260, 90, 50, 40);
button4.setBounds(320, 90, 50, 40);
add(button1);
add(button2);
add(button3);
add(button4);
JTextArea textField1 = new JTextArea("转换成==>>");
textField1.setBounds(200, 140, 120, 25);
Font y = new Font("Serif", Font.BOLD,20);
textField1.setFont(y); //文本加粗跟设置字体大小
textField1.setOpaque(false); //设置背景透明
textField1.setForeground(Color.BLUE); //字体颜色
add(textField1);
JTextField outputField1 = new JTextField(100);
outputField1.setBounds(0, 170, 550, 50);
outputField1.setText("75bcd15");
outputField1.setOpaque(false);//设为透明
outputField1.setEnabled(false);
add(outputField1);
JRadioButton button5= new JRadioButton("2");
JRadioButton button6 = new JRadioButton("8");
JRadioButton button7= new JRadioButton("10");
JRadioButton button8 = new JRadioButton("16");
button5.setBounds(140, 220, 50, 40);
button6.setBounds(200, 220, 50, 40);
button7.setBounds(260, 220, 50, 40);
button8.setBounds(320, 220, 50, 40);
add(button5);
add(button6);
add(button7);
add(button8);
final JButton btn1 = new JButton("OK");
final JButton btn2 = new JButton("Exit");
btn1.setBounds(190, 260, 60, 40);
btn2.setBounds(260, 260, 60, 40);
add(btn1);
add(btn2);
setVisible(true);
}
public static void main(String[] args) {
new counter();
}
}