elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Mensajes
Páginas: [1]
1  Programación / Java / Re: Creación dinámica de jButtons/Buttons en: 30 Abril 2013, 00:32 am
Hola buenas tardes

Gracias por responder a ambos, Sapito169:
Al crear el bucle de la nueva clase de AccionEscogioMesa, solamente me agrega una sola mesa abierta de todas las que se tienen, esto hace que los botones no se agregen de acuerdo al conteo de las mesas que se obtienen, y por lógica no me muestra la información total de estas.... sigue siendo funcional al agregar el boton y dar clic sobre el y que me muestre un mensaje con el numero de la mesa que selecciono... si entiendo que al indicar dentro del while
btnMesa=new JButon(...)

se agregarán las mesas que tenga en botones nuevos y que tal vez ahi se encuentre mi error por que no indico un actionlistener por cada boton, pero si le quito el
 btnMesa
                   .addActionListener(new AccionEscogioMesa(rs.getString("mesa")));

y dejandolo sin que instancie la nueva clase de AccionEscogioMesa, si muestra el numero de mesas en los botones pero me sigue dando la misma circunstancia...



Visual Free, tu codigo esta perfectamente amoldable, el punto es que como me trato de explicar es que al dar clic en cada boton de la mesa que se encuentre abierta, quiero que me muestrre un mensaje con el numero de mesa que estoy pinchando..

saludos
2  Programación / Java / Re: Creación dinámica de jButtons/Buttons en: 26 Abril 2013, 13:33 pm
Hola que tal

Verás, entiendo el codigo que me has posteado, y noto que me manejas cierto tipo de herencia entre metodos get y set, pero, los botones que estoy agregando contienen solamente el numero de la mesa abierta de una tabla de sql, al realizar la consulta si me obtiene los datos y los pasa a los botones, lo que no realiza en realidad es que al dar clic en cualquier boton, no me muestra un mensaje que pongo como prueba con "JOptionPane.showMessageDialog(null, boton.getText());" para poder saber que numero de mesa estoy clickeando, solamente es funcional en la ultima mesa o el ultimo boton generado.

el método que utilizzo para generar los botones mediante la consulta es el siguiente:
 
void cargaMesa()
 {
     conexion mysql = new conexion();
     Connection cn = mysql.Conectar();
     String sSQL = "";
     sSQL = "SELECT mesa FROM ventas WHERE estado = 'abierto'";
     try
     {
         Statement st = cn.createStatement();
         ResultSet rs = st.executeQuery(sSQL);
          while (rs.next()){
             
              PaneMedio.setLayout(new GridLayout (5,4));
              PaneMedio.setSize(420, 400);
              PaneMedio.add(btnmesas = new JButton( rs.getString("mesa")));
              String path = "/images/mesa.png"; 
              URL url = this.getClass().getResource(path); 
              ImageIcon icon = new ImageIcon(url);
              btnmesas.setIcon(icon);
                     
             
          }
     }catch ( Exception e){
         
     }
 }

en donde PaneMedio es un panel que utilizo para poder cargar dentro del mismo los botones

btnmesas, es la variable del boton que agrego cuando se realiza l consulta
al que le agrego de la misma manera una imagen. en el momento de extraer la información de la consulta, manda el numero de la mesa al boton, si por ejemplo son 4 mesas abiertas apareceran 4 botones simultaneos, utilizo un GridLayout para poder acomodar los botones en forma de matriz, pero al dar clic en cualquiera de estos botones, no me muestra nada de mi evento que es el siguiente para los botones que se agregan:

 public void actionPerformed(ActionEvent ae) {
             
        if(ae.getSource() == btnmesas){
            JOptionPane.showMessageDialog(null, btnmesas.getText());
        }
    }

Dentro de este evento, indico que si al dar clic en el boton btnmesas, me muestre un mensaje donde aparezca el numero de la mesa, pero solo aparece en el ultimo como mostrare a continuación:

Me aparecera dentro del panel 3 botones de mesas abiertas que tengo en la tabla ventas de sql

Mesa 1
Mesa 2
Mesa 3

si doy clic en mesa 1, no me muestra el mensaje de 1
Igual si doy clic en mesa 2
Pero si doy clic en mesa 3, me muestra un mensaje con el numero 3....

supuse que podría generar un arreglo de botones y un contador de mesas, para indicar a que boton voy a agregar cada numero de mesa y sea mostrado asi al dar clic en cada uno, ya identificaria q botons es, pero dentro del evento, igual tendria que indicar que boton es el que se le dara clic y sale la misma cuestión.. Muchas gracias por responderme,,,, creeme que estoy super desesperado
3  Programación / Java / Re: Creación dinámica de jButtons/Buttons en: 25 Abril 2013, 09:31 am
Hola, estaba leyendo los post, y me encuentro en la misma situación, no se de cuando sean, pero a mi apenas me encargaron un sistema para un restaurante el cual debe de contener los distintos modulos, como lo es el del cajero, administrador, mesero y en ninguno he tenido problemas, solo con el del mesero en el cual tengo q agregar a un frame botones con el numero de mesa abierta que exista en tiempo real, es decir:

