martes, 12 de enero de 2010

Applet

Definición

Un applet es un componente de software que corre en el contexto de otro programa, por ejemplo un navegador web. El applet debe correr en un contenedor, que lo proporciona un programa anfitrión, mediante un Plug-In, o en aplicaciones como teléfonos móviles que soportan el modelo de programación por applets.

A diferencia de un programa, un applet no puede correr de manera independiente, ofrece información gráfica y a veces interactúa con el usuario, típicamente carece de sesión y tiene privilegios de seguridad restringidos. Un applet normalmente lleva a cabo una función muy específica que carece de uso independiente.

Función

Un applet es un componente de una aplicación que se ejecuta en el contexto de otro programa, por ejemplo un navegador web. El applet debe ejecutarse en un contenedor, que lo proporciona un programa anfitrión, mediante un plugin, o en aplicaciones como teléfonos móviles que soportan el modelo de programación por applets.
A diferencia de un programa, un applet no puede ejecutarse de manera independiente, ofrece información gráfica y a veces interactúa con el usuario, típicamente carece de sesión y tiene privilegios de seguridad restringidos. Un applet normalmente lleva a cabo una función muy específica que carece de uso independiente. El término fue introducido en AppleScript en 1993.
Ejemplos comunes de applets son las Java applets y las animaciones Flash. Otro ejemplo es el Windows Media Player utilizado para desplegar archivos de video incrustados en los navegadores como el Internet Explorer. Otros plugins permiten mostrar modelos 3D que funcionan con una applet.

Bibliografía:

http://www.pergaminovirtual.com.ar/definicion/Applet.html
http://es.wikipedia.org/wiki/Applet

Sensores Termometro

Sensor.java

public class Sensor {

private int temp;

public Sensor(){

}

public void setTemp(int v) {
temp = v;
}

public int getTemp(){
return temp;
}

public void leerTemp(){
String aux;
aux = JOptionPane.showInputDialog("La temperatura actual es:");
temp = Integer.parseInt(aux);
}

public static void main(String args[]){
Sensor s = new Sensor();
s.leerTemperatura();
System.out.println("Temperatura actual = "+s.getTemp());
}

}

Termometro.java (Frame)


import javax.swing.*;
import java.awt.*;
import ultimo.Sensor;
import java.text.DecimalFormat.*;

public class Termometro extends JFrame{
public Termometro(){
super("TERMOMETRO");
setSize(300,400);
show();
}

@Override
public void paint(Graphics g){
int x,t,a;
super.paint(g);
g.setColor(Color.red);{
g.drawOval(80, 150, 150, 150);

}
g.setColor(Color.black);
g.drawString("0 ºC", 80, 300);
g.drawString("Caliente", 200, 300);
g.drawString("¡¡Cuidado con la temperatura¡¡", 100, 90);
g.drawOval(150, 100, 20, 20);
g.setColor(Color.white);
g.fillOval(80, 150, 150, 150);

g.setColor(Color.black);{
g.drawLine(300, 0, 300, 400);
g.drawString("TERMOMETRO",110 , 50);
}

Sen s = new Sen();
s.leerTemp();
if (s.getTemp()>0 & s.getTemp()< 60){
g.setColor(Color.yellow);
x=320-s.getTemp();
g.fillArc(80,150,150,150,225,-(320-x));
g.setColor(Color.orange);
g.drawString(s.getTemp()+"ºC", 150,220);

g.setColor(Color.yellow);
g.fillOval(150, 100, 20, 20);

}
if(s.getTemperatura()>=60 & s.getTemperatura()<100){
g.setColor(Color.orange);
x=315-s.getTemperatura();
g.fillArc(80,150,150,150,225,-(320-x));

g.setColor(Color.BLACK);
g.drawString(s.getTemperatura()+" ºC", 150, 220);
t=(s.getTemperatura()*100)/280;
a=(t*360)/100;

g.setColor(Color.orange);
g.fillOval(150, 100, 20, 20);
}

if(s.getTemperatura()>=100 & s.getTemperatura()<=280){
g.setColor(Color.RED);
x=315-s.getTemperatura();
g.fillArc(80, 150,150,150,225,-(320-x));
g.setColor(Color.BLACK);
g.drawString(s.getTemperatura()+" ºC",150, 220);

t=(s.getTemperatura()*100)/280;
a=(t*360)/100;

g.setColor(Color.RED);
g.fillOval(150, 100, 20, 20);
}
}
public static void main(String args[]){
Termometro vel = new Termometro();
vel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

Frame que indica la velocidad lineal de un automóvil

Sensor. java

package ultimo;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Sensor {

private int velocidad;

public Sensor(){
}
public void setVel(int v) {
velocidad = v;
}
public int getVel(){
return velocidad;
}
public void leerVel(){
String aux;
aux = JOptionPane.showInputDialog("Velocidad que lleva su vehiculo");
velocidad = Integer.parseInt(aux);
}

public static void main(String args[]){
Sensor s = new Sensor();
s.leerVel();
System.out.println("Velocidad = "+s.getVel());
}
}

Velocimetro.java (Frame)

import javax.swing.*;
import java.awt.*;
import ultimo.Sensor;
import java.text.DecimalFormat.*;

public class Velocimetro extends JFrame{
public Velocimetro(){
super("Sensor de control de velocidad");
setSize(300,500);
show();
}

public void paint(Graphics g){
int r,p,y;
super.paint(g);
g.setColor(Color.BLUE);{
g.drawRect(80, 150, 30, 150);
g.drawOval(370, 150, 150, 150);
}
g.setColor(Color.BLUE);{
g.drawString("0 Km/h", 80, 320);
g.drawString("280 km/h", 80, 140);
g.drawString("Maneje con cuidado su velocidad es de:", 140, 90);
}
g.setColor(Color.white);{
g.fillOval(370, 150, 150, 150);
g.fillRect(80, 150, 30, 150);
}
g.setColor(Color.BLUE);{
g.drawLine(300, 0, 300, 400);
g.drawString("Sensor lineal de velocidad",60 , 50);
g.drawString("Sensor de control de velocidad", 370, 50);
g.drawString("Pastel ", 370,70);
}


Sensor s = new Sensor();
s.leerVelocidad();
if (s.getVelocidad()>0 & s.getVelocidad()<= 80){
g.setColor(Color.gray);
g.fillRect(80, 300-s.getVelocidad(), 30, s.getVelocidad());
g.setColor(Color.blue);
g.drawString(s.getVelocidad()+" km/h", 150,220);
r=315-s.getVelocidad();
p=((s.getVelocidad()*100)/280);
g.setColor(Color.black);
g.fillArc(370,150,150,150,225,-(320-r));
g.setColor(Color.blue);
g.drawString(p+"%", 430, 220);
g.setColor(Color.yellow);
g.fillOval(150, 100, 20, 20);
}
if(s.getVelocidad()>80& s.getVelocidad()<=160){
g.setColor(Color.orange);
g.fillRect(80, 150, s.getVelocidad(), -(150-s.getVelocidad()));
g.setColor(Color.blue);
g.drawString(s.getVelocidad()+" Km/h", 150, 220);
r=315-s.getVelocidad();
p=((s.getVelocidad()*100)/280);
g.setColor(Color.green);
g.fillArc(370,150,150,150,225,-(320-r));
g.setColor(Color.blue);
g.drawString(p+"%", 430, 220);
g.setColor(Color.cyan);
g.fillOval(150, 100, 20, 20);
}
if(s.getVelocidad()>160& s.getVelocidad()<=280){
g.setColor(Color.cyan);
g.fillRect(80, 150, 30, 150-s.getVelocidad());
g.setColor(Color.blue);
g.drawString(s.getVelocidad()+" Km/h",150, 220);
r=315-s.getVelocidad();
p=((s.getVelocidad()*100)/280);
g.setColor(Color.yellow);
g.fillArc(370,150,150,150,225,-(420-r));
g.setColor(Color.blue);
g.drawString(p+"%", 430, 220);
g.setColor(Color.RED);
g.fillOval(150, 100, 20, 20);
}
}
public static void main(String args[]){
Velocimemetro velocidad = new Velocimetro();
velocidad.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

Características principales de la librería AWT, SWING

Abstract Windows Toolkit (AWT) es el original juego de herramientas
de Java. Sus principales ventajas son que viene con cada versión de la tecnología Java, incluyendo aplicaciones de Java en navegadores web antiguos, y es muy estable.
AWT es un conjunto de herramientas muy simples con pocos componentes
con administradores de diseño, y eventos. Esto se debe a que Sun Microsystems decidió utilizar un mínimo común denominador (LCD) para un enfoque AWT.

El contenido de AWT:

Object
CheckboxGroup
Component
Button
Canvas
CheckBox
Choice
Container
Panel
Applet
ScrollPane
Window
Dialog
Frame
Label
List
TextComponent
TextArea
TextField
MenuComponent
MenuItem
CheckboxMenuItem
Menu
PopupMenu
LayoutManager
FlowLayout
GridLayout
LayoutManager2
BorderLayout
CardLayout
GridBagLayout
EventObject
AWTEvent
ActionEvent
AdjustmentEvent
ComponentEvent
ContainerEvent
FocusEvent
InputEvent
KeyEvent
MouseEvent
MouseWheelEvent
PaintEvent
WindowEvent
HierarchyEvent
InputMethodEvent
InvocationEvent
ItemEvent
TextEvent

SWING

Swing de Java, también conocido como parte de la Java Foundation Classes (JFC), fue un intento de resolver la mayor parte de las deficiencias de AWT. En Swing, Sun creó un muy bien diseñado, flexible y potente conjunto de herramientas
. Desafortunadamente, esto significa que Swing necesita tiempo para aprender, y es a veces demasiado complejo para situaciones comunes.

Swing está construido sobre las partes de AWT. Todas las partes de Swing son también parte de AWT. Swing utiliza el modelo AWT de evento y clases de apoyo, tales como colores, imágenes y gráficos. Los componentes Swing, los administradores de diseño, y los acontecimientos se resumen a continuación.

Object
Component
Container
JComponent
AbstractButton
JButton
JMenuItem
JCheckBonMenuItem
JMenu
JRadioButonMenuItem
JToggleButton
JCheckBox
JRadioButton
Box
Filler
JColorChooser
JComboBox
JDesktopIcon
JFileChooser
JInternalFrame
JLabel
JLayeredPane
JDesktopPane
JList
JMenuBar
JOptionPane
JPanel
JPopupMenu
JProgressBar
JRootPane
JScrollBar
JScrollPane
JSeparator
JSlider
JSplitPane
JTabbedPane
JTable
JTableHeader
JTextComponent
JEditorPane
FrameEditorPane
JTextPane
JTextArea
JtextField
JPasswordField
JToolBar
JToolTip
JTree
JViewport
ScrollableTabViewpot
Panel
Applet
JApplet
Window
Dialog
JDialog
Frame
JFrame
JWindow
*Layoutmanager
CenterLayout
LayoutManager2
BoxLayout
OverlayLayout
SpringLayout
EventObject
AWTEvent
AncestorEvent
ComponentEvent
InputEvent
KeyEvent
MenuKeyEvent
MouseEvent
MenuDragMouseEvent
InternalFrameEvent

Bibliográfica:

http://loshijosdeden.blogspot.com/2009/03/librerias-api-de-java-awt-abstract.html
http://es.wikipedia.org/wiki/Java_SE#java.awt

Applet para operaciones con matrices

Main.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package trabajo;

/**
*
* @author usuario
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}

}

Matriz.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author usuario
*/

import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Matriz {

public int numerofilas;
public int numerocolumnas;
public double [][]matriz;

public Matriz(){
}

public Matriz(int nf, int nc){

numerofilas=nf;
numerocolumnas=nc;
matriz=new double[numerofilas][numerocolumnas];
for(int i=0;i < numerofilas;i++)
for(int j=0; j < numerocolumnas; j++)
matriz [i][j]=0;
}

public Matriz suma(Matriz b){
Matriz resultado;
if((this.numerofilas == b.numerofilas)&& (this.numerocolumnas == b.numerocolumnas)){
resultado = new Matriz(this.numerofilas, this.numerocolumnas);
for(int i=0; i < this.numerofilas; i++)
for(int j=0; j < this.numerocolumnas; j++)
resultado.matriz[i][j] = this.matriz[i][j]+ b.matriz[i][j];
return resultado;
}
else
System.out.println("Error en dimensiones de las matrices");
resultado=null;
return resultado;
}

public Matriz resta(Matriz b){
Matriz resultado;
if ((this.numerofilas == b.numerofilas)&(this.numerofilas == b.numerocolumnas)){
resultado = new Matriz (this.numerofilas,this.numerocolumnas);
for(int i = 0;i < this.numerofilas;i++)
for(int j=0;j < this.numerocolumnas;j++)
resultado.matriz[i][j] = this.matriz[i][j]-b.matriz[i][j];
return resultado;
}

else{
System.out.println("Error en dimensiones de las matrices");
resultado=null;
return resultado;
}
}

public Matriz Transpuesta(){
Matriz resultado;
resultado=new Matriz(this.numerocolumnas,this.numerofilas);
for(int i=0; i < this.numerofilas; i++)
for(int j=0; j < this.numerocolumnas; j++)
resultado.matriz[j][i]=this.matriz[i][j];
return resultado;
}

public Matriz determinantes(){
Matriz resultado;
resultado=new Matriz(this.numerocolumnas,this.numerofilas);
for(int i=0; i < this.numerofilas; i++)
for(int j=0; j < this.numerocolumnas; j++)
resultado.matriz[i][j] = this.matriz[i][j+1]-this.matriz[i+1][j];
return resultado;
}

public Matriz Multiplicacion(Matriz b){
Matriz resultado;
if(this.numerocolumnas==b.numerofilas){
resultado=new Matriz(this.numerofilas, b.numerocolumnas);
for(int i=0; i < this.numerofilas; i++){
for(int j=0; j < b.numerocolumnas; j++){
for(int k=0; k < this.numerocolumnas; k++)
resultado.matriz[i][j]+=this.matriz[i][k]*b.matriz[k][j];
}
}
return resultado;
}
else
System.out.println("Error en dimensiones de las matrices");
resultado=null;
return resultado;
}

public Matriz inversa()
{
Matriz resultado = new Matriz ();
resultado.matriz[0][0]=((this.matriz[1][1]*this.matriz[2][2])-(this.matriz[2][1]*this.matriz[1][2]));
resultado.matriz[0][1]=((this.matriz[1][0]*this.matriz[2][2])-(this.matriz[2][0]*this.matriz[1][2]));
resultado.matriz[0][2]=((this.matriz[1][0]*this.matriz[2][1])-(this.matriz[2][0]*this.matriz[1][1]));
resultado.matriz[1][0]=((this.matriz[0][1]*this.matriz[2][2])-(this.matriz[2][1]*this.matriz[0][2]));
resultado.matriz[1][1]=((this.matriz[1][0]*this.matriz[2][2])-(this.matriz[2][0]*this.matriz[1][2]));
resultado.matriz[1][2]=((this.matriz[0][0]*this.matriz[2][1])-(this.matriz[2][0]*this.matriz[0][1]));
resultado.matriz[2][0]=((this.matriz[0][1]*this.matriz[1][2])-(this.matriz[1][1]*this.matriz[0][2]));
resultado.matriz[2][1]=((this.matriz[0][0]*this.matriz[1][2])-(this.matriz[1][0]*this.matriz[0][2]));
resultado.matriz[2][2]=((this.matriz[0][0]*this.matriz[1][1])-(this.matriz[1][0]*this.matriz[0][1]));
return resultado;
}

public void leer(){
String aux;
for(int i=0; i < this.numerofilas; i++){
for(int j=0; j < this.numerocolumnas; j++){
aux = JOptionPane.showInputDialog(null,"Valores de la Matriz"+(i+1)+","+(j+1),JOptionPane.DEFAULT_OPTION);
this.matriz[i][j]=Double.parseDouble(aux);
}
}
}

public String toString(){

String aux="\n";
DecimalFormat df = new DecimalFormat("0.0000");
for(int i=0; i < numerofilas; i++){
for(int j=0; j < numerocolumnas; j++){
aux+=df.format(matriz[i][j])+" ";
}
aux+="\n";
}
aux+=" ";
return aux;
}
}

OperacionesMatrices.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* OperacionesMatrices.java
*
* Created on 12-ene-2010, 19:29:29
*/

/**
*
* @author usuario
*/
public class OperacionesMatrices extends javax.swing.JApplet {

/** Initializes the applet OperacionesMatrices */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}

/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();
jInternalFrame1 = new javax.swing.JInternalFrame();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jSeparator2 = new javax.swing.JSeparator();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea3 = new javax.swing.JTextArea();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();

jInternalFrame1.setVisible(true);

jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14));
jLabel1.setForeground(new java.awt.Color(0, 0, 255));
jLabel1.setText("Primera Matriz");

jLabel2.setText("Numero de Filas");

jLabel3.setText("Numero de Columnas");

jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14));
jLabel4.setForeground(new java.awt.Color(0, 0, 255));
jLabel4.setText("Segunda Matriz");

jLabel5.setText("Numero de Filas");

jLabel6.setText("Numero de Columnas");

jTextArea2.setColumns(20);
jTextArea2.setRows(5);
jScrollPane3.setViewportView(jTextArea2);

jButton1.setText("Suma");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setText("Multiplicación");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setText("Resta");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14));
jLabel7.setForeground(new java.awt.Color(0, 0, 255));
jLabel7.setText("Matriz");

jLabel8.setText("Numero de Filas");

jLabel9.setText("Numero de Columnas");

jTextArea3.setColumns(20);
jTextArea3.setRows(5);
jScrollPane4.setViewportView(jTextArea3);

jButton4.setText("Traspuesta");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});

jButton5.setText("Inversa");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});

jButton6.setText("Limpiar");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});

jButton7.setText("Limpiar");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});

jButton8.setText("Determinante");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(jLabel6)
.addComponent(jLabel5))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField4)
.addComponent(jTextField3)
.addComponent(jTextField2)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)))
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3))
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
.addComponent(jButton6)
.addGap(59, 59, 59))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField6))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(36, 36, 36)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(57, 57, 57)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(36, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(65, 65, 65)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6))))
.addGap(35, 35, 35)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton7))
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(32, Short.MAX_VALUE))
);

javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(186, 186, 186))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(335, 335, 335)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);

