⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newjframe2.java

📁 能简单的实现商品的查询
💻 JAVA
字号:
/* * NewJFrame2.java * * Created on 2008 12:24 *///package shop;/** * * @author  ldwin */public class NewJFrame2 extends javax.swing.JFrame {        /** Creates new form NewJFrame2 */    public NewJFrame2() {        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.     */    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents    private void initComponents() {        jLabel1 = new javax.swing.JLabel();        jLabel2 = new javax.swing.JLabel();        jLabel3 = new javax.swing.JLabel();        jFormattedTextField1 = new javax.swing.JFormattedTextField();        jPasswordField1 = new javax.swing.JPasswordField();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        jLabel1.setText("\u7528\u6237\u540d");        jLabel2.setText("\u5bc6\u7801");        jLabel3.setText("\u7ba1\u7406\u5458\u767b\u9646");        jButton1.setText("\u786e\u5b9a");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        jButton2.setText("\u53d6\u6d88");        jButton2.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton2ActionPerformed(evt);            }        });        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());        getContentPane().setLayout(layout);        layout.setHorizontalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                .addContainerGap(168, Short.MAX_VALUE)                .addComponent(jLabel3)                .addGap(178, 178, 178))            .addGroup(layout.createSequentialGroup()                .addGap(46, 46, 46)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)                    .addComponent(jLabel1)                    .addComponent(jLabel2))                .addGap(62, 62, 62)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(layout.createSequentialGroup()                        .addComponent(jButton1)                        .addGap(26, 26, 26)                        .addComponent(jButton2)                        .addGap(122, 122, 122))                    .addGroup(layout.createSequentialGroup()                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                            .addComponent(jFormattedTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)                            .addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE))                        .addGap(119, 119, 119))))        );        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addGap(37, 37, 37)                .addComponent(jLabel3)                .addGap(31, 31, 31)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                .addGap(33, 33, 33)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(jLabel2))                .addGap(43, 43, 43)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jButton1)                    .addComponent(jButton2))                .addContainerGap(76, Short.MAX_VALUE))        );        pack();    }// </editor-fold>//GEN-END:initComponentsprivate void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed    // TODO add your handling code here:    jFormattedTextField1.setText("");        jPasswordField1.setText("");}//GEN-LAST:event_jButton2ActionPerformedprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed    // TODO add your handling code here:     String s,p;        s="hust";p="hust";        if(jFormattedTextField1.getText().equals(s)&&jPasswordField1.getText().equals(p))        {      try{              Runtime ce=Runtime.getRuntime();            ce.exec("javac NewJFrame3.java");            ce.exec("java NewJFrame3");                     }      catch(Exception e)         {  System.out.println(e);}        }          else{            try{              Runtime ce=Runtime.getRuntime();            ce.exec("javac NewOkCancelDialog.java");            ce.exec("java NewOkCancelDialog");                     }      catch(Exception e)         {  System.out.println(e);         }  };}//GEN-LAST:event_jButton1ActionPerformed        /**     * @param args the command line arguments     */    public static void main(String args[]) {        java.awt.EventQueue.invokeLater(new Runnable() {            public void run() {                new NewJFrame2().setVisible(true);            }        });    }        // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JButton jButton1;    private javax.swing.JButton jButton2;    private javax.swing.JFormattedTextField jFormattedTextField1;    private javax.swing.JLabel jLabel1;    private javax.swing.JLabel jLabel2;    private javax.swing.JLabel jLabel3;    private javax.swing.JPasswordField jPasswordField1;    // End of variables declaration//GEN-END:variables    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -