Está en la página 1de 3

TECNOLGICO NACIONAL DE MXICO

INSTITUTO TECNOLGICO DE OAXACA

PROGRAMACIN VISUAL
Unidad II

Prueba de escritorio

CATEDRATICO: REYNA VALVERDE JARQUIN

ALUMNO: ALONSO HERNANDEZ JOSUE

GRUPO E1A

TERCER SEMESTRE

13:00 14:00 pm.

INGENIERIA EN ELECTRNICA

04 DE OCTUBRE DE 2016

Alonso Hernndez Josu Ingeniera en Electrnica


Programacin Visual U.II
PRUEBA DE ESCRITORIO DEL PROGRAMA 4A USANDO CONTADORES
(JSPINNER), CON EL CICLO FOR

public class numeros extends javax.swing.JFrame {

public numeros() {

initComponents(); }

private void generarActionPerformed(java.awt.event.ActionEvent evt)


{

int 5 = (int)n1.getValue();
Haciendo una prueba de
int 9 = (int)n2.getValue(); escritorio, con un valor real,
se podra decir ya que
for( int num = 5 ; num <= 5;){
nosotros estamos generando
num = (int)(Math.random() * 9 ); un nmero preciso, en el cual
entonces procederemos a
num = genera un numero (5 9)
realizar el cdigo que
if( 6 >= 5 ) tenemos en nuestro
programa, y si esta cumple
texto.setText(String.valueOf( 6 ));
las condiciones obtendremos
} } un resultado.

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new numeros().setVisible(true);

} }); }

private javax.swing.JButton generar;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JSpinner n1;

private javax.swing.JSpinner n2;

private javax.swing.JTextField texto;

Alonso Hernndez Josu Ingeniera en Electrnica


Programacin Visual U.II
Otro ejemplo.

private void generarActionPerformed(java.awt.event.ActionEvent evt)


{

int 3 = (int)n1.getValue();
Haciendo una prueba de
int 15 = (int)n2.getValue(); escritorio, con un valor real,
se podra decir ya que
for( int num = 3 ; num <= 3;){
nosotros estamos generando
num = (int)(Math.random() * 15 ); un nmero preciso, en el cual
entonces procederemos a
10= genera un nmero (3 15).
realizar el cdigo que
if( 10 >= 3 ) tenemos en nuestro
programa, y si esta cumple
texto.setText(String.valueOf( 10 ));
las condiciones obtendremos
} } un resultado.

Alonso Hernndez Josu Ingeniera en Electrnica


Programacin Visual U.II

También podría gustarte