Tengo mesas abiertas:
1-abierta
2-Cerrada
3-Abierta

y que en el frame solo aparezcan la 1 y la 3, y que al ddar clic sobre el boton, este me consulte los detalles de la cuenta de esa mesa...

Yo logre colocar despues de mi consulta en sql los botones ya dentro de un panel que contiene el jframe, pero lo que no logro es que en el evento de los botones al dar clic en cualquiera, me extraiga al menos el valor que contiene el boton como prueba, pues verás, doy clic en el boton de la mesa 1 y no hace absolutamente nada, pero si doy clic en el ultimo boton de la consulta, si me arroja las pruebas que hice de mostrar un mensaje, mira te dejo mi codigo para que ver si alguien me puede ayudar a que con cualquier clic sobre cualquier boton me pueda arrojar las pruebas de qe esta funcional.


Clase mesas

package Mesero;

import conexion.conexion;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 *
 * @author Maria
 */
public class mesas extends javax.swing.JFrame implements ActionListener {
 String hora, minutos, segundos, ampm;
 Thread h1;
 private String mesero = "";

    private javax.swing.JButton btnmesas;
    public mesas() {
        initComponents();
        this.setTitle("Panel del mesero");
        consultaEmpresa();
        cargarfecha();
        consultaMesas();
        txtmesero.setText(mesero);
          btnmesas.addActionListener(this);
    }
    public void setmesero(String mesero){
        this.mesero = mesero;
        txtmesero.setText(mesero);
    }
   //METODO DE CONSULTA DE MESAS************************************************
    void consultaMesas()
    {
       
        conexion mysql = new conexion();
        Connection cn = mysql.Conectar();
        String sSQL = "";
     
                JLabel placa = new JLabel ("placas", JLabel.LEFT);
             
            sSQL = "SELECT mesa FROM ventas WHERE estado = 'abierto' ";
            try
        {
           Statement st = cn.createStatement();
            ResultSet rs = st.executeQuery(sSQL);
            rs.first();
            int encont = rs.getRow();

if(encont == 1)
{
            cargaMesa();
            }
else {JOptionPane.showMessageDialog(null, "No hay empresa designada");}}
catch ( SQLException ex){JOptionPane.showMessageDialog(null, ex);}}
    //METODO DE CONSULTA DEL NOMBRE DE LA EMPRESA DESIGNADA*********************
 void consultaEmpresa()
    {
       
        conexion mysql = new conexion();
        Connection cn = mysql.Conectar();
        String sSQL = "";
                     
               
            sSQL = "SELECT nombre, direccion FROM empresa ";
            try
        {
           Statement st = cn.createStatement();
            ResultSet rs = st.executeQuery(sSQL);
            rs.last();
            int encont = rs.getRow();

if(encont == 1)
{
   txtempresa.setText(rs.getString("nombre"));
   txtdireccion.setText(rs.getString("direccion"));
}
else {JOptionPane.showMessageDialog(null, "No hay empresa designada");}}
catch ( SQLException ex){JOptionPane.showMessageDialog(null, ex);}}
 //METODO PARA CARGAR LAS MESAS ENCONTRADAS ABIERTAS****************************
 void cargaMesa()
 {
     conexion mysql = new conexion();
     Connection cn = mysql.Conectar();
     String sSQL = "";
     sSQL = "SELECT mesa FROM ventas WHERE estado = 'abierto'";
     try
     {
         Statement st = cn.createStatement();
         ResultSet rs = st.executeQuery(sSQL);
          while (rs.next()){
              PaneMedio.setLayout(new GridLayout (5,4));
              PaneMedio.setSize(420, 400);
              PaneMedio.add(btnmesas = new JButton( rs.getString("mesa")));
              String path = "/images/mesa.png"; 
              URL url = this.getClass().getResource(path); 
              ImageIcon icon = new ImageIcon(url);
              btnmesas.setIcon(icon);
             
          }
     }catch ( Exception e){
         
     }
 }
 //METODO PARA CARGAR LA FECHA DEL SISTEMA**************************************
  void cargarfecha() {
        Calendar cal = Calendar.getInstance();
        Calendar c = new GregorianCalendar();
        String dia, mes, annio;
        dia = Integer.toString(c.get(Calendar.DATE));
        mes = Integer.toString(c.get(Calendar.MONTH));
        annio = Integer.toString(c.get(Calendar.YEAR));
        int m = Integer.parseInt(mes);
        int sum = m + 1;
        String mes1 = Integer.toString(sum);
        String fecha = annio + "-" + mes1 + "-" + dia;
        String hora = cal.get(cal.HOUR_OF_DAY) + ":" + cal.get(cal.MINUTE) + ":" + cal.get(cal.SECOND);
        this.txtfecha.setText(fecha);
        this.txthora.setText(hora);
    }
    /**
     * 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();
        txtempresa = new javax.swing.JLabel();
        txtdireccion = new javax.swing.JLabel();
        txtfecha = new javax.swing.JLabel();
        txthora = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        txtmesero = new javax.swing.JLabel();
        txtmesero1 = new javax.swing.JLabel();
        txtmesero2 = new javax.swing.JLabel();
        txtmesero3 = new javax.swing.JLabel();
        txtmesero4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        txtmesero5 = new javax.swing.JLabel();
        PaneMedio = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(0, 153, 153));
        jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 0, 0), new java.awt.Color(0, 0, 0), new java.awt.Color(0, 0, 0), new java.awt.Color(0, 0, 0)));

        txtempresa.setFont(new java.awt.Font("Tempus Sans ITC", 1, 24)); // NOI18N

        txtdireccion.setFont(new java.awt.Font("Tempus Sans ITC", 1, 8)); // NOI18N

        txtfecha.setFont(new java.awt.Font("Tempus Sans ITC", 0, 18)); // NOI18N
        txtfecha.setText("jLabel1");

        txthora.setFont(new java.awt.Font("Tempus Sans ITC", 0, 18)); // NOI18N
        txthora.setText("jLabel1");

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CALENDAR.png"))); // NOI18N

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/RELOJ.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(txtempresa, javax.swing.GroupLayout.PREFERRED_SIZE, 411, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(txtdireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 419, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(33, 33, 33)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtfecha, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txthora, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(txtempresa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(txtdireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtfecha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txthora, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2))
        );

        jPanel2.setBackground(new java.awt.Color(0, 153, 153));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Detalle de la Mesa", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tempus Sans ITC", 1, 12), new java.awt.Color(0, 0, 0))); // NOI18N

        txtmesero.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtmesero.setText("jLabel3");

        txtmesero1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtmesero1.setText("Mesa");

        txtmesero2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtmesero2.setText("Num Venta");

        txtmesero3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtmesero3.setText("Propina");

        txtmesero4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtmesero4.setText("Total Venta");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jScrollPane1.setViewportView(jTable1);

        txtmesero5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtmesero5.setText("Comanda");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtmesero, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtmesero1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtmesero2, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtmesero3)
                            .addComponent(txtmesero4)
                            .addComponent(txtmesero5))
                        .addGap(0, 153, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtmesero, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtmesero5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtmesero1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtmesero2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtmesero3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtmesero4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        PaneMedio.setBackground(new java.awt.Color(204, 204, 204));
        PaneMedio.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 51, 51), new java.awt.Color(0, 51, 51), new java.awt.Color(0, 51, 51), new java.awt.Color(0, 51, 51)));
        PaneMedio.setPreferredSize(new java.awt.Dimension(461, 5));

        javax.swing.GroupLayout PaneMedioLayout = new javax.swing.GroupLayout(PaneMedio);
        PaneMedio.setLayout(PaneMedioLayout);
        PaneMedioLayout.setHorizontalGroup(
            PaneMedioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 457, Short.MAX_VALUE)
        );
        PaneMedioLayout.setVerticalGroup(
            PaneMedioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jPanel3.setBackground(new java.awt.Color(102, 102, 102));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 159, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, 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(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(PaneMedio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(PaneMedio, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

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

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(mesas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(mesas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(mesas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(mesas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new mesas().setVisible(true);
               
            }
        });
    }
 
   
    // Variables declaration - do not modify                     
    private javax.swing.JPanel PaneMedio;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel txtdireccion;
    private javax.swing.JLabel txtempresa;
    private javax.swing.JLabel txtfecha;
    private javax.swing.JLabel txthora;
    private javax.swing.JLabel txtmesero;
    private javax.swing.JLabel txtmesero1;
    private javax.swing.JLabel txtmesero2;
    private javax.swing.JLabel txtmesero3;
    private javax.swing.JLabel txtmesero4;
    private javax.swing.JLabel txtmesero5;
    // End of variables declaration                   

    @Override
    public void actionPerformed(ActionEvent ae) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        if(ae.getSource() == btnmesas){
            JOptionPane.showMessageDialog(null, btnmesas.getText());
        }
    }

   
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines