📄 frame1.java~175~
字号:
} }); jMenuPrint.setText ("打印名片"); jMenuPrint.setMnemonic('P'); jMenuPrint.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuPrint_actionPerformed(e); } }); jMenuSystemExit.setText("退出"); jMenuSystemExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuSystemExit_actionPerformed(e); } }); jMenuFunction.setBackground(new Color(212, 208, 200)); jMenuFunction.setFont(new java.awt.Font("Dialog", 0, 14)); jMenuFunction.setText("功能(F)"); jMenuFunction.setMnemonic('F'); newItem.setText ("添加记录"); newItem.setMnemonic('A'); newItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuNewItem_actionPerformed(e); } }); updateItem.setText ("更新纪录"); updateItem.setMnemonic('U'); updateItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuUpdate_actionPerformed(e); } }); bySNItem.setText ("浏览所有"); bySNItem.setMnemonic('V'); bySNItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewbySN_actionPerformed(e); } }); bySeveralItem .setText ("按条件浏览"); bySeveralItem.setMnemonic('C'); bySeveralItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewbySeveral_actionPerformed(e); } }); byDistrictItem.setText ("按地区浏览"); //已废弃 byDistrictItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewbyDistrict_actionPerformed(e); } }); bySortItem.setText("按行业浏览"); bySortItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewbySort_actionPerformed(e); } }); countItem.setText ("记录总数"); countItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewSumofRecord_actionPerformed(e); } }); deleteItem.setText ("删除记录"); deleteItem.setMnemonic('D'); deleteItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuDelete_actionPerformed(e); } }); resetItem.setText ("复位"); resetItem.setMnemonic('R'); resetItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuReset_actionPerformed(e); } }); jMenuAdvanced.setBackground(new Color(212, 208, 200)); jMenuAdvanced.setFont(new java.awt.Font("Dialog", 0, 14)); jMenuAdvanced.setText ("高级功能(V)"); jMenuPswdControl.setText("密码控制"); jMenuPswdSetAd.setText("密码设置"); jMenuPswdSetAd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuPswdSetAd_actionPerformed(e); } }); jMenuPswdGetAd.setText("权限密码"); jMenuPswdGetAd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuPswdGetAd_actionPerformed(e); } }); jMenuArrivalView.setText("查询"); jMenuArrivalView.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuArrivalView_actionPerformed(e); } }); jMenuHelp.setBackground(new Color(212, 208, 200)); jMenuHelp.setFont(new java.awt.Font("Dialog", 0, 14)); jMenuHelp.setText ("帮助(H)"); jMenuAbout.setText ("关于..."); jMenuAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuAbout_actionPerformed(e); } }); //添加工具栏 jButton1.setIcon(image1); jButton1.setBorder(null); jButton1.setMaximumSize (new Dimension(50, 43)); jButton1.setMinimumSize (new Dimension(50, 43)); jButton1.setPreferredSize (new Dimension(50, 43)); jButton1.setToolTipText ("添加一项新纪录"); jButton1.setMnemonic('A'); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuNewItem_actionPerformed(e); } }); jButton2.setIcon(image2); jButton2.setBorder(null); jButton2.setMaximumSize (new Dimension(50, 43)); jButton2.setMinimumSize (new Dimension(50, 43)); jButton2.setPreferredSize (new Dimension(50, 43)); jButton2.setToolTipText ("删除一项记录"); jButton2.setMnemonic('D'); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuDelete_actionPerformed(e); } }); jButton3.setIcon(image3); jButton3.setBorder(null); jButton3.setMaximumSize (new Dimension(50, 43)); jButton3.setMinimumSize (new Dimension(50, 43)); jButton3.setPreferredSize (new Dimension(50, 43)); jButton3.setToolTipText ("更新一项记录"); jButton3.setMnemonic('U'); jButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuUpdate_actionPerformed(e); } }); jButton4.setIcon(image4); jButton4.setBackground(new Color(212, 208, 200)); jButton4.setBorder(null); jButton4.setMaximumSize (new Dimension(50, 43)); jButton4.setMinimumSize (new Dimension(50, 43)); jButton4.setPreferredSize (new Dimension(50, 43)); jButton4.setToolTipText ("浏览所有记录(默认)"); jButton4.setMnemonic('V'); jButton4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewbySN_actionPerformed(e); } }); jButton7.setIcon(image7); jButton7.setBorder(null); jButton7.setMaximumSize (new Dimension(50, 43)); jButton7.setMinimumSize (new Dimension(50, 43)); jButton7.setPreferredSize (new Dimension(50, 43)); jButton7.setToolTipText ("打印当前名片"); jButton7.setMnemonic('P'); jButton7.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuPrint_actionPerformed(e); } }); jButton8.setIcon(image8); jButton8.setBorder(null); jButton8.setMaximumSize (new Dimension(50, 43)); jButton8.setMinimumSize (new Dimension(50, 43)); jButton8.setPreferredSize (new Dimension(50, 43)); jButton8.setToolTipText ("使用帮助"); jButton8.setMnemonic('H'); jButton8.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuAbout_actionPerformed(e); } }); jButton9.setIcon(image9); jButton9.setBorder(null); jButton9.setMaximumSize (new Dimension(50, 43)); jButton9.setMinimumSize (new Dimension(50, 43)); jButton9.setPreferredSize (new Dimension(50, 43)); jButton9.setToolTipText ("查找一项或多项纪录(通过一个或多个关键字)"); jButton9.setMnemonic('C'); jButton9.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuViewbySeveral_actionPerformed(e); } }); jButton10.setIcon(image10); jButton10.setBorder(null); jButton10.setMaximumSize (new Dimension(50, 43)); jButton10.setMinimumSize (new Dimension(50, 43)); jButton10.setPreferredSize (new Dimension(50, 43)); jButton10.setToolTipText ("输入新纪录之前清空文本域"); jButton10.setMnemonic('R'); jButton10.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuReset_actionPerformed(e); } }); updateItem.setEnabled ( false ); newItem.setEnabled ( false ); deleteItem.setEnabled ( false ); resetItem.setEnabled( false ); jMenuPrint.setEnabled ( false); jMenuPswdSet.setEnabled( false ); jMenuNameSet.setEnabled( false ); jMenuArrivalView.setEnabled(false); jMenuPswdControl.setEnabled(false); jButton1.setEnabled( false ); jButton2.setEnabled( false ); jButton3.setEnabled( false ); jButton7.setEnabled( false ); jButton10.setEnabled( false ); //--------------密码对话框 String choices[] = new String[] {"确定","取消"}; String input = "请输入密码:"; JPasswordField pwd = new JPasswordField(15); // 密码框 pwd.setEchoChar('*'); // 密码框掩码 JLabel intr1 = new JLabel("欢迎使用系统,管理员请输入密码"), intr2 = new JLabel("输入不正确或不输入都只具有查询功能!"), intr3 = new JLabel("------------------------------------------------"); Object msgs[] = new Object[] {intr1,intr2,intr3,input,pwd}; int password = 0; password = JOptionPane.showOptionDialog(null,msgs,"管理员权限密码", JOptionPane.OK_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null, choices,choices[0]); // 取得密码与默认密码比较 if(password==JOptionPane.OK_OPTION) { if (pwd.getText().compareToIgnoreCase(pswdDefault)==0) { updateItem.setEnabled ( true ); // 更新菜单条目可以使用 newItem.setEnabled ( true ); // 添加菜单条目可以使用 deleteItem.setEnabled ( true ); // 删除菜单条目可以使用 resetItem.setEnabled( true ); //复位菜单条目可以使用 jMenuPrint.setEnabled ( true ); // 打印菜单条目可以使用 jMenuPswdSet.setEnabled( true ); //密码设置菜单条目可以使用 jMenuNameSet.setEnabled( true ); //会议名称设置菜单条目可以使用 jButton1.setEnabled( true ); //添加记录工具栏按钮可以使用 jButton2.setEnabled( true ); //删除记录工具栏按钮可以使用 jButton3.setEnabled( true ); //更新记录工具栏按钮可以使用 jButton7.setEnabled( true ); //打印记录工具栏按钮可以使用 jButton10.setEnabled( true ); //复位工具栏按钮可以使用 jMenuPswdControl.setEnabled(true); jMenuPswdSetAd.setEnabled(false); } } addressArea.setBorder(BorderFactory.createEtchedBorder()); addressArea.setRows(1); paneLeft.setMinimumSize(new Dimension(200, 106)); paneLeft.setPreferredSize(new Dimension(180, 106)); nameLabel.setFont (new java.awt.Font("Dialog", 0, 13)); positionLabel.setFont (new java.awt.Font("Dialog", 0, 13)); companyLabel.setFont (new java.awt.Font("Dialog", 0, 13)); officephoneLabel.setFont(new java.awt.Font("Dialog", 0, 13)); mobileLabel.setFont (new java.awt.Font("Dialog", 0, 13)); emailLabel.setFont (new java.awt.Font("Dialog", 0, 13)); webpageLabel.setFont (new java.awt.Font("Dialog", 0, 13)); faxLabel.setFont (new java.awt.Font("Dialog", 0, 13)); callLabel.setFont (new java.awt.Font("Dialog", 0, 13)); departLabel.setFont (new java.awt.Font("Dialog", 0, 13)); sortLabel.setFont (new java.awt.Font("Dialog", 0, 13)); postcodeLabel.setFont (new java.awt.Font("Dialog", 0, 13)); numberLabel.setFont (new java.awt.Font("Dialog", 0, 13)); addressLabel.setFont (new java.awt.Font("Dialog", 0, 13)); nameField.setColumns(31); positionField.setColumns(31); cardCanvasPanel.setLayout(borderLayout2); panelEast.setMinimumSize(new Dimension(170, 10)); panelEast.setPreferredSize(new Dimension(170, 10)); panelTop.setMinimumSize(new Dimension(10, 20)); panelTop.setPreferredSize(new Dimension(10, 20)); panelBottom.setMinimumSize(new Dimension(10, 100)); panelBottom.setPreferredSize(new Dimension(10, 100)); panelBottom.setLayout(borderLayout5); panelWest.setMinimumSize(new Dimension(170, 10)); panelWest.setPreferredSize(new Dimension(170, 10)); cardPanel.setBackground(Color.white); cardPanel.setMinimumSize(new Dimension(500, 260)); cardPanel.setPreferredSize(new Dimension(500, 260)); cardPanel.setLayout(borderLayout3); jPanelCenter.setLayout(gridLayout1); jLabelName.setFont(new java.awt.Font("Dialog", 0, 14)); jLabelName.setHorizontalAlignment(SwingConstants.CENTER); jLabelName.setHorizontalTextPosition(SwingConstants.CENTER); jLabelName.setText("姓名"); jLabelCompany.setFont(new java.awt.Font("Dialog", 0, 14)); jLabelCompany.setHorizontalAlignment(SwingConstants.CENTER); jLabelCompany.setHorizontalTextPosition(SwingConstants.CENTER); jLabelCompany.setText("单位"); jLabelPosition.setFont(new java.awt.Font("Dialog", 0, 14)); jLabelPosition.setHorizontalAlignment(SwingConstants.CENTER); jLabelPosition.setHorizontalTextPosition(SwingConstants.CENTER); jLabelPosition.setText("职位"); jLabelNameMeeting.setFont(new java.awt.Font("Dialog", 1, 20)); jLabelNameMeeting.setHorizontalAlignment(SwingConstants.CENTER); jLabelNameMeeting.setHorizontalTextPosition(SwingConstants.CENTER); jLabelNameMeeting.setText(meetingName); jLabelIcon.setHorizontalAlignment(SwingConstants.CENTER); jLabelIcon.setHorizontalTextPosition(SwingConstants.CENTER); jLabelIcon.setIcon(imageIconMeeting); gridLayout1.setColumns(2); gridLayout1.setRows(3); gridLayout1.setVgap(2); jPanelNorth.setLayout(gridBagLayout1); jPanelNorth.setBackground(SystemColor.window); jPanelNorth.setMinimumSize(new Dimension(82, 80)); jPanelNorth.setPreferredSize(new Dimension(82, 80)); jPanelSouth.setBackground(SystemColor.window); jPanelSouth.setMinimumSize(new Dimension(10, 100)); jPanelSouth.setPreferredSize(new Dimension(10, 100)); jPanelSouth.setLayout(borderLayout4); jPanelCenter.setBackground(SystemColor.window); jPanelCenter.setMinimumSize(new Dimension(100, 80)); jPanelCenter.setPreferredSize(new Dimension(100, 80)); jLabelName1.setFont(new java.awt.Font("Dialog", 0, 14));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -