Matrices En Java

Páginas: 14 (3372 palabras) Publicado: 23 de enero de 2013
Vamos hacer un sencillo programa con el NetBeans el cual va a realizar una calculadora en Java. Primero que nada vamos a necesitar el NetBeans IDE 6.1 (Sirve cualquier versión), lo descargamos.

Nota: Para poder instalar Netbeans IDE 6.1 es necesario tener instalado +JDK

Creación del programa - DISEÑO
1) Creamos un Proyecto Nuevo (New Project) seleccionando “Java” y luego “AplicaciónJava”. Le colocamos el nombre de "MATRIZ" (sin comillas). 2) Hacemos clic derecho sobre el nombre del proyecto, nos vamos donde diga "New" (Nuevo) y damos clic en "JFrame Form".

“MATRIZ”

3) En "Class name" (Nombre de la clase) escribimos "matriz" (Sin comillas) y damos clic en "Finish" (Finalizar).

“MATRIZ”

4) Ahora en la barra de “PALETA” le agregamos Cajas de texto (JTextField), Botones(JButton), 1 Tabla, (jLabel), la cantidad necesaria para crear una matriz tal y como se muestra en la imagen te deberá quedar así:

DISEÑO
CLICK DERECHO CLICK EN PROPIEDADES

ELEGIR EL COLOR PARA EL FONDO DEL BUTTON, TAMBIÉN TIPO, COLOR Y TAMAÑO DE LETRA…CERRAR.

CREAMOS UNA TABLA. YA CREADA LA TABLA DAMOS CLICK DERECHO EN “CONTENIDO DE TABLA”….

NOS DIRIGIMOS EN LA OPCIÓN “COLUMNAS”.SELECCIONAMOS EL NÚMERO “11” EN EL CONTADOR. EDITAMOS DEL NÚMERO 1 AL 10 DEJANDO EL PRIMER CASILLERO EN BLANCO PARA REALIZAR EL CUADRO DE LA MATRIZ. CLICK EN CERRAR.

DE LA MISMA MANERA REALIZAMOS ESTE PASO PARA LA OPCIÓN “FILAS”

NOS DIRIGIMOS EN LA OPCIÓN “FILAS”. SELECCIONAMOS EL NÚMERO “10” EN EL CONTADOR. EDITAMOS DEL NÚMERO 1 AL 10 PARA FINALIZAR EL CUADRO DE LA MATRIZ. CLICK EN CERRAR. CLICK DERECHO Y CLICK EN LA OPCIÓN “PROPIEDADES”. ELEGIMOS EL COLOR DE FONDO DE LA TABLA, EL TIPO, COLOR Y TAMAÑO DE LETRA CLICK EN CERRAR.

CLICK DERECHO

ELEGIR EL COLOR PARA EL FONDO DEL BUTTON, TAMBIÉN TIPO, COLOR Y TAMAÑO DE LETRA…CERRAR.

ARRASTRAMOS CADA UNO DE LOS PANELES PARA FINALIZAR EL PANEL CON PESTAÑAS

DAMOS CLICK DERECHO Y ELEGIMOS LA OPCION “EDITAR TEXTO”. Tab 1 =“MATRIZ” Tab 2 = “COLUMNA” Tab 3 = “FILA” Tab 4 = “BUSCAR”

Ahora en la barra de “PALETA” le agregamos Cajas de texto (JTextField), Botones (JButton), (jLabel), etc. la cantidad necesaria para crear una matriz tal y como se muestra en la imagen te deberá quedar así:

Para el diseño damos click derecho en “Propiedades” y elegimos color, tipo, y tamaño de letra, color de fondo etc. La imagen tedeberá quedar así:

Para dar nombre a los Button y jTextField, damos click derecho y seleccionamos la opción “Cambiar nombre de Variables”.

Mayor1 Menor2 Columna1 Fila1 Columna2 Fila2

smayorcol mayorcol smenorcol menorcol

smayor smayorfila smenor smenorfila

buscarnum poscol posfil

CODIFICACIÓN:

CÓDIGO
/* * To change this template, choose Tools | Templates * and open thetemplate in the editor. /* * xeymat.java * * Created on 28/10/2011, 12:05:00 PM */ /** *

* @author Casa */ public class xeymat extends javax.swing.JFrame { static double elementos[][]=new double [11][11]; static double suma=0; /** Creates new form xeymat */ public xeymat() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOTmodify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // private void initComponents() { BORRAR = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); tabla = new javax.swing.JTable(); SALIR = new javax.swing.JButton(); GenerarMatriz = new javax.swing.JButton();jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel5 = new javax.swing.JPanel(); VALORMAYOR = new javax.swing.JButton(); VALORMENOR = new javax.swing.JButton(); mayor1 = new javax.swing.JTextField(); menor2 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Matrices Java
  • multiplicar matrices en java
  • Matrices 3x3 java
  • Vectores y Matrices y String En Java
  • Matrices en JAVA
  • Matrices En Java
  • 3 Matrices en Java
  • Matrices c# y java

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS