?? pmainmenu.java
字號:
package com.aptech.cdjj.sex.gui;
/**
* <p>Title: 人員信息界面</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0*/
import javax.swing.*;
import java.awt.BorderLayout;
import javax.swing.Box;
import java.awt.Rectangle;
import java.awt.Component;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.util.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.GridLayout;
import com.borland.jbcl.layout.PaneLayout;
import com.borland.jbcl.layout.*;
import java.awt.LayoutManager;
import java.awt.Container;
import java.awt.CardLayout;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyBoundsAdapter;
import com.aptech.cdjj.sex.action.SPerControl;
import com.aptech.cdjj.sex.action.SPerTitle;
import java.util.Vector;
import java.sql.SQLException;
import java.util.ArrayList;
import java.sql.*;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.border.TitledBorder;
import com.aptech.cdjj.sex.database.SDBManager;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.border.Border;
public class PMainMenu extends JFrame implements Runnable{
PMainMenu(){
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
jbInit1();
} catch (Exception ex) {
ex.printStackTrace();
}
this.setTitle("珠寶管理系統1.0");
this.setSize(850,700);
jTable2.getTableHeader().setReorderingAllowed(false);
jTable2.getTableHeader().setResizingAllowed(false);
this.setExtendedState(this.MAXIMIZED_BOTH);
this.setVisible(true);
}
public static void main(String[] args) {
PMainMenu psmainnenu = new PMainMenu();
Thread thr = new Thread(psmainnenu);
thr.start();
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);//容器類情況
jPanel1.setLayout(null);
jPanel2.setBorder(BorderFactory.createEtchedBorder());
jPanel2.setBounds(new Rectangle(0, 655, 1024, 34));
jPanel2.setLayout(gridLayout2);
jSplitPane1.setOneTouchExpandable(true);
jSplitPane1.setBounds(new Rectangle(0, 27, 1025, 627));
jSplitPane1.setDividerLocation(150);
jSplitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
jSplitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
jSplitPane2.setDividerLocation(230);
jSplitPane2.setOneTouchExpandable(true);
jPanel7.setBorder(BorderFactory.createTitledBorder(BorderFactory.
createLineBorder(Color.black, 1),
"人員信息表", TitledBorder.LEFT, TitledBorder.TOP));
jPanel7.setBounds(new Rectangle(18, 13, 822, 592));
jPanel7.setLayout(null);
ImageIcon image=new ImageIcon("/Jewelry/desktop/20050118xy001_("+num+").jpg");
jPanel4.setBorder(BorderFactory.createEtchedBorder());
jPanel4.setBounds(new Rectangle( -1, 0, 1026, 27));
jPanel4.setLayout(gridLayout1);
jButton1.setBackground(Color.lightGray);
jButton1.setText("庫存信息");
jButton1.addActionListener(new PMainMenu_jButton1_actionAdapter(this));
jButton2.setBackground(Color.lightGray);
jButton2.setText("銷售信息");
jButton2.addActionListener(new PMainMenu_jButton2_actionAdapter(this));
jButton3.setBackground(Color.lightGray);
jButton3.setText("人員信息");
jButton4.setBackground(Color.lightGray);
jButton4.setText("客戶信息");
jButton4.addActionListener(new PMainMenu_jButton4_actionAdapter(this));
jButton4.addMouseListener(new PMainMenu_jButton4_mouseAdapter(this));
jButton5.setBackground(Color.lightGray);
jButton5.setText("基礎信息");
jButton5.addActionListener(new PMainMenu_jButton5_actionAdapter(this));
jButton6.setBackground(Color.lightGray);
jButton6.setText("返回");
jButton6.addActionListener(new PMainMenu_jButton6_actionAdapter(this));
jMenuItem17.setText("客戶信息");
jMenuItem17.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK));
jMenuItem17.addActionListener(new PMainMenu_jMenuItem17_actionAdapter(this));
jMenu2.setText("珠寶品種(V)");
jMenu2.setMnemonic('V');
jMenuItem6.setText("人員查詢");
jMenuItem6.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y,InputEvent.CTRL_MASK));
jMenuItem6.addActionListener(new PMainMenu_jMenuItem6_actionAdapter(this));
jMenu8.setText("寶石(B)");
jMenu8.setIcon(new ImageIcon("/Jewelry/pic/CR.JPG"));
jMenu8.setMnemonic('B');
jMenuItem4.setText("鉆石");
jMenuItem4.setIcon(new ImageIcon("/Jewelry/pic/YDL.JPG"));
jMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,InputEvent.CTRL_MASK));
jMenuItem9.setText("翡翠");
jMenuItem9.setIcon(new ImageIcon("/Jewelry/pic/MB.JPG"));
jMenuItem9.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F,InputEvent.CTRL_MASK));
jMenuItem10.setText("瑪瑙");
jMenuItem10.setIcon(new ImageIcon("/Jewelry/pic/SGSS.JPG"));
jMenuItem12.setText("珍珠");
jMenuItem12.setIcon(new ImageIcon("/Jewelry/pic/HB.JPG"));
jMenuItem18.setText("紅寶石");
jMenuItem18.setIcon(new ImageIcon("/Jewelry/pic/CR.JPG"));
jMenuItem18.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H,InputEvent.CTRL_MASK));
jMenuItem19.setText("藍寶石");
jMenuItem19.setIcon(new ImageIcon("/Jewelry/pic/MDL.jpg"));
jMenu9.setText("金銀(C)");
jMenu9.setIcon(new ImageIcon("/Jewelry/pic/QR.JPG"));
jMenu9.setMnemonic('C');
jMenuItem5.setText("鉑金");
jMenuItem5.setIcon(new ImageIcon("/Jewelry/pic/RXL.JPG"));
jMenuItem20.setText("18K金");
jMenuItem20.setIcon(new ImageIcon("/Jewelry/pic/GC.JPG"));
jMenuItem14.setText("黃金");
jMenuItem14.setIcon(new ImageIcon("/Jewelry/pic/BBS.JPG"));
jMenuItem21.setText("白銀");
jMenuItem21.setIcon(new ImageIcon("/Jewelry/pic/HB.JPG"));
jPanel3.setLayout(null);
jScrollPane2.setHorizontalScrollBarPolicy(JScrollPane.
HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane2.setVerticalScrollBarPolicy(JScrollPane.
VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane2.setBounds(new Rectangle(18, 25, 783, 278));
jTabbedPane1.setBackground(Color.lightGray);
jTabbedPane1.setBounds(new Rectangle(14, 341, 787, 242));
jPanel5.setLayout(null);
jLabel2.setText("1.編號:");
jLabel2.setBounds(new Rectangle(37, 46, 55, 19));
jLabel3.setText("2.姓名:");
jLabel3.setBounds(new Rectangle(262, 50, 59, 15));
jLabel4.setText("3.狀態:");
jLabel4.setBounds(new Rectangle(516, 50, 53, 15));
jLabel5.setText("4.性別:");
jLabel5.setBounds(new Rectangle(37, 96, 56, 15));
jLabel6.setText("5.年齡:");
jLabel6.setBounds(new Rectangle(262, 95, 54, 15));
jLabel7.setText("6.地址:");
jLabel7.setBounds(new Rectangle(517, 96, 57, 15));
jLabel8.setText("7.日期:");
jLabel8.setBounds(new Rectangle(38, 136, 59, 15));
jLabel9.setText("8.職務:");
jLabel9.setBounds(new Rectangle(263, 136, 58, 15));
jLabel10.setText("9.電話:");
jLabel10.setBounds(new Rectangle(516, 136, 61, 15));
txtAge.setBackground(Color.lightGray);
txtAge.setBorder(border1);
txtAge.setBounds(new Rectangle(350, 91, 95, 20));
txtAdd.setBackground(Color.lightGray);
txtAdd.setBorder(border1);
txtAdd.setBounds(new Rectangle(606, 91, 95, 20));
txtPhone.setBackground(Color.lightGray);
txtPhone.setBorder(border1);
txtPhone.setBounds(new Rectangle(606, 131, 95, 20));
txtSex.setBackground(Color.lightGray);
txtSex.setBorder(border1);
txtSex.setBounds(new Rectangle(98, 91, 95, 20));
txtDate.setBackground(Color.cyan);
txtDate.setEnabled(false);
txtDate.setBorder(BorderFactory.createRaisedBevelBorder());
txtDate.setDisabledTextColor(Color.blue);
txtDate.setBounds(new Rectangle(98, 131, 95, 20));
txtId.setBackground(Color.cyan);
txtId.setEnabled(false);
txtId.setBorder(BorderFactory.createRaisedBevelBorder());
txtId.setDisabledTextColor(Color.blue);
txtId.setBounds(new Rectangle(98, 45, 95, 20));
txtName.setBackground(Color.lightGray);
txtName.setBorder(border1);
txtName.setBounds(new Rectangle(350, 48, 95, 20));
jButton8.setBounds(new Rectangle(250, 181, 105, 23));
jButton8.setBorder(BorderFactory.createLineBorder(Color.black));
jButton8.setText("提交");
jButton8.addActionListener(new PMainMenu_jButton8_actionAdapter(this));
jButton10.setBounds(new Rectangle(433, 181, 100, 23));
jButton10.setBorder(BorderFactory.createLineBorder(Color.black));
jButton10.setText("增加人員登記單");
jButton10.addActionListener(new PMainMenu_jButton10_actionAdapter(this));
jPanel6.setLayout(null);
jLabel11.setText("請選擇(刪除 / 查詢)的條件");
jLabel11.setBounds(new Rectangle(39, 76, 196, 29));
jLabel12.setText("請輸入該條件的文本值");
jLabel12.setBounds(new Rectangle(439, 81, 156, 23));
jLabel13.setToolTipText("");
jLabel13.setText("根據提示請選擇");
jLabel13.setBounds(new Rectangle(363, 18, 106, 25));
jComboBox1.setBounds(new Rectangle(268, 80, 114, 24));
jComboBox1.addActionListener(new PMainMenu_jComboBox1_actionAdapter(this));
jComboBox1.addMouseListener(new PMainMenu_jComboBox1_mouseAdapter(this));
this.jComboBox1.addItem("編號");
this.jComboBox1.addItem("姓名");
this.jComboBox1.addItem("性別");
this.jComboBox1.addItem("年齡");
this.jComboBox1.addItem("地址");
this.jComboBox1.addItem("職務");
this.jComboBox1.addItem("電話");
this.jComboBox1.addItem("查詢所有");
txtTiao.setBounds(new Rectangle(601, 76, 110, 28));
jButton11.setBounds(new Rectangle(107, 155, 145, 44));
jButton11.setBorder(BorderFactory.createLineBorder(Color.black));
jButton11.setText("刪除");
jButton11.addActionListener(new PMainMenu_jButton11_actionAdapter(this));
jButton12.setBounds(new Rectangle(325, 155, 145, 44));
jButton12.setBorder(BorderFactory.createLineBorder(Color.black));
jButton12.setText("查詢");
jButton12.addActionListener(new PMainMenu_jButton12_actionAdapter(this));
jButton13.setBounds(new Rectangle(539, 155, 145, 44));
jButton13.setBorder(BorderFactory.createLineBorder(Color.black));
jButton13.setText("取消");
jButton13.addActionListener(new PMainMenu_jButton13_actionAdapter(this));
jLabel14.setText("請選擇填寫方式");
jLabel14.setBounds(new Rectangle(249, 8, 100, 23));
jComboBox2.setBounds(new Rectangle(351, 9, 95, 23));
jComboBox2.addActionListener(new PMainMenu_jComboBox2_actionAdapter(this));
jComboBox2.addMouseListener(new PMainMenu_jComboBox2_mouseAdapter(this));
this.jComboBox2.addItem("--請選擇--");
this.jComboBox2.addItem("增加");
this.jComboBox2.addItem("修改");
jTable2.addMouseListener(new PMainMenu_jTable2_mouseAdapter(this));
jComboBox3.setBackground(Color.lightGray);
jComboBox3.setBorder(border1);
jComboBox3.setBounds(new Rectangle(607, 48, 94, 23));
jComboBox4.setBackground(Color.lightGray);
jComboBox4.setBorder(border1);
jComboBox4.setBounds(new Rectangle(350, 128, 95, 23));
ArrayList temp = sp.selectOne("select steps from step");
for (int i = 0; i < temp.size(); i++) {
jComboBox4.addItem(temp.get(i));
}
ArrayList temp2 = sp.selectOne("select states from state");
for (int i = 0; i < temp2.size(); i++) {
jComboBox3.addItem(temp2.get(i));
}
jTree1.addMouseListener(new PMainMenu_jTree1_mouseAdapter(this));
jPanel1.setBounds(new Rectangle(2, 1, 1028, 747));
jPanel3.setBackground(Color.gray);
jPanel5.setBackground(Color.lightGray);
jPanel5.setBorder(BorderFactory.createLoweredBevelBorder());
jPanel6.setBackground(Color.lightGray);
jPanel6.setBorder(BorderFactory.createLoweredBevelBorder());
jTextField1.setBackground(Color.gray);
jTextField1.setEnabled(false);
jTextField1.setText("Aptech成都錦江培訓中心(S1T013--SEX小組)");
jTextField2.setBackground(Color.gray);
jTextField2.setEnabled(false);
jTextField2.setText("操作員: " + SLoginMenu.name + " (" + SLoginMenu.step + ")");
jTextField3.setBackground(Color.gray);
jTextField3.setEnabled(false);
jMenuItem15.addActionListener(new PMainMenu_jMenuItem15_actionAdapter(this));
jMenuItem16.addActionListener(new PMainMenu_jMenuItem16_actionAdapter(this));
jMenuItem22.setText("銷售分析比列圖");
jMenuItem22.addActionListener(new PMainMenu_jMenuItem22_actionAdapter(this));
jMenuItem8.addActionListener(new PMainMenu_jMenuItem8_actionAdapter(this));
jTree2.addMouseListener(new PMainMenu_jTree2_mouseAdapter(this));
jMenuItem1.addActionListener(new PMainMenu_jMenuItem1_actionAdapter(this));
jMenuItem2.addActionListener(new PMainMenu_jMenuItem2_actionAdapter(this));
jMenuItem3.addActionListener(new PMainMenu_jMenuItem3_actionAdapter(this));
jMenuItem7.addActionListener(new PMainMenu_jMenuItem7_actionAdapter(this));
jMenuItem11.addActionListener(new PMainMenu_jMenuItem11_actionAdapter(this));
jMenuItem13.addActionListener(new PMainMenu_jMenuItem13_actionAdapter(this));
txtnote.setBackground(new Color(125, 0, 0));
txtnote.setEnabled(false);
txtnote.setBorder(BorderFactory.createRaisedBevelBorder());
txtnote.setDisabledTextColor(Color.yellow);
txtnote.setBounds(new Rectangle(18, 311, 783, 24));
jPanel1.add(jPanel4, null);
this.setJMenuBar(jMenuBar1); //菜單欄情況
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -