mainjframe.java
来自「Store Manager」· Java 代码 · 共 1,198 行 · 第 1/5 页
JAVA
1,198 行
/* * MainJFrame.java * * Created on 2007年5月18日, 下午6:13 */package com.studio009.store.ui;import com.studio009.store.StoreApp;import com.studio009.store.entity.Operator;import com.studio009.store.ui.util.Calculate;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.text.SimpleDateFormat;import java.util.Calendar;import javax.swing.JOptionPane;import javax.swing.Timer;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import org.jvnet.substance.SubstanceLookAndFeel;import org.jvnet.substance.skin.SubstanceBusinessLookAndFeel;import org.jvnet.substance.theme.SubstanceAquaTheme;import org.jvnet.substance.watermark.SubstanceMazeWatermark;/** * 主窗口 * 用于提供用户操作的平台 * @see LoginJDialog * @author wangs */public class MainJFrame extends javax.swing.JFrame { /** Creates new form MainJFrame * @param operator 操作员 */ public MainJFrame(Operator operator) { initComponents(); // 设置tab的图标icon int count = jTabbedPane1.getTabCount(); for (int i=0; i < count; i++) { jTabbedPane1.setIconAt(i, new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/lefticon" + i + ".png"))); } // 设置对话框居中 this.setLocationRelativeTo(null); // 设置一个定时器,更新状态栏的时间 final SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:MM:ss"); ActionListener timeTimerListener = new ActionListener() { public void actionPerformed(ActionEvent e) { timeLabel.setText(sdf.format(Calendar.getInstance().getTime())); } }; timeTimer = new Timer(1000,timeTimerListener); timeTimer.start(); // 设置窗体最大化 //this.setExtendedState(MAXIMIZED_BOTH); if (operator == null) StoreApp.stopApp(); setOperator(operator); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { toolsPanel = new javax.swing.JPanel(); reloginButton = new javax.swing.JButton(); ordersButton = new javax.swing.JButton(); helpButton = new javax.swing.JButton(); exitButton = new javax.swing.JButton(); calculatetButton = new javax.swing.JButton(); accountButton = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jButton5 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jButton8 = new javax.swing.JButton(); jButton16 = new javax.swing.JButton(); jButton23 = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); jPanel10 = new javax.swing.JPanel(); jButton25 = new javax.swing.JButton(); jButton26 = new javax.swing.JButton(); jButton27 = new javax.swing.JButton(); jButton28 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jButton6 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton17 = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); jButton24 = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jPanel12 = new javax.swing.JPanel(); jButton29 = new javax.swing.JButton(); jButton30 = new javax.swing.JButton(); jButton31 = new javax.swing.JButton(); jButton32 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); jButton14 = new javax.swing.JButton(); jButton22 = new javax.swing.JButton(); jLabel9 = new javax.swing.JLabel(); jPanel13 = new javax.swing.JPanel(); jButton33 = new javax.swing.JButton(); jButton35 = new javax.swing.JButton(); jButton36 = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jButton15 = new javax.swing.JButton(); jPanel5 = new javax.swing.JPanel(); jButton18 = new javax.swing.JButton(); jButton19 = new javax.swing.JButton(); jButton20 = new javax.swing.JButton(); jButton21 = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); jPanel11 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); statePanel = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); operatorLabel = new javax.swing.JLabel(); timeLabel = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("\u5e97\u94fa\u4fe1\u606f\u7ba1\u7406\u7cfb\u7edf"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { formWindowClosed(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); toolsPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); reloginButton.setFont(new java.awt.Font("Dialog", 1, 14)); reloginButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/toolbar.relogin.png"))); // NOI18N java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("com/studio009/store/language"); // NOI18N reloginButton.setText(bundle.getString("Relogin")); // NOI18N reloginButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); reloginButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); reloginButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { reloginButtonActionPerformed(evt); } }); ordersButton.setFont(new java.awt.Font("Dialog", 1, 14)); ordersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/toolbar.orders.png"))); // NOI18N ordersButton.setText(bundle.getString("Orders")); // NOI18N ordersButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); ordersButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); ordersButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ordersButtonActionPerformed(evt); } }); helpButton.setFont(new java.awt.Font("Dialog", 1, 14)); helpButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/toolbar.help.png"))); // NOI18N helpButton.setText("\u83b7\u53d6\u5e2e\u52a9"); helpButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); helpButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); helpButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { helpButtonActionPerformed(evt); } }); exitButton.setFont(new java.awt.Font("Dialog", 1, 14)); exitButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/toolbar.exit.png"))); // NOI18N exitButton.setText("\u9000\u51fa"); exitButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); exitButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); exitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitButtonActionPerformed(evt); } }); calculatetButton.setFont(new java.awt.Font("Dialog", 1, 14)); calculatetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/toolbar.calculate.png"))); // NOI18N calculatetButton.setText("\u8ba1\u7b97\u5668 "); calculatetButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); calculatetButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); calculatetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { calculatetButtonActionPerformed(evt); } }); accountButton.setFont(new java.awt.Font("Dialog", 1, 14)); accountButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/toolbar.account.png"))); // NOI18N accountButton.setText("\u6536\u652f\u67e5\u8be2"); accountButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); accountButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); accountButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { accountButtonActionPerformed(evt); } }); javax.swing.GroupLayout toolsPanelLayout = new javax.swing.GroupLayout(toolsPanel); toolsPanel.setLayout(toolsPanelLayout); toolsPanelLayout.setHorizontalGroup( toolsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(toolsPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(reloginButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ordersButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(calculatetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(accountButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(helpButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(362, Short.MAX_VALUE))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?