如何在java中添加CurrentDate中的天数

时间:2015-08-21 14:51:12

标签: java netbeans jframe

如何从我的第一个JTextField传递JFrame中的值和第二个JFrame的标签?这就是我所拥有的:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling cod

                    String value=jTextField1.getText();
                    pass page=new pass(value);
                    page.setVisible(true);
        //e here:
    }

传递给

/*
 * Passing2.java
 *
 * Created on Aug 21, 2015, 10:41:38 PM
 */

package trypo;

import java.lang.String;

public class Passing2 extends javax.swing.JFrame {

    /** Creates new form Passing2 */
    public Passing2(String st)
    {
        initComponents();
        lbl.setText(st);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
        lbl = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(131, 131, 131)
                .addComponent(lbl, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(153, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(88, 88, 88)
                .addComponent(lbl, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(186, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Passing2().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JLabel lbl;
    // End of variables declaration
}

0 个答案:

没有答案