mainjframe.java.netbeans-base
来自「Store Manager」· NETBEANS-BASE 代码 · 共 1,164 行 · 第 1/4 页
NETBEANS-BASE
1,164 行
/* * 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(); this.operator = operator; // 设置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(); } /** 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(); 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(); jPanel4 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); 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(); 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(); jPanel6 = new javax.swing.JPanel(); jProgressBar1 = new javax.swing.JProgressBar(); 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(337, Short.MAX_VALUE)) ); toolsPanelLayout.setVerticalGroup( toolsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(toolsPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(toolsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(reloginButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ordersButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(calculatetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(accountButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(helpButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT); jTabbedPane1.setFont(new java.awt.Font("Dialog", 1, 18)); jButton5.setFont(new java.awt.Font("Dialog", 1, 24)); jButton5.setText("\u91c7\u8d2d\u8fdb\u8d27"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jButton11.setFont(new java.awt.Font("Dialog", 1, 24)); jButton11.setText("\u91c7\u8d2d\u9000\u8d27"); jButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton11ActionPerformed(evt); } }); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/studio009/store/ui/resources/store.png"))); // NOI18N jLabel2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel2MouseClicked(evt); } }); jButton8.setFont(new java.awt.Font("Dialog", 1, 24)); jButton8.setText("\u8fdb\u8d27\u5355\u67e5\u8be2"); jButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton8ActionPerformed(evt); } }); jButton16.setFont(new java.awt.Font("Dialog", 1, 24)); jButton16.setText("\u8fdb\u8d27\u660e\u7ec6\u67e5\u8be2"); jButton16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton16ActionPerformed(evt); } }); jButton23.setFont(new java.awt.Font("Dialog", 1, 24)); jButton23.setText("\u5f53\u524d\u4ed3\u5e93\u67e5\u8be2"); jButton23.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?