妈的,JLabel竟然设置不起来背景颜色
asert 2006-07-06 03:06:49 import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
public class TestLink {
public TestLink() {
JFrame frame = new JFrame("Test MyLabel");
JPanel pane = new JPanel();
JLabel link = new JLabel("test");
link.setBackground(Color.BLUE);
pane.add(link);
frame.getContentPane().add(pane);
frame.setSize(300, 200);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE );
}
public static void main(String[] str) {
new TestLink();
}
}
谁来帮我看看这是怎么回事?