?? jiemian.java
字號:
package MyLibraryok.readers;
import java.awt.*;
import java.util.ArrayList;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import MyLibraryok.MyMain.MainFrame2;
import javax.swing.JComboBox;
import MyLibraryok.books.untitled1.TushuManageListener1;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Jiemian extends JDialog{
Dimension screen = getToolkit().getScreenSize(); //得到屏幕尺寸
int myWidth = screen.width;
int myHeight = screen.height;
int x =630,y = 380;
public Jiemian(MainFrame2 ss) {
super(ss,"",true);
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
///////////聲明四個面板
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
//////////聲明十個標簽
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
/////////聲明兩個選擇框
//JComboBox jChoice1 = new JComboBox();
Choice jChoice1 = new Choice();
// JComboBox jChoice2= new JComboBox();
Choice jChoice2 = new Choice();
/////////聲明九個按鈕
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
JButton jButton7 = new JButton();
JButton jButton8 = new JButton();
JButton jButton9 = new JButton();
//////////聲明八個文本框
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JTextField jTextField3 = new JTextField();
JTextField jTextField4 = new JTextField();
JTextField jTextField5 = new JTextField(18);
JTextField jTextField6 = new JTextField();
JTextField jTextField7 = new JTextField();
JTextField jTextField8 = new JTextField();
//////////聲明
ArrayList arraylist = new ArrayList();
String title[] = {"讀者編號", "借書證條形碼", "姓名", "性別", "聯系電話", "證件類型", "證件號碼",
"所在班級"};
JTableModle jtablemodle = new JTableModle(arraylist, title); //////////////模型
JTable jTable = new JTable(jtablemodle);
JScrollPane jScrollPane1 = new JScrollPane(jTable);
private void jbInit() throws Exception {
getContentPane().setLayout(null);
JTabbedPane jTabbedPane1 = new JTabbedPane();
jTabbedPane1.setFont(new java.awt.Font("Dialog", Font.BOLD, 15));
jTabbedPane1.setBounds(new Rectangle(18, 20, 580, 300));
jPanel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 11));
jPanel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 11));
jPanel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 11));
jChoice1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
jChoice2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
// jChoice1.setEditable(true);
// jChoice2.setEditable(true);
jTextField1.setNextFocusableComponent(jTextField3);
this.getContentPane().add(jTabbedPane1);
jTabbedPane1.add(jPanel1, "<html>添加<br>修改</html>");
jPanel1.setLayout(null);
jTabbedPane1.add(jPanel2, "<html>查詢<br>刪除</html>");
jPanel2.setLayout(null);
jTabbedPane1.setTabPlacement(jTabbedPane1.LEFT);
jPanel3.setBorder(BorderFactory.createLoweredBevelBorder());
jPanel3.setBounds(new Rectangle(5, 12, 505, 270));
jPanel3.setLayout(null);
jPanel4.setBorder(BorderFactory.createLoweredBevelBorder());
jPanel4.setBounds(new Rectangle(5, 12, 505, 270));
jPanel4.setLayout(null);
TitledBorder titledBorder1 = new TitledBorder("");
jPanel1.add(jPanel3);
jPanel2.add(jPanel4);
//================10個標簽======================================================
//*************第三個面板上的標簽**********************
jLabel1.setText("借書證條形碼:");
jLabel1.setBounds(20, 20, 80, 25);
jPanel3.add(jLabel1);
jLabel2.setText("讀者編號:");
jLabel2.setBounds(290, 20, 80, 25);
jPanel3.add(jLabel2);
jLabel3.setText("姓 名:");
jLabel3.setBounds(20, 60, 80, 25);
jPanel3.add(jLabel3);
jLabel4.setText("性 別:");
jLabel4.setBounds(290, 60, 80, 25);
jPanel3.add(jLabel4);
jLabel5.setText("所在班級:");
jLabel5.setBounds(new Rectangle(20, 100, 80, 25));
jPanel3.add(jLabel5);
jLabel6.setText("證件類型:");
jLabel6.setBounds(290, 100, 80, 25);
jPanel3.add(jLabel6);
jLabel7.setText("證件號碼:");
jLabel7.setBounds(20, 140, 80, 25);
jPanel3.add(jLabel7);
jLabel8.setText("聯系電話:");
jLabel8.setBounds(20, 180, 80, 30);
jPanel3.add(jLabel8);
//*************第四個面板上的標簽**************************
jLabel9.setText("讀者編號:");
jLabel9.setBounds(new Rectangle(20, 20, 80, 25));
jPanel4.add(jLabel9);
jLabel10.setText("姓 名:");
jLabel10.setBounds(new Rectangle(290, 20, 80, 25));
jPanel4.add(jLabel10);
//=================選擇框======================================================
jChoice1.addItem("男");
jChoice1.addItem("女");
jChoice1.setBounds(390, 60, 100, 25);
jPanel3.add(jChoice1);
jChoice2.addItem("身份證");
jChoice2.addItem("學生證");
jChoice2.addItem("教師證");
jChoice2.addItem("其它");
jChoice2.setBounds(390, 100, 100, 25);
jPanel3.add(jChoice2);
//===============9個按鈕=======================================================
//****************第三個面板上的按鈕***************************
jButton1.setText("添加");
jButton1.setBounds(new Rectangle(20, 225, 80, 30));
jButton1.addActionListener(new Tianjialist(this));
jPanel3.add(jButton1);
jButton2.setText("查找");
jButton2.setBounds(new Rectangle(120, 225, 80, 30));
jButton2.addActionListener(new Tianjialist(this));
jPanel3.add(jButton2);
jButton3.setText("清空");
jButton3.setBounds(220, 225, 80, 30);
jButton3.addActionListener(new Tianjialist(this));
jPanel3.add(jButton3);
jButton4.setText("修改");
jButton4.addActionListener(new Tianjialist(this));
jButton4.setBounds(new Rectangle(320, 225, 80, 30));
jPanel3.add(jButton4);
jButton5.setText("退出");
jButton5.setBounds(new Rectangle(420, 225, 80, 30));
jButton5.addActionListener(new Tianjialist(this));
jPanel3.add(jButton5);
//******************第四個面板上的按鈕************************
jButton6.setText("查詢");
jButton6.setBounds(new Rectangle(120, 225, 80, 30));
jButton6.addActionListener(new Chaxunlist(this));
jPanel4.add(jButton6);
jButton7.setText("刪除");
jButton7.setBounds(new Rectangle(220, 225, 80, 30));
jButton7.addActionListener(new Chaxunlist(this));
jPanel4.add(jButton7);
jButton8.setText("刷新");
jButton8.setBounds(new Rectangle(320, 225, 80, 30));
jButton8.addActionListener(new Chaxunlist(this));
jPanel4.add(jButton8);
jButton9.setText("退出");
jButton9.setBounds(new Rectangle(420, 225, 80, 30));
jButton9.addActionListener(new Chaxunlist(this));
jPanel4.add(jButton9);
//==============10個文本框========================================================
//*********第三個面板上的文本框************************
jTextField1.setText("");
jTextField1.setBounds(new Rectangle(110, 20, 100, 25));
jPanel3.add(jTextField1);
jTextField2.setText("");
jTextField2.setBounds(new Rectangle(390, 20, 100, 25));
jPanel3.add(jTextField2);
jTextField3.setText("");
jTextField3.setBounds(new Rectangle(110, 60, 100, 25));
jPanel3.add(jTextField3);
jTextField4.setText("");
jTextField4.setBounds(new Rectangle(110, 100, 100, 25));
jPanel3.add(jTextField4);
jTextField5.setText("");
jTextField5.setBounds(new Rectangle(110, 140, 150, 25));
jPanel3.add(jTextField5);
jTextField6.setBounds(new Rectangle(110, 180, 200, 25));
jPanel3.add(jTextField6);
//*************第四面板上的文本框************************
jTextField7.setBounds(new Rectangle(110, 20, 100, 25));
jPanel4.add(jTextField7);
jTextField8.setBounds(new Rectangle(390, 20, 100, 25));
jPanel4.add(jTextField8);
//==================JTable======================================================
jScrollPane1.setBounds(new Rectangle(15, 60, 480, 150));
jPanel4.add(jScrollPane1);
jScrollPane1.getViewport().add(jTable);
// jTable.addMouseListener(new Chaxunlist(this));
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// this.getRootPane().requestFocus();
// this.getRootPane().setDefaultButton(jButton1);
//
// Center the frame
if (x >= myWidth || y >= myHeight) {
x = myWidth;
y = myHeight;
this.setSize(x, y);
this.setLocation(0, 0);
} else {
this.setSize(x, y);
this.setLocation((myWidth - this.getSize().width) / 2,
(myHeight - this.getSize().height) / 2);
}
setTitle("讀者管理");
}
// public static void main(String[] args) {
// Jiemian jiemian = new Jiemian(MainFrame2);
//
//
// }
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -