尝试一切,只是没有出现:
package me.ultimate.ST;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
public class ST extends JFrame {
private static final long serialVersionUID = 1L;
public ST() {
setSize(500, 600);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setUndecorated(true);
getContentPane().setBackground(Color.BLACK);
JLabel label = new JLabel("Test");
label.setText("Some Test!");
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
ST ex = new ST();
ex.setVisible(true);
}
});
}
}
然后我得到一个黑匣子。