jScrollPane1.setViewportView(jInternalFrame1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
}//


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField1.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField2.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
aux = jTextField3.getText();
nf = Integer.parseInt(aux);
aux = jTextField4.getText();
nc = Integer.parseInt(aux);
m2 = new Matriz(nf,nc);
m2.leer();
aux1 += m2.toString();
jTextArea2.setText(aux1+(m1.suma(m2)).toString());
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

String aux = jTextField1.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField2.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
aux = jTextField3.getText();
nf = Integer.parseInt(aux);
aux = jTextField4.getText();
nc = Integer.parseInt(aux);
m2 = new Matriz(nf,nc);
m2.leer();
aux1 += m2.toString();
jTextArea2.setText(aux1+(m1.resta(m2)).toString());

}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField1.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField2.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
aux = jTextField3.getText();
nf = Integer.parseInt(aux);
aux = jTextField4.getText();
nc = Integer.parseInt(aux);
m2 = new Matriz(nf,nc);
m2.leer();
aux1 += m2.toString();
jTextArea2.setText(aux1+(m1.Multiplicacion(m2)).toString());
}

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField5.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField6.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
jTextArea3.setText(aux1+(m1.Transpuesta()).toString());
}

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

String aux = jTextField5.getText();
String aux1="";
int nF = Integer.parseInt(aux);
aux = jTextField6.getText();
int nC = Integer.parseInt(aux);
m1 = new Matriz(nF,nC);
m1.leer();
aux1 += m1.toString();
jTextArea3.setText(aux1+(m1.inversa()).toString());
}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField5.getText();
jTextArea2.setText("");
}

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField5.getText();
jTextArea3.setText("");
}

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

String aux = jTextField5.getText();
String aux1="";
int nF = Integer.parseInt(aux);
aux = jTextField6.getText();
int nC = Integer.parseInt(aux);
m1 = new Matriz(nF,nC);
m1.leer();
aux1 += m1.toString();
jTextArea3.setText(aux1+(m1.determinantes()).toString());


}
public Matriz m1;
public Matriz m2;
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextArea jTextArea3;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
// End of variables declaration

}

Operaciones con Matrices

Main.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package trabajo;

/**
*
* @author usuario
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}

}

Matriz.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author usuario
*/

import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Matriz {

public int numerofilas;
public int numerocolumnas;
public double [][]matriz;

public Matriz(){
}

public Matriz(int nf, int nc){

numerofilas=nf;
numerocolumnas=nc;
matriz=new double[numerofilas][numerocolumnas];
for(int i=0;i < numerofilas;i++)
for(int j=0; j < numerocolumnas; j++)
matriz [i][j]=0;
}

public Matriz suma(Matriz b){
Matriz resultado;
if((this.numerofilas == b.numerofilas)&& (this.numerocolumnas == b.numerocolumnas)){
resultado = new Matriz(this.numerofilas, this.numerocolumnas);
for(int i=0; i < this.numerofilas; i++)
for(int j=0; j < this.numerocolumnas; j++)
resultado.matriz[i][j] = this.matriz[i][j]+ b.matriz[i][j];
return resultado;
}
else
System.out.println("Error en dimensiones de las matrices");
resultado=null;
return resultado;
}

public Matriz resta(Matriz b){
Matriz resultado;
if ((this.numerofilas == b.numerofilas)&(this.numerofilas == b.numerocolumnas)){
resultado = new Matriz (this.numerofilas,this.numerocolumnas);
for(int i = 0;i < this.numerofilas;i++)
for(int j=0;j < this.numerocolumnas;j++)
resultado.matriz[i][j] = this.matriz[i][j]-b.matriz[i][j];
return resultado;
}

else{
System.out.println("Error en dimensiones de las matrices");
resultado=null;
return resultado;
}
}

public Matriz Transpuesta(){
Matriz resultado;
resultado=new Matriz(this.numerocolumnas,this.numerofilas);
for(int i=0; i < this.numerofilas; i++)
for(int j=0; j < this.numerocolumnas; j++)
resultado.matriz[j][i]=this.matriz[i][j];
return resultado;
}

public Matriz Multiplicacion(Matriz b){
Matriz resultado;
if(this.numerocolumnas==b.numerofilas){
resultado=new Matriz(this.numerofilas, b.numerocolumnas);
for(int i=0; i < this.numerofilas; i++){
for(int j=0; j < b.numerocolumnas; j++){
for(int k=0; k < this.numerocolumnas; k++)
resultado.matriz[i][j]+=this.matriz[i][k]*b.matriz[k][j];
}
}
return resultado;
}
else
System.out.println("Error en dimensiones de las matrices");
resultado=null;
return resultado;
}

public Matriz inversa()
{
Matriz resultado = new Matriz ();
resultado.matriz[0][0]=((this.matriz[1][1]*this.matriz[2][2])-(this.matriz[2][1]*this.matriz[1][2]));
resultado.matriz[0][1]=((this.matriz[1][0]*this.matriz[2][2])-(this.matriz[2][0]*this.matriz[1][2]));
resultado.matriz[0][2]=((this.matriz[1][0]*this.matriz[2][1])-(this.matriz[2][0]*this.matriz[1][1]));
resultado.matriz[1][0]=((this.matriz[0][1]*this.matriz[2][2])-(this.matriz[2][1]*this.matriz[0][2]));
resultado.matriz[1][1]=((this.matriz[1][0]*this.matriz[2][2])-(this.matriz[2][0]*this.matriz[1][2]));
resultado.matriz[1][2]=((this.matriz[0][0]*this.matriz[2][1])-(this.matriz[2][0]*this.matriz[0][1]));
resultado.matriz[2][0]=((this.matriz[0][1]*this.matriz[1][2])-(this.matriz[1][1]*this.matriz[0][2]));
resultado.matriz[2][1]=((this.matriz[0][0]*this.matriz[1][2])-(this.matriz[1][0]*this.matriz[0][2]));
resultado.matriz[2][2]=((this.matriz[0][0]*this.matriz[1][1])-(this.matriz[1][0]*this.matriz[0][1]));
return resultado;
}

public void leer(){
String aux;
for(int i=0; i < this.numerofilas; i++){
for(int j=0; j < this.numerocolumnas; j++){
aux = JOptionPane.showInputDialog(null,"Valores de la Matriz"+(i+1)+","+(j+1),JOptionPane.DEFAULT_OPTION);
this.matriz[i][j]=Double.parseDouble(aux);
}
}
}

public String toString(){

String aux="\n";
DecimalFormat df = new DecimalFormat("0.0000");
for(int i=0; i < numerofilas; i++){
for(int j=0; j < numerocolumnas; j++){
aux+=df.format(matriz[i][j])+" ";
}
aux+="\n";
}
aux+=" ";
return aux;
}
}

OperacionesMatriz.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* OperacionesMatrices.java
*
* Created on 12-ene-2010, 19:29:29
*/

/**
*
* @author usuario
*/
public class OperacionesMatrices extends javax.swing.JApplet {

/** Initializes the applet OperacionesMatrices */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}

/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();
jInternalFrame1 = new javax.swing.JInternalFrame();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jSeparator2 = new javax.swing.JSeparator();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea3 = new javax.swing.JTextArea();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();

jInternalFrame1.setVisible(true);

jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel1.setForeground(new java.awt.Color(0, 0, 255));
jLabel1.setText("Primera Matriz");

jLabel2.setText("Numero de Filas");

jLabel3.setText("Numero de Columnas");

jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(0, 0, 255));
jLabel4.setText("Segunda Matriz");

jLabel5.setText("Numero de Filas");

jLabel6.setText("Numero de Columnas");

jTextArea2.setColumns(20);
jTextArea2.setRows(5);
jScrollPane3.setViewportView(jTextArea2);

jButton1.setText("Suma");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setText("Multiplicación");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setText("Resta");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setForeground(new java.awt.Color(0, 0, 255));
jLabel7.setText("Matriz");

jLabel8.setText("Numero de Filas");

jLabel9.setText("Numero de Columnas");

jTextArea3.setColumns(20);
jTextArea3.setRows(5);
jScrollPane4.setViewportView(jTextArea3);

