28/08/2008, 15:55
|
| | Fecha de Ingreso: agosto-2008
Mensajes: 11
Antigüedad: 16 años, 5 meses Puntos: 0 | |
Problema en multiplicación de matrices void jBtnMulti_actionPerformed(ActionEvent e) {
int x,y,xr,yr;
int FA = Integer.parseInt(TxTFA.getText());
int CA = Integer.parseInt(TxTCA.getText());
int FB = Integer.parseInt(TxTFB.getText());
int CB = Integer.parseInt(TxTCB.getText());
if ( (CA == FB) && (FA == CB)) {
MR.setColumnCount(CA);
MR.setRowCount(FB);
for(x=0;x<CA;x++)
for(y=0;y<FB;y++)
{
Integer MAR = new Integer (MA.getValueAt(x,y).toString());
Integer MBR = new Integer (MB.getValueAt(x,y).toString());
Integer Val = new Integer (MAR.intValue() * MBR.intValue());
MR.setValueAt(Val, x, y);
}
}
else
JOptionPane.showMessageDialog(this,"Error en las dimensiones de las matrices","Error",JOptionPane.YES_OPTION);
}
ESE ES MI CÓDIGO DE UNA MULTIPLICACIÓN DE MATRICES... PERO A LA HORA DE EJECULTARLO ME SALEN TODOS ESTOS ERRORES.. ALGUIEN PODRIA AYUDARME
matrices.MatricesApp
java.lang.ArrayIndexOutOfBoundsException: 2 >= 2
at java.util.Vector.elementAt(Vector.java:431)
at javax.swing.table.DefaultTableModel.getValueAt(Def aultTableModel.java:617)
at matrices.Matriz.jBtnMulti_actionPerformed(Matriz.j ava:230)
at matrices.Matriz_jBtnMulti_actionAdapter.actionPerf ormed(Matriz.java:329)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:245)
at java.awt.Component.processMouseEvent(Component.jav a:5100)
at java.awt.Component.processEvent(Component.java:489 7)
at java.awt.Container.processEvent(Container.java:156 9)
at java.awt.Component.dispatchEventImpl(Component.jav a:3615)
at java.awt.Container.dispatchEventImpl(Container.jav a:1627)
at java.awt.Component.dispatchEvent(Component.java:34 77)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3128)
at java.awt.Container.dispatchEventImpl(Container.jav a:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606 )
at java.awt.Component.dispatchEvent(Component.java:34 77)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 456)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:100) |