代码优化
This commit is contained in:
@@ -7,23 +7,28 @@ import java.awt.event.WindowEvent;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
/**
|
||||
* 父类
|
||||
*/
|
||||
public class BaseForm extends JFrame {
|
||||
|
||||
private static final long serialVersionUID = -8446051052250946428L;
|
||||
private static final long serialVersionUID = -8446051052250946428L;
|
||||
|
||||
public BaseForm() {
|
||||
getContentPane().setLayout(null);
|
||||
getContentPane().setBackground(new Color(248, 251, 253));
|
||||
this.addWindowListener(new WindowAdapter() {
|
||||
public BaseForm() {
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
super.windowClosing(e);
|
||||
}
|
||||
});
|
||||
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/logo.png"));
|
||||
getContentPane().setLayout(null);
|
||||
getContentPane().setBackground(new Color(248, 251, 253));
|
||||
this.addWindowListener(new WindowAdapter() {
|
||||
|
||||
this.setIconImage(imageIcon.getImage());
|
||||
}
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
|
||||
System.exit(0);
|
||||
super.windowClosing(e);
|
||||
}
|
||||
});
|
||||
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/logo.png"));
|
||||
|
||||
this.setIconImage(imageIcon.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user