jButton4.setText("Traspuesta");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});

jButton5.setText("Inversa");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});

jButton6.setText("Limpiar");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});

jButton7.setText("Limpiar");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(jLabel6)
.addComponent(jLabel5))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField4)
.addComponent(jTextField3)
.addComponent(jTextField2)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)))
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3))
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
.addComponent(jButton6)
.addGap(59, 59, 59))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField6))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(36, 36, 36)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(57, 57, 57)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(46, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(65, 65, 65)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6))))
.addGap(35, 35, 35)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton7))
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(24, Short.MAX_VALUE))
);

javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(186, 186, 186))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(335, 335, 335)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);

jScrollPane1.setViewportView(jInternalFrame1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
}//


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField1.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField2.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
aux = jTextField3.getText();
nf = Integer.parseInt(aux);
aux = jTextField4.getText();
nc = Integer.parseInt(aux);
m2 = new Matriz(nf,nc);
m2.leer();
aux1 += m2.toString();
jTextArea2.setText(aux1+(m1.suma(m2)).toString());
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

String aux = jTextField1.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField2.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
aux = jTextField3.getText();
nf = Integer.parseInt(aux);
aux = jTextField4.getText();
nc = Integer.parseInt(aux);
m2 = new Matriz(nf,nc);
m2.leer();
aux1 += m2.toString();
jTextArea2.setText(aux1+(m1.resta(m2)).toString());

}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField1.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField2.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
aux = jTextField3.getText();
nf = Integer.parseInt(aux);
aux = jTextField4.getText();
nc = Integer.parseInt(aux);
m2 = new Matriz(nf,nc);
m2.leer();
aux1 += m2.toString();
jTextArea2.setText(aux1+(m1.Multiplicacion(m2)).toString());
}

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField5.getText();
String aux1="";
int nf = Integer.parseInt(aux);
aux = jTextField6.getText();
int nc = Integer.parseInt(aux);
m1 = new Matriz(nf,nc);
m1.leer();
aux1 += m1.toString();
jTextArea3.setText(aux1+(m1.Transpuesta()).toString());
}

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

String aux = jTextField5.getText();
String aux1="";
int nF = Integer.parseInt(aux);
aux = jTextField6.getText();
int nC = Integer.parseInt(aux);
m1 = new Matriz(nF,nC);
m1.leer();
aux1 += m1.toString();
jTextArea3.setText(aux1+(m1.inversa()).toString());
}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField5.getText();
jTextArea2.setText("");
}

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux = jTextField5.getText();
jTextArea3.setText("");
}
public Matriz m1;
public Matriz m2;
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextArea jTextArea3;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
// End of variables declaration

}

Calculadora en java

Main. java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package trabajo;

/**
*
* @author program
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}

}

Operaciones.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author program
*/
public class Operaciones {

static double resultado;
public Operaciones(){
resultado = 0;
}

public static double seno(double x){
resultado = Math.sin(x);
return resultado;
}

public static double coseno(double x){
resultado = Math.cos(x);
return resultado;
}

public static double tangente(double x){
resultado = Math.tan(x);
return resultado;
}

public static double logaritmo(double x){
if(x==0){
System.out.println("ERROR");
resultado = 0;
}else{
resultado = Math.log(x);
}
return resultado;
}

public static double raiz(double x){
if(x>=0){
resultado = Math.sqrt(x);
}else{
System.out.println("ERROR");
resultado = 0;
}
return resultado;

}

public static double suma(double x, double y){

resultado = x+y;
return resultado;
}

public static double resta(double x, double y){

resultado = x-y;
return resultado;
}

public static double multiplicacion(double x, double y){
resultado = x*y;
return resultado;
}

public static double division(double x, double y){
resultado = x/y;
return resultado;
}

}

Calculadora. java (Applet)

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* Calculadora.java
*
* Created on 12-ene-2010, 16:23:35
*/

/**
*
* @author program
*/
public class Calculadora extends javax.swing.JApplet {

/** Initializes the applet Calculadora */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}

