📄 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 + -