I am currently writing a program which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules.

I have created the JFrame and the JButtons to create the GUI however, I cannot figure out how to make each of these Jbuttons open up a new frame or panel. Please help me. I will attach the file and the code is below:

* 
* To change this template, choose Tools | Templates 
* and open the template in the editor. 
*/ 

/* 
* ConversionGUI.java 
* 
* Created on Mar 16, 2010, 4:50:30 PM 
*/ 

package c; 

import javax.swing.JFrame; 

/** 
* 
* @author James 
*/ 
public class ConversionGUI extends javax.swing.JFrame { 

/** Creates new form ConversionGUI */ 


public ConversionGUI() { 
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() { 

jButton1 = new javax.swing.JButton(); 
jLabel1 = new javax.swing.JLabel(); 
jButton2 = new javax.swing.JButton(); 
jLabel2 = new javax.swing.JLabel(); 
jButton3 = new javax.swing.JButton(); 
jLabel3 = new javax.swing.JLabel(); 
jButton4 = new javax.swing.JButton(); 
jLabel4 = new javax.swing.JLabel(); 
jButton5 = new javax.swing.JButton(); 
jLabel5 = new javax.swing.JLabel(); 
jButton6 = new javax.swing.JButton(); 
jLabel6 = new javax.swing.JLabel(); 
jButton7 = new javax.swing.JButton(); 
jLabel7 = new javax.swing.JLabel(); 

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 
setTitle("Computer Architecture Converter"); 

jButton1.setText("Binary to Decimal"); 

jLabel1.setText("B2D"); 

jButton2.setText("Decimal to Binary"); 

jLabel2.setText("D2B"); 

jButton3.setText("Hexadecimal to Decimal"); 

jLabel3.setText("H2D"); 

jButton4.setText("Decimal to Hexadecimal"); 

jLabel4.setText("D2H"); 

jButton5.setText("Library of Boolean Algebra Rules"); 

jLabel5.setText("LBAR"); 

jButton6.setText("1's Complement"); 

jLabel6.setText("2C"); 

jButton7.setText("2's Compliment"); 

jLabel7.setText("1C"); 

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(38, 38, 3 
.addComponent(jButton1)) 
.addGroup(layout.createSequentialGroup() 
.addGap(87, 87, 87) 
.addComponent(jLabel1))) 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(layout.createSequentialGroup() 
.addGap(84, 84, 84) 
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) 
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
.addComponent(jLabel2) 
.addGap(55, 55, 55))) 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(layout.createSequentialGroup() 
.addGap(150, 150, 150) 
.addComponent(jLabel3) 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 224, Short.MAX_VALUE) 
.addComponent(jLabel4) 
.addGap(117, 117, 117)) 
.addGroup(layout.createSequentialGroup() 
.addGap(77, 77, 77) 
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 
.addGap(85, 85, 85) 
.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 
.addGap(37, 37, 37)))) 
.addGroup(layout.createSequentialGroup() 
.addGap(138, 138, 138) 
.addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) 
.addGap(334, 334, 334) 
.addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) 
.addGap(170, 170, 170)) 
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 
.addGap(202, 202, 202) 
.addComponent(jLabel7) 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 463, Short.MAX_VALUE) 
.addComponent(jLabel6) 
.addGap(243, 243, 243)) 
.addGroup(layout.createSequentialGroup() 
.addGap(432, 432, 432) 
.addComponent(jLabel5) 
.addContainerGap(477, Short.MAX_VALUE)) 
.addGroup(layout.createSequentialGroup() 
.addGap(333, 333, 333) 
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addContainerGap(366, Short.MAX_VALUE)) 
); 
layout.setVerticalGroup( 
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(layout.createSequentialGroup() 
.addGap(66, 66, 66) 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) 
.addGap(30, 30, 30) 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jButton3) 
.addComponent(jButton1) 
.addComponent(jButton2) 
.addComponent(jButton4)) 
.addGap(97, 97, 97) 
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE) 
.addComponent(jButton5) 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) 
.addGap(18, 18, 1 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jButton6) 
.addComponent(jButton7)) 
.addGap(37, 37, 37)) 
); 

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 ConversionGUI().setVisible(true); 
} 
}); 
} 

// Variables declaration - do not modify 
private javax.swing.JButton jButton1; 
private javax.swing.JButton jButton2; 
private javax.swing.JButton jButton3; 
private javax.swing.JButton jButton4; 
private javax.swing.JButton jButton5; 
private javax.swing.JButton jButton6; 
private javax.swing.JButton jButton7; 
private javax.swing.JLabel jLabel1; 
private javax.swing.JLabel jLabel2; 
private javax.swing.JLabel jLabel3; 
private javax.swing.JLabel jLabel4; 
private javax.swing.JLabel jLabel5; 
private javax.swing.JLabel jLabel6; 
private javax.swing.JLabel jLabel7; 
// End of variables declaration 

}

Don't use Netbeans for dynamically generating panels. It only leads to frustration. Write your GUI by hand.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.