Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help in putting actions to buttons

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help in putting actions to buttons

    Can you help me put actions to the following buttons
    public class TimeIn extends javax.swing.JFrame {
     
    /** Creates new form Timein */
    public TimeIn() {
    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">
    private void initComponents() {
     
    jPopupMenu1 = new javax.swing.JPopupMenu();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextPane1 = new javax.swing.JTextPane();
    jRadioButton1 = new javax.swing.JRadioButton();
    jRadioButton2 = new javax.swing.JRadioButton();
    jRadioButton3 = new javax.swing.JRadioButton();
    jRadioButton4 = new javax.swing.JRadioButton();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
     
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
     
    jScrollPane1.setViewportView(jTextPane1);
     
    jRadioButton1.setText("SOCSIT");
    jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jRadioButton1ActionPerformed(evt);
    }
    });
     
    jRadioButton2.setText("ABMA");
     
    jRadioButton3.setText("SOE");
     
    jRadioButton4.setText("SOAB");
     
    jButton1.setText("Log in");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    }
    });
     
    jButton2.setText("Print");
     
    jLabel1.setText("Welcome to Asia Pacific College Library");
     
    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()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jRadioButton1)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(jRadioButton2)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(jRadioButton3)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jRadioButton4))
    .addGroup(layout.createSequentialGroup()
    .addGap(22, 22, 22)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(18, 18, 18)
    .addComponent(jButton1)))
    .addGap(266, 266, 266))
    .addGroup(layout.createSequentialGroup()
    .addContainerGap(414, Short.MAX_VALUE)
    .addComponent(jButton2)
    .addGap(52, 52, 52))
    .addGroup(layout.createSequentialGroup()
    .addGap(168, 168, 168)
    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(154, 154, 154)))
    .addGap(57, 57, 57))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(27, 27, 27)
    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(69, 69, 69)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jButton1))
    .addGap(23, 23, 23)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jRadioButton1)
    .addComponent(jRadioButton2)
    .addComponent(jRadioButton3)
    .addComponent(jRadioButton4))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(jButton2)
    .addContainerGap(65, Short.MAX_VALUE))
    );
     
    pack();
    }// </editor-fold>
    Last edited by Freaky Chris; December 14th, 2011 at 01:06 PM. Reason: Added code tags


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Help in putting actions to buttons

    help me put actions to the following buttons
    jRadioButton1ActionPerformed(evt);

    Replace that line of code with the code that you want to be executed when the button is pressed.

Similar Threads

  1. [SOLVED] need help with struts actions
    By arvindbis in forum Web Frameworks
    Replies: 0
    Last Post: October 4th, 2011, 05:40 AM
  2. PUTTING JSCROLLPANE INSIDE JFRAME
    By fueledbyjace in forum AWT / Java Swing
    Replies: 0
    Last Post: September 15th, 2011, 07:21 AM
  3. Need help putting GUI in program!
    By greyfox175 in forum AWT / Java Swing
    Replies: 5
    Last Post: May 4th, 2011, 08:55 PM
  4. Java - Button Actions on Form --Please help
    By Cami7 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 24th, 2011, 01:31 PM
  5. do actions in ComboBox
    By java_cs in forum AWT / Java Swing
    Replies: 2
    Last Post: October 1st, 2009, 10:53 AM

Tags for this Thread