继承了JFrame为什么还出错
importjava.awt.*;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener...
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class MyThread extends JFrame{
public static void main(String[] args){
Container contentPane = getContentPane();
Icon icon = new ImageIcon("icons\\direct.jpg");
JLabel label = new JLabel(icon,JLabel.CENTER);
contentPane.add(label);
show();
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
} 展开
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class MyThread extends JFrame{
public static void main(String[] args){
Container contentPane = getContentPane();
Icon icon = new ImageIcon("icons\\direct.jpg");
JLabel label = new JLabel(icon,JLabel.CENTER);
contentPane.add(label);
show();
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
} 展开
1个回答
天仁密销
2023-07-11 广告
2023-07-11 广告
深圳市永旺利科技有限公司是一个专业的文件销毁服务公司,具有10余年的历史,拥有先进的销毁设备,能保证文件和资料的安全销毁。该公司可以提供规范的文件销毁流程,包括接受出具移交清单、销毁完毕出具销毁报告等。此外,他们还提供现场拍照监控、视频监控...
点击进入详情页
本回答由天仁密销提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询