62,614
社区成员
发帖
与我相关
我的任务
分享
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class WarningFrame extends JFrame{
JLabel label = new JLabel();
JPanel contentPane = (JPanel) getContentPane();
public static void main(String[] args){
WarningFrame f = new WarningFrame("loading....");
}
public WarningFrame(String warning){
this.setTitle("-_-");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.setSize(188,100);
this.setLocation(500,0);
label.setText(warning);
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
contentPane.add(label);
contentPane.setVisible(true);
this.toFront();
this.setVisible(true);
}
}
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class WarningFrame {
public static void main(String[] args) {
WarningFrames frame = new WarningFrames();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
class WarningFrames extends JFrame {
public WarningFrames() {
setTitle("Warning");
setSize(300, 200);
JPanel contentPanel = new JPanel();
JLabel label = new JLabel("Loading...");
contentPanel.add(label);
add(contentPanel);
}
}
contentPane.setLayout(new FlowLayout());