Comunidad Underground Hispana  
Visita: Descargas - Foro de juegos - Articulos - Juegos Gratis - Download Free

Retroceder   Comunidad Underground Hispana > Programacion > Programación > Java

Tema Cerrado Crear Nuevo Tema
 
Share LinkBack Herramientas Desplegado
Antiguo 10-ene-2010, 12:58   #1
Member
 
Avatar de unicode98
 
Fecha de Ingreso: noviembre-2009
Mensajes: 87
Predeterminado [Solucionado] instancia con jFrame y Java Class

Hola lo que quiero es hacer una instancia de una multiplicación desde una clase hacia un jFrame..... se hacer la instancia pero desde una
clase a otra clase pero de una clase a un jFrame no me funciona Ayudaaaaaaaaaaa Porfa ;D

Aqui la clase:

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

package Instancia;

/**
 *
 * @author unicode
 */
public class BuscarValor {

    double c,e,o;

    public BuscarValor(double c, double e, double o) {
  }

    BuscarValor() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    public double getE() {
        return e;
    }

    public void setE(double e) {
        this.e = e;
    }

    public double getO() {
        return o;
    }

    public void setO(double o) {
     this.o = o;
    }
}

 [codigo]

y aqui el framer

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

/*
 * NewJFrame.java
 *
 * Created on 01/16/2010, 10:57:17 AM
 */

package Instancia;

/**
 *
 * @author unicode
 */
public class NewJFrame extends javax.swing.JFrame {
    
    public double w,b;
    /** Creates new form NewJFrame */
    public NewJFrame() {
        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();
        a = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        Salida = new javax.swing.JTextArea();
        z = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setText("Aceptar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        a.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aActionPerformed(evt);
            }
        });

        Salida.setColumns(20);
        Salida.setRows(5);
        jScrollPane1.setViewportView(Salida);

        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.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(z, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(a, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(z, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );

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

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        BuscarValor bv = new BuscarValor();
        w = Double.parseDouble(a.getText());
        b = Double.parseDouble(z.getText());
        bv.c = w;
        bv.e = b;
        this.Salida.append(""+bv.o);
    }                                        

    private void aActionPerformed(java.awt.event.ActionEvent evt) {                                  
        // TODO add your handling code here:
    }                                 

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

    // Variables declaration - do not modify                     
    private javax.swing.JTextArea Salida;
    private javax.swing.JTextField a;
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField z;
    // End of variables declaration                   

}
la multiplicacion no me sale

Última edición por Fashion; 07-feb-2010 a las 11:00 Razón: NORMAS DEL FORO - ART. 6
unicode98 está desconectado  
Antiguo 06-feb-2010, 21:29   #2
Member
 
Avatar de unicode98
 
Fecha de Ingreso: noviembre-2009
Mensajes: 87
Talking

ya lo eh resuelto ^_^
unicode98 está desconectado  
Tema Cerrado

Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder mensajes
No puedes subir archivos adjuntos
No puedes editar tus mensajes

Los Códigos BB están Activado
Las Caritas están Activado
[IMG] está Activado
El Código HTML está Desactivado
Trackbacks están Activado
Pingbacks están Activado
Refbacks están Activado



La franja horaria es GMT -5. Ahora son las 04:01.



Juegos gratis Underground Mexico Veo Descargas Songs Traducidas Videos De Musica Conservacion Tabs Metal
Noticias
 Juegos De Coche juegos gratis online juegos Utilidades Trucos
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2
Traducción por vBHispano.com