📄 mainframe.java
字号:
package com.lzw;
import java.awt.*;
import java.util.Date;
import javax.swing.*;
import javax.swing.border.BevelBorder;
import com.lzw.login.LoginDialog;
public class MainFrame extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel frameContentPane = null;
private MenuBar frameMenuBar = null;
private ToolBar toolBar = null;
private DesktopPanel desktopPane = null;
private JPanel statePanel = null;
private JLabel stateLabel = null;
private JLabel nameLabel = null;
private JLabel nowDateLabel = null;
private JSeparator jSeparator1 = null;
private static JLabel czyStateLabel = null;
private JSeparator jSeparator2 = null;
/**
* This method initializes jJToolBarBar
*
* @return javax.swing.JToolBar
*/
private ToolBar getJJToolBarBar() {
if (toolBar == null) {
toolBar = new ToolBar(getFrameMenuBar());
toolBar.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
return toolBar;
}
/**
* 初始化窗体菜单栏的方法
*
* @return javax.swing.JMenuBar
*/
protected MenuBar getFrameMenuBar() {
if (frameMenuBar == null) {
frameMenuBar = new MenuBar(getDesktopPane(), getStateLabel());
}
return frameMenuBar;
}
/**
* This method initializes desktopPane
*
* @return javax.swing.JDesktopPane
*/
private DesktopPanel getDesktopPane() {
if (desktopPane == null) {
desktopPane = new DesktopPanel();
}
return desktopPane;
}
/**
* This method initializes statePanel
*
* @return javax.swing.JPanel
*/
private JPanel getStatePanel() {
if (statePanel == null) {
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.gridx = 2;
gridBagConstraints6.fill = GridBagConstraints.VERTICAL;
gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
gridBagConstraints6.gridy = 0;
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 3;
gridBagConstraints4.gridy = 0;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.gridx = 6;
gridBagConstraints3.fill = GridBagConstraints.VERTICAL;
gridBagConstraints3.insets = new Insets(0, 5, 0, 5);
gridBagConstraints3.gridy = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 5;
gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
gridBagConstraints11.gridy = 0;
nowDateLabel = new JLabel();
Date now = new Date();
nowDateLabel.setText(String.format("%tF", now));
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 7;
gridBagConstraints2.weightx = 0.0;
gridBagConstraints2.fill = GridBagConstraints.NONE;
gridBagConstraints2.gridy = 0;
nameLabel = new JLabel("吉林省铭泰××有限公司 ");
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 4;
gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
gridBagConstraints1.weighty = 1.0;
gridBagConstraints1.insets = new Insets(0, 5, 0, 5);
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.gridy = 0;
statePanel = new JPanel();
statePanel.setLayout(new GridBagLayout());
statePanel.setBorder(BorderFactory
.createBevelBorder(BevelBorder.RAISED));
statePanel.add(getStateLabel(), gridBagConstraints);
statePanel.add(getJSeparator(), gridBagConstraints1);
statePanel.add(nameLabel, gridBagConstraints2);
statePanel.add(getJSeparator1(), gridBagConstraints3);
statePanel.add(nowDateLabel, gridBagConstraints11);
statePanel.add(getCzyStateLabel(), gridBagConstraints4);
statePanel.add(getJSeparator2(), gridBagConstraints6);
}
return statePanel;
}
public static JLabel getCzyStateLabel() {
if (czyStateLabel == null) {
czyStateLabel = new JLabel("操作员:");
}
return czyStateLabel;
}
public JLabel getStateLabel() {
if (stateLabel == null) {
stateLabel = new JLabel();
stateLabel.setText("当前没有选定窗体");
}
return stateLabel;
}
/**
* This method initializes jSeparator
*
* @return javax.swing.JSeparator
*/
private JSeparator getJSeparator() {
JSeparator jSeparator = new JSeparator();
jSeparator.setOrientation(JSeparator.VERTICAL);
return jSeparator;
}
/**
* This method initializes jSeparator1
*
* @return javax.swing.JSeparator
*/
private JSeparator getJSeparator1() {
if (jSeparator1 == null) {
jSeparator1 = new JSeparator();
jSeparator1.setOrientation(SwingConstants.VERTICAL);
}
return jSeparator1;
}
/**
* This method initializes jSeparator2
*
* @return javax.swing.JSeparator
*/
private JSeparator getJSeparator2() {
if (jSeparator2 == null) {
jSeparator2 = new JSeparator();
jSeparator2.setOrientation(SwingConstants.VERTICAL);
}
return jSeparator2;
}
/**
* @param args
*/
public static void main(String[] args) {
SplashScreen splashScreen = SplashScreen.getSplashScreen();
if(splashScreen!=null){
try {
JFrame login = new LoginDialog();
login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Thread.sleep(3000);
login.setVisible(true);
} catch (InterruptedException e) {}
}
}
/**
* This is the default constructor
*/
public MainFrame() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(800, 600);
this.setJMenuBar(getFrameMenuBar());
this.setContentPane(getFrameContentPane());
this.setTitle("铭泰企业进销存管理系统");
}
/**
* This method initializes frameContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getFrameContentPane() {
if (frameContentPane == null) {
frameContentPane = new JPanel();
frameContentPane.setLayout(new BorderLayout());
frameContentPane.add(getStatePanel(), BorderLayout.SOUTH);
frameContentPane.add(getJJToolBarBar(), BorderLayout.NORTH);
frameContentPane.add(getDesktopPane(), BorderLayout.CENTER);
}
return frameContentPane;
}
} // @jve:decl-index=0:visual-constraint="6,-5"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -