登陆框代码:
package com.erp.windows; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Toolkit; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.Border; import javax.swing.border.EtchedBorder; public class LoginFrame extends JFrame { //BorderLayout是布局管理器,通过东西南北中的位置的布局 BorderLayout borderLayout1 = new BorderLayout(); //GridLayout是一个可以把容器进行以网格形式布局出现的布局管理器, GridLayout gridLayout1 = new GridLayout(); //FlowLayout是流布局管理器,常用来对按钮的位置进行处理,让按钮的排列能在同一个水平面上排列 FlowLayout flowLayout1 = new FlowLayout(); //JPanel的功能是可以在它之上添加组件. JPanel jPanel1 = new JPanel();//这里定义为填写信息组件的JPanel JPanel jPanel2 = new JPanel();//这里是摆放按钮的JPanel //BorderFactory是创建Border(边框的工厂类,下面的语句的意思构造一个具有浮雕效果的边框) Border border1 = BorderFactory.createEtchedBorder(EtchedBorder.RAISED,Color.white, new Color(148, 145, 140)); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JLabel jLabel4 = new JLabel(); JTextField jTuser = new JTextField(); JPasswordField jPassconf = new JPasswordField(); JPasswordField jPass = new JPasswordField(); //下面是定义按钮 : 登陆按钮,跟退出按钮 JButton jBlogin = new JButton(); JButton jBexit = new JButton(); /** * 构造方法,主要是对窗体位置,大小,可见性进行初始化 */ public LoginFrame() { try { this.setSize(new Dimension(380, 200)); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); jbInit(); } catch (Exception exception) { exception.printStackTrace(); } } /** * 对整体布局进行初始化方法 * @return */ public void jbInit() { this.setResizable(false); //是否允许用户对窗体进行大小的修改 --- 这里是登陆框,选择不能修改 this.setTitle("系统登陆"); /** * 用户ID模块 */ /*--------------------------------------------------------------------------------------------------*/ //setHorizontalAlignment(int alignment) 设置标签的内容是沿着X轴的对齐方式, //alignment - SwingConstants 中定义的以下常量之一: //LEFT、CENTER(只显示图像的标签的默认值)、RIGHT、LEADING(只显示文本的标签的默认值)或 TRAILING。 jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText("用户名"); //Dimension 类封装单个对象中组件的宽度和高度(精确到整数)。 //setPreferredSize(Dimension preferredSize)----将组件的首选大小设置为常量值。 //对 getPreferredSize 的后续调用总是返回此值。将首选大小设置为 null 可还原默认的行为。 jTuser.setPreferredSize(new Dimension(6,17)); jTuser.setText(""); /*--------------------------------------------------------------------------------------------------*/ /** * 密码模块 */ /*--------------------------------------------------------------------------------------------------*/ jLabel2.setHorizontalAlignment(SwingConstants.CENTER); jLabel2.setText("密码:"); jPassconf.setPreferredSize(new Dimension(6,17)); jPassconf.setText(""); jLabel3.setHorizontalAlignment(SwingConstants.CENTER); jLabel3.setText("重复密码:"); jPass.setPreferredSize(new Dimension(6,17)); jPass.setText(""); /*--------------------------------------------------------------------------------------------------*/ /** * 按钮模块 */ /*--------------------------------------------------------------------------------------------------*/ jBlogin.setPreferredSize(new Dimension(100,30)); jBlogin.setText("用户登录"); jBexit.setPreferredSize(new Dimension(100,30)); jBexit.setText("系统退出"); /*--------------------------------------------------------------------------------------------------*/ /** * 布局整理 */ /*--------------------------------------------------------------------------------------------------*/ getContentPane().setLayout(borderLayout1); borderLayout1.setHgap(2);//设置水平间距 borderLayout1.setVgap(5);//设置垂直间距 jLabel4.setText("登陆框"); this.getContentPane().add(jLabel4, BorderLayout.NORTH); //getCintentPane() ----返回此对话框的 contentPane 对象。 jPanel1.add(jLabel1); jPanel1.add(jTuser); jPanel1.add(jLabel2); jPanel1.add(jPass); jPanel1.add(jLabel3); jPanel1.add(jPassconf); //重点: gridLayout1.setColumns(2); gridLayout1.setRows(3); jPanel1.setBorder(border1); jPanel1.setLayout(gridLayout1); this.getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel2.add(jBlogin); jPanel2.add(jBexit); jPanel2.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.RIGHT); this.getContentPane().add(jPanel2, BorderLayout.SOUTH); this.setVisible(true); /*--------------------------------------------------------------------------------------------------*/ /** * 事件监听模块 */ /*--------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------*/ } public static void main(String[] args) { new LoginFrame(); } }
主框架 :
package com.erp.windows; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.SystemColor; import java.awt.Toolkit; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JToolBar; import javax.swing.border.Border; import javax.swing.border.EtchedBorder; public class JF_main extends JFrame { JPanel contentPane; BorderLayout borderLayout1 = new BorderLayout(); //JDesktopPane是用于创建多文档界面或者虚拟桌面的容器 public static JDesktopPane desktop = new JDesktopPane(); JMenuBar jMenuBarMain = new JMenuBar(); JToolBar jToolBarMain = new JToolBar(); Border border1; Border border2; JLabel jLabel1 = new JLabel(); public JF_main() { try{ setDefaultCloseOperation(EXIT_ON_CLOSE); BuildMenuBar(); BuildToolBar(); jbInit(); loadBackgroundImage(); }catch (Exception exception) { exception.printStackTrace(); } } /** * 初始化布局 */ private void jbInit(){ contentPane = (JPanel) this.getContentPane(); border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, Color.GRAY); border2 = BorderFactory.createLineBorder(new Color(247, 249, 248), 1); contentPane.setLayout(borderLayout1); jLabel1.setForeground(new Color(255,104,69)); jLabel1.setBorder(border2); jToolBarMain.setBorder(border1); jToolBarMain.setFloatable(false);//不能移动工具栏 //_MenuBarEvent.setDeskTop(this.desktop); this.setJMenuBar(jMenuBarMain); this.setResizable(false); desktop.setBackground(SystemColor.desktop); contentPane.add(jToolBarMain,BorderLayout.NORTH); contentPane.add(desktop,BorderLayout.CENTER); contentPane.add(jLabel1,BorderLayout.SOUTH); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); setVisible(true); this.setSize(new Dimension(900, 700)); setTitle("ERP模型"); } /** * 设置菜单栏 */ private void BuildMenuBar() { JMenu[] _jMenu = {new JMenu("【基本信息】"),new JMenu("【业务管理】"), new JMenu("【业务查询】"),new JMenu("【用户管理】"), new JMenu("【系统管理】")}; //-------------基本信息的菜单选项--------------- JMenuItem[] _jMenuItem0 = {new JMenuItem("商品情况"), new JMenuItem("客户情况"), new JMenuItem("供应商情况")}; String[] _jMenuItem0Name = {"JF_view_medicine", "JF_view_client","JF_view_gys"}; //-------------业务管理的菜单选项---------------- JMenuItem[] _jMenuItem1 = {new JMenuItem("商品采购"), new JMenuItem("商品销售"), new JMenuItem("库存盘点"), new JMenuItem("销售退货"), new JMenuItem("客户回款")}; String[] _jMenuItem1Name={"JF_view_buy", "JF_view_sell","JF_view_stock", "JF_view_xstk","JF_view_hkgl"}; //-------------业务查询的菜单选项----------------- JMenuItem[] _jMenuItem2 = {new JMenuItem("基本信息"), new JMenuItem("入库明细"), new JMenuItem("销售明细"), new JMenuItem("回款信息")}; //new JMenuItem("【退库信息】")}; String[] _jMenuItem2Name = {"JF_view_query_jbqk", "JF_view_query_rkqk", "JF_view_query_kcmx_ck", "JF_view_query_kcmx_hk", ""}; //-------------用户管理的菜单查询------------------- JMenuItem[] _jMenuItem3 = {new JMenuItem("增加用户"), new JMenuItem("用户维护")}; String[] _jMenuItem3Name = {"sys_user_add", "sys_user_modify"}; //------------系统管理的菜单选项-------------------- JMenuItem[] _jMenuItem4 = {new JMenuItem("系统退出")};//new JMenuItem("【重新登陆】"), String[] _jMenuItem4Name = {"JB_EXIT"};//"JB_LOGIN", //列出所有的菜单大项 for(int i = 0;i < _jMenu.length;i++) { jMenuBarMain.add(_jMenu[i]); } //列出基本信息的菜单选项 for(int i = 0; i<_jMenuItem0.length; i++){ _jMenu[0].add(_jMenuItem0[i]); _jMenu[0].addSeparator(); } //列出业务管理的菜单选项 for(int i = 0;i<_jMenuItem1.length;i++ ) { _jMenu[1].add(_jMenuItem1[i]); _jMenu[1].addSeparator(); } //列出业务查询的菜单选项 for(int i = 0;i<_jMenuItem2.length;i++) { _jMenu[2].add(_jMenuItem2[i]); _jMenu[2].addSeparator(); } //列出任务管理的菜单选项 for(int i = 0; i<_jMenuItem3.length; i++) { _jMenu[3].add(_jMenuItem3[i]); _jMenu[3].addSeparator(); } //列出系统管理的菜单选项 for(int i = 0;i<_jMenuItem4.length;i++ ) { _jMenu[4].add(_jMenuItem4[i]); } } private JMenuBar buildmenu(){ JMenuBar jMenuBar = new JMenuBar(); JMenu jMenu = new JMenu("参数设置") ; jMenuBar.add(jMenu); return jMenuBar; } /** * 设置工具栏 */ private void BuildToolBar() { JToolBar toolbar = new JToolBar(); String ImageName[] = {"药品录入.gif","供应商录入.gif","药品采购.gif","药品销售.GIF","库存盘点.GIF", "销售退货.GIF","客户回款.GIF","基本查询.GIF","入库明细.GIF","销售明细.GIF","用户管理.GIF","系统退出.GIF"}; String TipString[] = {"药品录入","供应商录入","药品采购","药品销售","库存盘点", "销售退货","客户回款","基本查询","入库明细","销售明细","用户管理","系统退出"}; String ComandString[] = {"JF_view_medicine","JF_view_gys","JF_view_buy", "JF_view_sell","JF_view_stock", "JF_view_xstk","JF_view_hkgl","JF_view_query_jbqk", "JF_view_query_rkqk", "JF_view_query_kcmx_ck","sys_user_modify","JB_EXIT"}; for(int i = 0;i<ComandString.length;i++){ ImageIcon image = new ImageIcon(".\\images\\"+ImageName[i]); JButton jb = new JButton(); jb.setIcon(image); jb.setToolTipText(TipString[i]);//设置鼠标停留显示文本 jb.setActionCommand(ComandString[i]); jToolBarMain.add(jb); } } /** * 载入背景图片 */ protected void loadBackgroundImage() { ImageIcon icon = new ImageIcon(".\\images\\main.jpg"); JLabel jl = new JLabel(icon); jl.setBounds(0,0,icon.getIconWidth(),icon.getIconHeight()); desktop.add(jl,new Integer(Integer.MIN_VALUE)); } }
基本录入:
package com.erp.windows; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextField; public class JF_view_medicine extends JInternalFrame { BorderLayout borderLayout1 = new BorderLayout(); BorderLayout borderLayout2 = new BorderLayout(); BorderLayout borderLayout3 = new BorderLayout(); FlowLayout flowLayout1 = new FlowLayout(); FlowLayout flowLayout2 = new FlowLayout(); GridLayout gridLayout1 = new GridLayout(); //JTabbedPane:一个组件,它允许用户通过单击具有给定标题和/或图标的选项卡,在一组组件之间进行切换 JTabbedPane jTabbedPane1 = new JTabbedPane(); JPanel jPanel1 = new JPanel(); JPanel jPanel2 = new JPanel(); JPanel jPanel3 = new JPanel(); JPanel jPanel4 = new JPanel(); JPanel jPanel5 = new JPanel(); JButton jBmodi = new JButton(); JButton jBsave = new JButton(); JButton jBadd = new JButton(); JButton jBexit = new JButton(); JButton jBquery = new JButton(); JButton jBlookall = new JButton(); JButton jButton3 = new JButton(); 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(); JLabel jLabel11 = new JLabel(); JLabel jLabel12 = new JLabel(); JLabel jLabel13 = new JLabel(); JLabel jLabel14 = new JLabel(); JLabel jLabel15 = new JLabel(); JLabel jLabel16 = new JLabel(); JLabel jLabel17 = new JLabel(); JLabel jLabel18 = new JLabel(); JLabel jLabel19 = new JLabel(); JLabel jLabel20 = new JLabel(); JLabel jLabel21 = new JLabel(); JLabel jLabel22 = new JLabel(); JLabel jLabel23 = new JLabel(); JLabel jLabel24 = new JLabel(); JTextField jTextField1 = new JTextField(); JTextField jTextField2 = new JTextField(); JTextField jTextField3 = new JTextField(); JTextField jTextField4 = new JTextField(); JTextField jTextField5 = new JTextField(); JTextField jTextField7 = new JTextField(); JTextField jTextField9 = new JTextField(); JTextField jTextField10 = new JTextField(); JTextField jTextField14 = new JTextField(); JTextField jTextField15 = new JTextField(); JTextField jTextField16 = new JTextField(); JTextField jTextField17 = new JTextField(); JTextField jTextField19 = new JTextField(); JTextField jTbh = new JTextField(); JTextField jTvalue = new JTextField(); Object[] dw = {"盒","包","袋","个","罐","粒","片","瓶"}; Object[] jyfs = {"经销","代销"}; Object[] zlbz = {"中国标准","卫生部标准","地方标准","进口标准","企业标准"}; Object[] jx = {"大型号","中型号","小型号"}; Object[] yxq = {"半年","一年","一年半","二年","二年半","三年","三年以上"}; Object[] lb = {"饮料","食品","日用品","衣服","电子产品","药品"}; //JComboBox将按钮或可编辑字段与下拉列表组合的组件。用户可以从下拉列表中选择值, //下拉列表在用户请求时显示。如果使组合框处于可编辑状态,则组合框将包括用户可在其中键入值的可编辑字段。 JComboBox jCdw = new JComboBox(dw); //单位 JComboBox jCzlbz = new JComboBox(zlbz);//质量标准 JComboBox jCjyfs = new JComboBox(jyfs);//经营方式 JComboBox jCyj = new JComboBox(jx);// JComboBox jCyxq = new JComboBox(yxq);//有效期 JComboBox jClb = new JComboBox(lb);//类别 JComboBox jCysf = new JComboBox();//算法 JComboBox jCzd = new JComboBox();//字典 JScrollPane jScrollPane1 = new JScrollPane(); JTable jTable1 = new JTable(); public JF_view_medicine() { try { jbInit(); }catch(Exception e) { e.printStackTrace(); } } private void jbInit() { jCzd.addItem("药品编号"); jCzd.addItem("拼音编码"); jCysf.addItem("like"); jCysf.addItem(">"); jCysf.addItem("="); jCysf.addItem("<"); jCdw.setEditable(true); jCdw.configureEditor(jCdw.getEditor(),"盒");// 利用指定项初始化编辑器。 jCzlbz.setEditable(true); jCzlbz.configureEditor(jCzlbz.getEditor(),"中国标准"); jCjyfs.setEditable(true); jCjyfs.configureEditor(jCjyfs.getEditor(),"经销"); jCyj.setEditable(true); jCyj.configureEditor(jCyj.getEditor(),"针剂"); jCyxq.setEditable(true); jCyxq.configureEditor(jCyxq.getEditor(),"半年"); jClb.setEditable(true); jClb.configureEditor(jClb.getEditor(),"饮料"); getContentPane().setLayout(borderLayout1); jPanel1.setLayout(borderLayout2); jPanel2.setLayout(borderLayout3); jPanel3.setLayout(flowLayout2); jPanel4.setLayout(gridLayout1); gridLayout1.setColumns(4); gridLayout1.setRows(10); jBmodi.setText("修改"); jBsave.setText("保存"); jBadd.setText("添加"); jBexit.setText("退出"); jLabel1.setText("药品编号"); jTextField1.setText(""); jLabel2.setText("药品名称"); jTextField2.setText(""); jLabel3.setText("药品条码"); jTextField3.setText(""); jLabel4.setText("通用名称"); jTextField4.setText(""); jLabel5.setText("拼音码"); jTextField5.setText(""); jLabel6.setText("单位"); jLabel7.setText("规格"); jTextField7.setText(""); jLabel8.setText("剂型"); jLabel9.setText("产地"); jTextField9.setText(""); jLabel10.setText("包装数量"); jTextField10.setText(""); jLabel11.setText("有效期"); jLabel12.setText("质量标准"); jLabel13.setText("经营方式"); jLabel14.setText("批号"); jTextField14.setText(""); jLabel15.setText("零售价格"); jTextField15.setText(""); jLabel16.setText("进货价格"); jTextField16.setText(""); jLabel17.setText("批发价格"); jTextField17.setText(""); jLabel18.setText("药品类名"); jLabel19.setText("医疗保险编号"); jTextField19.setText(""); flowLayout2.setAlignment(FlowLayout.RIGHT); jLabel21.setText("药品编号"); jTbh.setPreferredSize(new Dimension(126, 29)); jTbh.setText(""); jPanel1.setBorder(null); jPanel4.setBorder(BorderFactory.createLoweredBevelBorder()); jPanel3.setBorder(BorderFactory.createLineBorder(Color.black)); jPanel5.setLayout(flowLayout1); jLabel22.setText("数值:"); jTvalue.setPreferredSize(new Dimension(110, 22)); jTvalue.setText(""); jLabel23.setText("运算符:"); jLabel24.setText("类别:"); jBquery.setText("检索"); jBlookall.setText("全部查看"); jButton3.setText("关闭"); jPanel5.setBorder(BorderFactory.createLoweredBevelBorder()); jScrollPane1.setBorder(BorderFactory.createLineBorder(Color.black)); jCzd.setPreferredSize(new Dimension(99, 22)); jCysf.setPreferredSize(new Dimension(59, 22)); jTable1.setAutoscrolls(false); jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); this.getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); jTabbedPane1.add(jPanel1, "基本录入"); jTabbedPane1.add(jPanel2, "数据浏览"); jPanel3.add(jLabel21); jPanel3.add(jTbh); jPanel3.add(jBmodi); jPanel3.add(jBadd); jPanel3.add(jBsave); jPanel3.add(jBexit); jPanel1.add(jPanel4, java.awt.BorderLayout.CENTER); jPanel4.add(jLabel1); jPanel4.add(jTextField1); jPanel4.add(jLabel2); jPanel4.add(jTextField2); jPanel4.add(jLabel3); jPanel4.add(jTextField3); jPanel4.add(jLabel4); jPanel4.add(jTextField4); jPanel4.add(jLabel5); jPanel4.add(jTextField5); jPanel4.add(jLabel6); jPanel4.add(jCdw); jPanel4.add(jLabel7); jPanel4.add(jTextField7); jPanel4.add(jLabel8); jPanel4.add(jCyj); jPanel4.add(jLabel9); jPanel4.add(jTextField9); jPanel4.add(jLabel10); jPanel4.add(jTextField10); jPanel4.add(jLabel11); jPanel4.add(jCyxq); jPanel4.add(jLabel12); jPanel4.add(jCzlbz); jPanel4.add(jLabel13); jPanel4.add(jCjyfs); jPanel4.add(jLabel14); jPanel4.add(jTextField14); jPanel4.add(jLabel15); jPanel4.add(jTextField15); jPanel4.add(jLabel16); jPanel4.add(jTextField16); jPanel4.add(jLabel17); jPanel4.add(jTextField17); jPanel4.add(jLabel18); jPanel4.add(jClb); jPanel4.add(jLabel19); jPanel4.add(jTextField19); jPanel1.add(jPanel3, java.awt.BorderLayout.SOUTH); jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER); //JLabel ss = (JLabel)jPanel4.getComponent(0); jPanel2.add(jPanel5, java.awt.BorderLayout.NORTH); jPanel5.add(jLabel24); jPanel5.add(jCzd); jPanel5.add(jLabel23); jPanel5.add(jCysf); jPanel5.add(jLabel22); jPanel5.add(jTvalue); jPanel5.add(jBquery); jPanel5.add(jBlookall); jPanel5.add(jButton3); jScrollPane1.getViewport().add(jTable1); //System.out.println(ss.getText()); setVisible(true); setSize(new Dimension(782, 502)); this.setClosable(true); this.setMaximizable(true); this.setTitle("药品基本信息情况"); //getGys(); } public static void main(String[] args) { new JF_view_medicine(); } }
客户资料:
package com.erp.windows; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.border.Border; import javax.swing.border.EtchedBorder; public class JF_view_client extends JFrame{ //定义组件 BorderLayout borderLayout1 = new BorderLayout(); JTabbedPane jTabbedPane1 = new JTabbedPane(); JPanel jPanel1 = new JPanel(); JPanel jPanel2 = new JPanel(); BorderLayout borderLayout2 = new BorderLayout(); JPanel jPanel3 = new JPanel(); JPanel jPanel4 = new JPanel(); JButton jBadd = new JButton(); JButton jBsave = new JButton(); JButton jBexit = new JButton(); GridLayout gridLayout1 = new GridLayout(); JLabel jLabel1 = new JLabel(); JTextField jTextField1 = new JTextField(); JLabel jLabel2 = new JLabel(); JTextField jTextField2 = new JTextField(); JLabel jLabel3 = new JLabel(); JTextField jTextField3 = new JTextField(); JLabel jLabel4 = new JLabel(); JTextField jTextField4 = new JTextField(); JLabel jLabel5 = new JLabel(); JTextField jTextField5 = new JTextField(); JLabel jLabel6 = new JLabel(); JTextField jTextField6 = new JTextField(); JLabel jLabel7 = new JLabel(); JTextField jTextField7 = new JTextField(); JLabel jLabel8 = new JLabel(); JTextField jTextField8 = new JTextField(); JLabel jLabel9 = new JLabel(); JTextField jTextField9 = new JTextField(); JLabel jLabel10 = new JLabel(); JTextField jTextField10 = new JTextField(); FlowLayout flowLayout1 = new FlowLayout(); JButton jBmodi = new JButton(); BorderLayout borderLayout3 = new BorderLayout(); JScrollPane jScrollPane1 = new JScrollPane(); JTable jTable1 = new JTable(); JButton jBlookAll = new JButton(); JPanel jPanel6 = new JPanel(); FlowLayout flowLayout2 = new FlowLayout(); JButton jButton2 = new JButton(); JButton jBquery = new JButton(); JLabel jLabel11 = new JLabel(); JComboBox jComboBox1 = new JComboBox(); JLabel jLabel12 = new JLabel(); JComboBox jComboBox2 = new JComboBox(); JLabel jLabel13 = new JLabel(); JTextField jTvalue = new JTextField(); // BuildTable buildTable = new BuildTable(); JLabel jLabel14 = new JLabel(); JTextField jTbh = new JTextField(); Border border1 = BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.white, new Color(148, 145, 140)); public JF_view_client() { try { jbInit(); } catch (Exception exception) { exception.printStackTrace(); } } private void jbInit() { jComboBox1.addItem("客户编号"); jComboBox1.addItem("拼音编码"); jComboBox2.addItem(">"); jComboBox2.addItem("like"); jComboBox2.addItem("<"); getContentPane().setLayout(borderLayout1); jPanel1.setLayout(borderLayout2); jBadd.setText("添加"); // jBadd.addActionListener(new JF_view_client_jBadd_actionAdapter(this)); jBsave.setText("存盘"); //jBsave.addActionListener(new JF_view_client_jBsave_actionAdapter(this)); jBexit.setText("关闭"); // jBexit.addActionListener(new JF_view_client_jBexit_actionAdapter(this)); jPanel4.setLayout(gridLayout1); gridLayout1.setColumns(4); gridLayout1.setHgap(6); gridLayout1.setRows(5); jLabel1.setText("客户编号"); jTextField1.setText(""); jLabel2.setText("客户名称"); jTextField2.setText(""); jLabel3.setText("拼音编码"); jTextField3.setText(""); jLabel4.setText("客户地址"); jTextField4.setText(""); jLabel5.setText("所属地区"); jTextField5.setText(""); jLabel6.setText("邮政编码"); jTextField6.setText(""); jLabel7.setText("联系电话"); jTextField7.setText(""); jLabel8.setText("联系人"); jTextField8.setText(""); jLabel9.setText("开户银行"); jTextField9.setText(""); jLabel10.setText("开户账号"); jTextField10.setText(""); jPanel3.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); flowLayout1.setHgap(10); borderLayout2.setHgap(1); borderLayout2.setVgap(5); jBmodi.setText("修改"); // jBmodi.addActionListener(new JF_view_client_jBmodi_actionAdapter(this)); jPanel2.setLayout(borderLayout3); //jTabbedPane1.addChangeListener(new JF_view_client_jTabbedPane1_changeAdapter(this)); jBlookAll.setText("全部查看"); // jBlookAll.addActionListener(new JF_view_client_jBlookAll_actionAdapter(this)); jPanel6.setLayout(flowLayout2); flowLayout2.setAlignment(FlowLayout.CENTER); jButton2.setText("退出"); //jButton2.addActionListener(new JF_view_client_jButton2_actionAdapter(this)); jBquery.setText("检索"); //jBquery.addActionListener(new JF_view_client_jButton3_actionAdapter(this)); jLabel11.setText("类别:"); jComboBox1.setMinimumSize(new Dimension(100, 22)); jComboBox1.setPreferredSize(new Dimension(110, 22)); jLabel12.setText("运算符:"); jLabel13.setText("数值:"); jTvalue.setPreferredSize(new Dimension(169, 25)); jComboBox2.setPreferredSize(new Dimension(50, 22)); jLabel14.setText("请输入客户编号:"); jTbh.setPreferredSize(new Dimension(200, 28)); jTbh.setText(""); //jTbh.addKeyListener(new JF_view_client_jTbh_keyAdapter(this)); jPanel6.setBorder(BorderFactory.createLoweredBevelBorder()); jPanel3.setBorder(BorderFactory.createLoweredBevelBorder()); jPanel4.setBorder(BorderFactory.createLoweredBevelBorder()); jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane. HORIZONTAL_SCROLLBAR_ALWAYS); jScrollPane1.setVerticalScrollBarPolicy(JScrollPane. VERTICAL_SCROLLBAR_ALWAYS); // jTbh.addActionListener(new JF_view_gys_jTbh_actionAdapter(this)); this.getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); jTabbedPane1.add(jPanel1, "基本信息录入"); jTabbedPane1.add(jPanel2, "浏览全部数据"); jPanel1.add(jPanel4, java.awt.BorderLayout.CENTER); jPanel4.add(jLabel1); jPanel4.add(jTextField1); jPanel4.add(jLabel2); jPanel4.add(jTextField2); jPanel4.add(jLabel3); jPanel4.add(jTextField3); jPanel4.add(jLabel4); jPanel4.add(jTextField4); jPanel4.add(jLabel5); jPanel4.add(jTextField5); jPanel4.add(jLabel6); jPanel4.add(jTextField6); jPanel4.add(jLabel7); jPanel4.add(jTextField7); jPanel4.add(jLabel8); jPanel4.add(jTextField8); jPanel4.add(jLabel9); jPanel4.add(jTextField9); jPanel4.add(jLabel10); jPanel4.add(jTextField10); jPanel3.add(jLabel14); jPanel3.add(jTbh); jPanel3.add(jBmodi); jPanel3.add(jBadd); jPanel3.add(jBsave); jPanel3.add(jBexit); jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER); jPanel2.add(jPanel6, java.awt.BorderLayout.NORTH); jPanel6.add(jLabel11); jPanel6.add(jComboBox1); jPanel6.add(jLabel12); jPanel6.add(jComboBox2); jPanel6.add(jLabel13); jPanel6.add(jTvalue); jPanel6.add(jBquery); jPanel6.add(jBlookAll); jPanel6.add(jButton2); jScrollPane1.getViewport().add(jTable1); jPanel1.add(jPanel3, java.awt.BorderLayout.NORTH); // jTextField1.addKeyListener(new JTkeyAdapter(jTextField2)); // jTextField2.addKeyListener(new JTkeyAdapter(jTextField3)); // jTextField3.addKeyListener(new JTkeyAdapter(jTextField4)); // jTextField4.addKeyListener(new JTkeyAdapter(jTextField5)); // jTextField5.addKeyListener(new JTkeyAdapter(jTextField6)); // jTextField6.addKeyListener(new JTkeyAdapter(jTextField7)); // jTextField7.addKeyListener(new JTkeyAdapter(jTextField8)); // jTextField8.addKeyListener(new JTkeyAdapter(jTextField9)); // jTextField9.addKeyListener(new JTkeyAdapter(jTextField10)); // jTextField10.addKeyListener(new JF_view_client_jTbh_keyAdapter(this)); // jTbh.addKeyListener(new KeyStroke()); this.setSize(700,320); this.setVisible(true); this.setTitle("客户基本信息情况"); // this.setClosable(true); } public static void main(String[] args) { new JF_view_client(); } }