Foros del Web » Programación para mayores de 30 ;) » Java »

operaciones con matrices en java utilizando interfaz grafica

Estas en el tema de operaciones con matrices en java utilizando interfaz grafica en el foro de Java en Foros del Web. necesito ayuda para hacer un programa que muestre la interfaz grafica de las operaciones con matrices ,el numero de filas y columnas se deben de ...
  #1 (permalink)  
Antiguo 06/07/2010, 10:36
 
Fecha de Ingreso: julio-2010
Mensajes: 3
Antigüedad: 13 años, 9 meses
Puntos: 0
Sonrisa operaciones con matrices en java utilizando interfaz grafica

necesito ayuda para hacer un programa que muestre la interfaz grafica de las operaciones con matrices ,el numero de filas y columnas se deben de dar en la interfaz
  #2 (permalink)  
Antiguo 06/07/2010, 12:06
 
Fecha de Ingreso: abril-2009
Ubicación: EN MI CASA
Mensajes: 15
Antigüedad: 15 años
Puntos: 0
Respuesta: operaciones con matrices en java utilizando interfaz grafica

Trata de espesificar exactamente lo que necesita y asi te podemos ayudar


Saludo....
  #3 (permalink)  
Antiguo 07/07/2010, 12:22
 
Fecha de Ingreso: julio-2010
Mensajes: 3
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: operaciones con matrices en java utilizando interfaz grafica

ya tengo la interfaz grafica lo que no se como hacer son las operaciones este es el codigo

import java.awt.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;


public class Matriz extends JFrame implements ActionListener{
JPanel botones;
JPanel datosA;
JPanel datosB;
JPanel MatrizA;
JPanel MatrizB;
JPanel MatrizR;
JTextField op1=new JTextField(5);
JTextField op2=new JTextField(5);
JTextField op3=new JTextField(5);
JTextField op4=new JTextField(5);
JTextField op5=new JTextField(5);
JTextField op6=new JTextField(5);
JButton cA,cB;
JTextField m[][]=new JTextField [3][3];
JButton botonesOp[];



public Matriz(){

this.setSize(1000,500);
this.setLayout(null);
datosA=new JPanel();
datosA.setBounds(100,100,150,200);
datosA.setBackground(Color.pink);
datosA.setLayout(new FlowLayout());
datosA.add(new JLabel(" Filas "));
datosA.add(op1);

datosA.add(new JLabel("Columnas"));
datosA.add(op2);
cA=new JButton("Crear");
this.datosA.add(cA);
cA.setBounds(100, 50, 100, 30);
cA.addActionListener(this);
datosB=new JPanel();
datosB.setBounds(300,100,150,200);
//datosB.setBackground(Color.pink);
datosB.setLayout(new FlowLayout());
datosB.add(new JLabel("Filas "));
datosB.add(op3);
datosB.add(new JLabel("Columnas"));
datosB.add(op4);

MatrizA=new JPanel();
MatrizA.setBounds(100,200,200,200);
MatrizA.setLayout(null);
MatrizA.setLayout(new FlowLayout());
MatrizA.setBackground(Color.orange);

for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
m[i][j]=new JTextField(5);
m[i][j].setText("0");
this.MatrizA.add(m[i][j]);
}
}
this.add(MatrizA);
this.add(cA);

MatrizB=new JPanel();
MatrizB.setBounds(300,200,200,200);
MatrizB.setLayout(null);
MatrizB.setLayout(new FlowLayout());
MatrizB.setBackground(Color.blue);
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
m[i][j]=new JTextField(5);
m[i][j].setText("0");
this.MatrizB.add(m[i][j]);
}
}
cB=new JButton("Crear");
cB.addActionListener(this);
this.add(MatrizB);
this.add(cB);
cB.setBounds(300, 50, 100, 30);
cB.addActionListener(this);

MatrizR=new JPanel();
MatrizR.setBounds(700,200,200,200);
MatrizR.setLayout(null);
MatrizR.setLayout(new FlowLayout());
MatrizR.setBackground(Color.green);

for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
m[i][j]=new JTextField(5);
m[i][j].setText("0");
this.MatrizR.add(m[i][j]);
}
}

this.add(MatrizR);
botones=new JPanel();
botones.setBounds(525,200,100,200);
botones.setLayout(null);
botones.setLayout(new FlowLayout());
//botones.setBackground(Color.BLUE);


String operaciones[]={"Suma" ,"Multiplicacion","Trasposicion A","Trasposicion B","Salir"};
botonesOp=new JButton[operaciones.length];
for(int i=0;i<operaciones.length;i++){
botonesOp[i]=new JButton(operaciones[i]);
botonesOp[i].setBounds(25,50+i*50,100,40);
botonesOp[i].addActionListener(this);
botones.add(botonesOp[i]);

}
this.add(datosA);
this.add(datosB);
//this.add(MatrizA);
this.add(botones);
this.addWindowListener(new EventosFrame());

this.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
Object fuente=e.getSource();
if(fuente==cA);
MatrizA.removeAll();
String o1,o2;
o1=op1.getText();
o2=op2.getText();
double n1,n2,res;
n1=Double.parseDouble(o1);
n2=Double.parseDouble(o2);

for (int f=0;f<n1;f++){
for(int c=0;c<n2;c++){

this.m[f][c]=new JTextField(5);
this.MatrizA.add(m[f][c]);

System.out.println(e.getSource().toString());
}

}
if(fuente==cB){
MatrizB.removeAll();
String p1,p2;
p1=op3.getText();
p2=op4.getText();
double v1,v2;
v1=Double.parseDouble(p1);
v2=Double.parseDouble(p2);

for (int f=0;f<v1;f++){
for(int c=0;c<v2;c++){

this.m[f][c]=new JTextField(5);
this.MatrizB.add(m[f][c]);

System.out.println(e.getSource().toString());
}

}
}
if(fuente==botonesOp[0]){

}
}


public static void main(String[] args) {
new Matriz();
}


}
LA OPETRACIONES SON SUMA,MULTIPLICACION Y TRASPUESTA
  #4 (permalink)  
Antiguo 07/07/2010, 13:14
 
Fecha de Ingreso: junio-2010
Mensajes: 7
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: operaciones con matrices en java utilizando interfaz grafica

El despliegue q necesita es con aplets?? o se va desplegar en un ambiente web??
  #5 (permalink)  
Antiguo 09/07/2010, 09:18
 
Fecha de Ingreso: julio-2010
Mensajes: 3
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: operaciones con matrices en java utilizando interfaz grafica

no se debe de usar applet

Etiquetas: interfaz, matrices, operaciones, gráficos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:38.