📄 主界面.java
字号:
/* * 主界面.java * * Created on 2008年12月5日, 下午6:04 *//** * * @author Administrator */public class 主界面 extends javax.swing.JFrame { /** Creates new form 主界面 */ public 主界面() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jiami = new javax.swing.JButton(); jiemi = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); guanbi = new javax.swing.JButton(); guanyu = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("\u6587\u4ef6\u52a0\u5bc6\u89e3\u5bc6"); addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { formKeyPressed(evt); } }); jiami.setFont(new java.awt.Font("宋体", 1, 14)); jiami.setText("\u6587\u4ef6\u52a0\u5bc6"); jiami.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jiamiActionPerformed(evt); } }); jiami.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jiamiKeyPressed(evt); } }); jiemi.setFont(new java.awt.Font("宋体", 1, 14)); jiemi.setText("\u6587\u4ef6\u89e3\u5bc6"); jiemi.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jiemiActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("宋体", 1, 18)); // NOI18N jLabel1.setText("\u8bf7\u60a8\u9009\u62e9\u529f\u80fd\uff1a"); jLabel2.setFont(new java.awt.Font("宋体", 1, 36)); // NOI18N jLabel2.setText("\u6587\u4ef6\u52a0\u5bc6\u89e3\u5bc6\u8f6f\u4ef6"); guanbi.setFont(new java.awt.Font("宋体", 1, 14)); guanbi.setText("\u5173 \u95ed"); guanbi.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { guanbiActionPerformed(evt); } }); guanyu.setText("\u5173\u4e8e"); guanyu.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { guanyuMouseClicked(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(31, 31, 31) .addComponent(jLabel2)) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1) .addGroup(layout.createSequentialGroup() .addComponent(jiami, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jiemi, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addComponent(guanbi, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(15, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(308, Short.MAX_VALUE) .addComponent(guanyu) .addGap(34, 34, 34)) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {guanbi, jiami, jiemi}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel2) .addGap(33, 33, 33) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(35, 35, 35) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER, false) .addComponent(jiami, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(guanbi, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jiemi, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(31, 31, 31) .addComponent(guanyu) .addContainerGap()) ); layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {guanbi, jiami, jiemi}); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-374)/2, (screenSize.height-339)/2, 374, 339); }// </editor-fold>//GEN-END:initComponentsprivate void jiamiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jiamiActionPerformed// TODO add your handling code here: 文件加密 aa = new 文件加密();//新建加密界面对话框对象 aa.setVisible(true);//显示加密界面对话框 this.setVisible(false);//隐藏当前对话框}//GEN-LAST:event_jiamiActionPerformedprivate void jiemiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jiemiActionPerformed// TODO add your handling code here: 文件解密 bb = new 文件解密();//新建解密界面对话框对象 bb.setVisible(true);//显示解密界面对话框 this.setVisible(false);//隐藏当前对话框}//GEN-LAST:event_jiemiActionPerformedprivate void guanbiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guanbiActionPerformed// TODO add your handling code here: System.exit(this.EXIT_ON_CLOSE);//关闭软件}//GEN-LAST:event_guanbiActionPerformedprivate void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed// TODO add your handling code here: int zk = evt.getKeyCode();//获取当前按下键的键值 if (zk == 27) {//按Esc关闭 System.exit(this.HIDE_ON_CLOSE);//关闭软件 }}//GEN-LAST:event_formKeyPressedprivate void jiamiKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jiamiKeyPressed// TODO add your handling code here: int zk = evt.getKeyCode();//获取当前按下键的键值 if (zk == 27) {//按Esc关闭 System.exit(this.HIDE_ON_CLOSE);//关闭软件 } if (zk == 112) {//按F1打开关于 关于 gg = new 关于(); gg.setVisible(true); }}//GEN-LAST:event_jiamiKeyPressedprivate void guanyuMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_guanyuMouseClicked// TODO add your handling code here: 关于 gy = new 关于(); gy.setVisible(true);}//GEN-LAST:event_guanyuMouseClicked /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new 主界面().setVisible(true); } }); } @Override public void setSize(int width, int height) { super.setSize(width, height); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton guanbi; private javax.swing.JLabel guanyu; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JButton jiami; private javax.swing.JButton jiemi; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -