Respuesta: no me muestra el label de jbutton al compilar no hay caso ,no anda aca va el codigo fuente:
public class Calculadora extends javax.swing.JFrame {
//variabes
double plusminus;
double primero;
double segundo;
double Total;
//para chequear que boton se chequeo
int plusclick;
int minusclick;
int multiplyclick;
int divideclick;
/** Creates new form Calculadora */
public Calculadora() {
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() {
jPanel1 = new javax.swing.JPanel();
display = new javax.swing.JTextField();
mas = new javax.swing.JButton("+");
menos = new javax.swing.JButton("-");
multiplicacion = new javax.swing.JButton("*");
Igual = new javax.swing.JButton("=");
Division = new javax.swing.JButton("/");
mas_men = new javax.swing.JButton("+/-");
mas_men1 = new javax.swing.JButton("1");
setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.create EtchedBorder());
display.setEditable(false);
display.setFont(new java.awt.Font("Arial", 1, 18));
mas.setFont(new java.awt.Font("Arial", 1, 18));
mas.setText("+");
menos.setFont(new java.awt.Font("Arial", 1, 18));
menos.setText("-");
multiplicacion.setFont(new java.awt.Font("Arial", 1, 18));
multiplicacion.setText("x");
Igual.setFont(new java.awt.Font("Arial", 1, 18));
Igual.setText("=");
Division.setFont(new java.awt.Font("Arial", 1, 18));
Division.setText("/");
mas_men.setFont(new java.awt.Font("Arial", 1, 18));
mas_men.setText("+/-");
mas_men1.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
mas_men1.setText("1");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(mas_men, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.Component Placement.UNRELATED)
.addComponent(Igual, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(display, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADIN G, jPanel1Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(110, 110, 110)
.addComponent(mas, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILI NG, jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addComponent(menos, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(multiplicacion, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Division, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addComponent(mas_men1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(display, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
.addComponent(mas)
.addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
.addComponent(menos)
.addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
.addComponent(multiplicacion))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(mas_men1)))
.addPreferredGap(javax.swing.LayoutStyle.Component Placement.UNRELATED)
.addComponent(Division)
.addGap(52, 52, 52)
.addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
.addComponent(mas_men)
.addComponent(Igual))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_S IZE, Short.MAX_VALUE))
);
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.TRAILI NG, layout.createSequentialGroup()
.addContainerGap(123, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(22, 22, 22))
);
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 Calculadora().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton Division;
private javax.swing.JButton Igual;
private javax.swing.JTextField display;
private javax.swing.JPanel jPanel1;
private javax.swing.JButton mas;
private javax.swing.JButton mas_men;
private javax.swing.JButton mas_men1;
private javax.swing.JButton menos;
private javax.swing.JButton multiplicacion;
// End of variables declaration
} |