/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jInternalFrame1 = new javax.swing.JInternalFrame();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jButton11 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jButton13 = new javax.swing.JButton();
jButton15 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jButton16 = new javax.swing.JButton();
jButton17 = new javax.swing.JButton();
jButton18 = new javax.swing.JButton();
jButton19 = new javax.swing.JButton();
jButton20 = new javax.swing.JButton();
jButton21 = new javax.swing.JButton();
jButton22 = new javax.swing.JButton();

jInternalFrame1.setVisible(true);

javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 512, Short.MAX_VALUE)
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);

jButton1.setText("7");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setText("4");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setText("1");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jButton4.setText("8");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});

jButton5.setText("5");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});

jButton6.setText("2");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});

jButton7.setText("9");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});

jButton8.setText("6");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});

jButton9.setText("3");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});

jButton10.setText("0");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});

jButton11.setText(".");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});

jButton12.setText("+");
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});

jButton13.setText("-");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});

jButton15.setText("/");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});

jButton14.setText("*");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});

jButton16.setText("Sen");
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});

jButton17.setText("Cos");
jButton17.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton17ActionPerformed(evt);
}
});

jButton18.setText("Tan");
jButton18.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton18ActionPerformed(evt);
}
});

jButton19.setText("Log");
jButton19.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton19ActionPerformed(evt);
}
});

jButton20.setText("Raiz");
jButton20.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton20ActionPerformed(evt);
}
});

jButton21.setText("Exp");
jButton21.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton21ActionPerformed(evt);
}
});

jButton22.setText("CE");
jButton22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton22ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jInternalFrame1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE)
.addGap(10, 10, 10))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6))
.addComponent(jButton10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton14, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
.addComponent(jButton15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton12)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(126, 126, 126))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton4)
.addComponent(jButton7)
.addComponent(jButton12)
.addComponent(jButton16)
.addComponent(jButton20))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton5)
.addComponent(jButton8)
.addComponent(jButton13)
.addComponent(jButton17)
.addComponent(jButton21))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton6)
.addComponent(jButton9)
.addComponent(jButton14)
.addComponent(jButton18)
.addComponent(jButton22))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton10)
.addComponent(jButton11)
.addComponent(jButton15)
.addComponent(jButton19))
.addContainerGap(104, Short.MAX_VALUE))
);

jScrollPane1.setViewportView(jPanel1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
}//


private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
aux += ".";
jTextField1.setText(aux);
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "7";
jTextField1.setText(aux);
}
else{
aux += 7;
jTextField1.setText(aux);
}


}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

if(aux =="0")
{
aux= "4";
jTextField1.setText(aux);
}
else{
aux += 4;
jTextField1.setText(aux);
}

}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "1";
jTextField1.setText(aux);
}
else{
aux += 1;
jTextField1.setText(aux);
}
}

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "8";
jTextField1.setText(aux);
}
else{
aux += 8;
jTextField1.setText(aux);
}
}

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "5";
jTextField1.setText(aux);
}
else{
aux += 5;
jTextField1.setText(aux);
}
}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "2";
jTextField1.setText(aux);
}
else{
aux += 2;
jTextField1.setText(aux);
}
}

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "9";
jTextField1.setText(aux);
}
else{
aux += 9;
jTextField1.setText(aux);
}
}

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "6";
jTextField1.setText(aux);
}
else{
aux += 6;
jTextField1.setText(aux);
}
}

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "3";
jTextField1.setText(aux);
}
else{
aux += 3;
jTextField1.setText(aux);
}

}

private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "0";
jTextField1.setText(aux);
}
else{
aux += 0;
jTextField1.setText(aux);
}
}

private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.suma(x, y)));
aux = "";


}

private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.resta(x, y)));
aux = "";
}

private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.multiplicacion(x, y)));
aux = "";
}

private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.division(x, y)));
aux = "";
}

private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.seno(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.coseno(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.tangente(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.logaritmo(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.raiz(r);
aux = "";
jTextField1.setText(aux + r);

}

private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.raiz(r);
aux = "";
jTextField1.setText(aux + r);

}

private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
aux = "0";
jTextField1.setText(aux);
}
public String aux="";
public String aux2="";

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton17;
private javax.swing.JButton jButton18;
private javax.swing.JButton jButton19;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton20;
private javax.swing.JButton jButton21;
private javax.swing.JButton jButton22;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTextField1;
// End of variables declaration

}