7
UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17 Recta Declaro Atributos y variables de instancia que sean enteros: x0, x1; y0, y1; constructor-convencional, dar clic derecho, insert code, constructor, aparece sintaxis public Calculos (int x0, int y0, int x1, int y1){ x0=x0; y0=y0; x1=x1; y1=y1; } }//Fin de la clase Calculos Se hace uso de la herencia para poder manipular los datos. public class panel extends javax.swing.JPanel { //creo variables private int x0, y0; private int x1, y1; //inicializo variables con el método de escritura setter public void setX0(int x0) { this.x0 = x0; }

Recta

  • Upload
    levy-gt

  • View
    46

  • Download
    7

Embed Size (px)

DESCRIPTION

Programa en java que graáica una recta

Citation preview

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17

Recta

Declaro Atributos y variables de instancia que sean enteros:

x0, x1;

y0, y1;

constructor-convencional, dar clic derecho, insert code, constructor, aparece sintaxis

public Calculos (int x0, int y0, int x1, int y1){

x0=x0;

y0=y0;

x1=x1;

y1=y1;

}

}//Fin de la clase Calculos

Se hace uso de la herencia para poder manipular los datos.

public class panel extends javax.swing.JPanel {

//creo variables

private int x0, y0;

private int x1, y1;

//inicializo variables con el método de escritura setter

public void setX0(int x0) {

this.x0 = x0;

}

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17

public void setX1(int x1) {

this.x1 = x1;

}

public void setY0(int y0) {

this.y0 = y0;

}

public void setY1(int y1) {

this.y1 = y1;

}

public panel() {

initComponents();

}

//Método de la interfaz dibujable

Método paint(Graphics g) {

super.paint(g);

g.setColor(Color.orange);

g.drawLine(this.x0, this.y0, this.x1, this.y1);

//VARIABLES VISUALIZADAS EN LA PANTALLA

Cadena: recta1 = "Punto_X =" + Se evalúa la cadena en el eje x

Cadena: recta2 = "Punto_Y=" + Se evalúa la cadena en el eje y

//ESCRIBO LAS COORDENADAS EN EL EJE X Y EL EJE Y EN LA EJECUCION

Cadena : recta1, 5, 10

Cadena : recta2, 200, 10);

//PARA PODER VOLVER A DIBUJAR

Método: DibujarLineaRecta() {

repaint();

}

// Variables declaration - do not modify // End of variables declaration

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17

} //fin de la clase panel

public class principal extends javax.swing.JFrame {

public principal() {

initComponents();

}

//Genero código desde el botón graficar

//insert code Jcomponent llamo al metodo paint(grapichs.g)

//Llamo al panel para poder graficar

}

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17

UNIVERSIDAD AUTÓNOMA DEL ESTA DE MÉXICO REDES NEURONALES PROYECTO RECTA LEVI GUADARRAMA TERCERO ICO-17