Foro de elhacker.net

Programación => Java => Mensaje iniciado por: Tlecoatl en 30 Abril 2011, 23:22 pm



Título: Problema con JFrame
Publicado por: Tlecoatl en 30 Abril 2011, 23:22 pm
Buen dia!!!
Tengo una duda sobre un Frame que realice para la creacion de unos graficos. Mi unico problema es que, cuando mando llamar al selector de figuras (un dialog) no se crea la figura....en cambio cuando ejecuto el JDialog y despues el frame este si me ejecuta la graficacion!!! alguien sabe porque??? Si me pudieran ayudar se los agradeceria. Lo que deseo es que al entrar al jdialog desde el frame y seleccionar la figura me regrese al JFrame que lo llamo con la figura ya dibujada...

Aqui el codigo que llevo..

Código:
 
private void etAreaMouseClicked(java.awt.event.MouseEvent evt) {                                   
        // TODO add your handling code here:
        SeleccionFigura obj = new SeleccionFigura(this, true);
        obj.setVisible(true);

    }

Código:
private void btnGraficarActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
        int figurin;

        if (this.RadioCasa.isSelected()) {
            figurin = 1;
            Bienvenida obj = new Bienvenida(figurin);
            obj.setVisible(true);
            this.dispose();
        } else if (this.RadioCubo.isSelected()) {
            figurin = 2;
            Bienvenida obj = new Bienvenida(figurin);
            obj.setVisible(true);
           
        } else if (this.RadioPiramide.isSelected()) {
            figurin = 3;
            Bienvenida obj = new Bienvenida(figurin);
            obj.setVisible(true);
            this.dispose();
        } else if (this.RadioRectangular.isSelected()) {
            figurin = 4;
            Bienvenida obj = new Bienvenida(figurin);
            obj.setVisible(true);
            this.dispose();
        }

    }                   

Cabe destacar que ya tengo dos constructores en el frame uno con parametros y otro sin parametros
Código:
public Bienvenida() {
        super("Graficación 3D");
        initComponents();
        setLocationRelativeTo(null);
        this.Herramientas.setVisible(false);
        this.Herramientas2.setVisible(false);
        this.AreaTrabajo.setVisible(true);
        this.PanelCartesiano.setVisible(true);

        plano = new PlanoCartesiano(this.PanelCartesiano.getSize());
        plano.setBackground(Color.WHITE);
        PanelCartesiano.add(plano);
        PanelCartesiano.repaint();
    }

    public Bienvenida(int figura) {
        super("Graficación 3D");
        initComponents();
        setLocationRelativeTo(null);
        this.Herramientas.setVisible(false);
        this.Herramientas2.setVisible(false);
        this.AreaTrabajo.setVisible(true);
        this.PanelCartesiano.setVisible(true);
        this.figura = figura;

        plano = new PlanoCartesiano(this.PanelCartesiano.getSize(),figura);
        plano.setBackground(Color.WHITE);
        PanelCartesiano.add(plano);
        PanelCartesiano.repaint();
    }

De antemano muchas gracias por su pronta respuesta ;)