📄 shopingmanagerapplication.java
字号:
package shopingmanager;
import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;
import javax.swing.JButton;
public class ShopingManagerApplication {
boolean packFrame = false;
/**
* Construct and show the application.
*/
public ShopingManagerApplication() {
ShopingManagerFrame frame = new ShopingManagerFrame();
// Validate frames that have preset sizes
// Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
} else {
frame.validate();
}
// Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
public ShopingManagerApplication(String s)
{
ShopingManagerFrame frame = new ShopingManagerFrame();
frame.btnWarehouseManage.setEnabled(false);
frame.btnPersonnelManage.setEnabled(false);
if(s.equals("1"))
{
frame.btnWarehouseManage.setEnabled(true);
}
if(s.equals("2"))
{
frame.btnPersonnelManage.setEnabled(true);
}
if (packFrame) {
frame.pack();
} else {
frame.validate();
}
// Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
/**
* Application entry point.
*
* @param args String[]
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
//UIManager.setLookAndFeel(UIManager.
//getSystemLookAndFeelClassName());
} catch (Exception exception) {
exception.printStackTrace();
}
ShopingManagerFrame dia=new ShopingManagerFrame();
dia.setBounds(300,200,800,600);
dia.setVisible(true);
// new ShopingManagerApplication();
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -