Instituto Tecnológico Superior
De
Felipe Carrillo Puerto

Tópicos avanzados de programación
Unidad 1
INFORME TÉCNICO
MTI. ...
INFORME TECNICO
CALCULADORA
importjavax.swing.JTextField;
public class CAL extendsjavax.swing.JFrame {
public CAL() {
init...
jTextField1ActionPerformed(evt);
}
});

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField3.se...
jButton5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jButton5.setText("*");
jButton5.addActionListener(new java...
}
});

jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jButton3.setText("^2");
jButton3.addActionListener(...
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(56,...
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(j...
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING...
jTextField3.setText(String.valueOf(r));

}

privatevoid jTextField3ActionPerformed(java.awt.event.ActionEventevt) {
double...
}

privatevoid jButton7ActionPerformed(java.awt.event.ActionEventevt) {
double c,d,r3;

c=Double.parseDouble(jTextField1.g...
jTextField3.setText(String.valueOf(r5));
}

privatevoid jButton3ActionPerformed(java.awt.event.ActionEventevt) {
double c3...
jTextField1.setText(String.valueOf(""));
jTextField2.setText(String.valueOf(""));
jTextField3.setText(String.valueOf(""));...
privatevoiddelete(JTextField jTextField1) {
throw new UnsupportedOperationException("Not supportedyet."); //To changebody ...
* WARNING: Do NOT modifythiscode. The content of thismethod is always
* regeneratedby the Form Editor.
*/
@SuppressWarning...
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.Gro...
}

privatevoid jButton1ActionPerformed(java.awt.event.ActionEventevt) {
jTextField1.setText("hola");
}

/**
* @paramargs t...
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Le...
Informe técnico de tópicos avanzados de programación
Upcoming SlideShare
Loading in …5
×

Informe técnico de tópicos avanzados de programación

299 views

Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

Informe técnico de tópicos avanzados de programación

  1. 1. Instituto Tecnológico Superior De Felipe Carrillo Puerto Tópicos avanzados de programación Unidad 1 INFORME TÉCNICO MTI. Niels Henryk Aranda Cueva Alumno: HUGO ARMANDO CHUC OY 4-A J-3 ISC Felipe Carrillo Puerto a 05/03/2014
  2. 2. INFORME TECNICO CALCULADORA importjavax.swing.JTextField; public class CAL extendsjavax.swing.JFrame { public CAL() { initComponents(); } @SuppressWarnings("unchecked") // <editor-folddefaultstate="collapsed" desc="GeneratedCode"> privatevoidinitComponents() { jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jTextField1.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) {
  3. 3. jTextField1ActionPerformed(evt); } }); jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jTextField3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jTextField3.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jTextField3ActionPerformed(evt); } }); jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton1.setText("+"); jButton1.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton2.setText("-"); jButton2.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton2ActionPerformed(evt); } });
  4. 4. jButton5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton5.setText("*"); jButton5.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton5ActionPerformed(evt); } }); jButton6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton6.setText("/"); jButton6.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton6ActionPerformed(evt); } }); jButton7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton7.setText("%"); jButton7.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton7ActionPerformed(evt); } }); jButton8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton8.setText("RAIZ"); jButton8.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton8ActionPerformed(evt);
  5. 5. } }); jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton3.setText("^2"); jButton3.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton3ActionPerformed(evt); } }); jButton4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton4.setText("^3"); jButton4.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton4ActionPerformed(evt); } }); jButton9.setText("c"); jButton9.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton9ActionPerformed(evt); } }); javax.swing.GroupLayoutlayout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(
  6. 6. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(56, 56, 56) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(layout.createSequentialGroup() .addComponent(jButton9) .addGap(76, 76, 76)))
  7. 7. .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE) .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField3, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
  8. 8. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton9) .addGap(31, 31, 31))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton4) .addComponent(jButton6) .addComponent(jButton1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton7) .addComponent(jButton2) .addComponent(jButton8) .addComponent(jButton5)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold> privatevoid jButton2ActionPerformed(java.awt.event.ActionEventevt) { double n1,n2,r; n1=Double.parseDouble(jTextField1.getText()); n2=Double.parseDouble(jTextField2.getText()); r=n1-n2;
  9. 9. jTextField3.setText(String.valueOf(r)); } privatevoid jTextField3ActionPerformed(java.awt.event.ActionEventevt) { double n1,n2,r; n1=Double.parseDouble(jTextField1.getText()); n2=Double.parseDouble(jTextField2.getText()); r=n1-n2; jTextField3.setText(String.valueOf(r)); } privatevoid jButton1ActionPerformed(java.awt.event.ActionEventevt) { double n,m,r1; n=Double.parseDouble(jTextField1.getText()); m=Double.parseDouble(jTextField2.getText()); r1=n+m; jTextField3.setText(String.valueOf(r1)); } privatevoid jButton6ActionPerformed(java.awt.event.ActionEventevt) { double a,b,r2; a=Double.parseDouble(jTextField1.getText()); b=Double.parseDouble(jTextField2.getText()); r2=a/b; jTextField3.setText(String.valueOf(r2));
  10. 10. } privatevoid jButton7ActionPerformed(java.awt.event.ActionEventevt) { double c,d,r3; c=Double.parseDouble(jTextField1.getText()); d=Double.parseDouble(jTextField2.getText()); r3=((c*d)/100); jTextField3.setText(String.valueOf(r3)); } privatevoid jButton5ActionPerformed(java.awt.event.ActionEventevt) { double x,y,r4; x=Double.parseDouble(jTextField1.getText()); y=Double.parseDouble(jTextField2.getText()); r4=(x*y); jTextField3.setText(String.valueOf(r4)); } privatevoid jButton8ActionPerformed(java.awt.event.ActionEventevt) { double c1,d1,r5; c1=Double.parseDouble(jTextField1.getText()); r5=(c1*(1/4));
  11. 11. jTextField3.setText(String.valueOf(r5)); } privatevoid jButton3ActionPerformed(java.awt.event.ActionEventevt) { double c3,r6; c3=Double.parseDouble(jTextField1.getText()); r6=c3*c3; jTextField3.setText(String.valueOf(r6)); } privatevoid jButton4ActionPerformed(java.awt.event.ActionEventevt) { double c8,r8; c8=Double.parseDouble(jTextField1.getText()); r8=c8*c8*c8; jTextField3.setText(String.valueOf(r8)); } privatevoid jTextField1ActionPerformed(java.awt.event.ActionEventevt) { // TODO addyourhandlingcodehere: } privatevoid jButton9ActionPerformed(java.awt.event.ActionEventevt) {
  12. 12. jTextField1.setText(String.valueOf("")); jTextField2.setText(String.valueOf("")); jTextField3.setText(String.valueOf("")); } publicstaticvoidmain(Stringargs[]) { java.awt.EventQueue.invokeLater(new Runnable() { publicvoid run() { new CAL().setVisible(true); } }); } // Variables declaration - do not modify privatejavax.swing.JButton jButton1; privatejavax.swing.JButton jButton2; privatejavax.swing.JButton jButton3; privatejavax.swing.JButton jButton4; privatejavax.swing.JButton jButton5; privatejavax.swing.JButton jButton6; privatejavax.swing.JButton jButton7; privatejavax.swing.JButton jButton8; privatejavax.swing.JButton jButton9; privatejavax.swing.JTextField jTextField1; privatejavax.swing.JTextField jTextField2; privatejavax.swing.JTextField jTextField3; // End of variables declaration
  13. 13. privatevoiddelete(JTextField jTextField1) { throw new UnsupportedOperationException("Not supportedyet."); //To changebody of generatedmethods, choose Tools | Templates. } } SALUDO public class saludos extendsjavax.swing.JFrame { /** * Creates new form saludos */ public saludos() { initComponents(); } /** * Thismethod is calledfromwithin the constructor to initialize the form.
  14. 14. * WARNING: Do NOT modifythiscode. The content of thismethod is always * regeneratedby the Form Editor. */ @SuppressWarnings("unchecked") // <editor-folddefaultstate="collapsed" desc="GeneratedCode"> privatevoidinitComponents() { jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton1.setText("1"); jButton1.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton1ActionPerformed(evt); } }); jButton2.setText("2"); jButton2.addActionListener(new java.awt.event.ActionListener() { publicvoidactionPerformed(java.awt.event.ActionEventevt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayoutlayout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout);
  15. 15. layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jButton1) .addGap(32, 32, 32) .addComponent(jButton2) .addGap(18, 18, 18) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(171, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(51, 51, 51) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(226, Short.MAX_VALUE)) ); pack(); }// </editor-fold> privatevoid jButton2ActionPerformed(java.awt.event.ActionEventevt) { jTextField1.setText("adios");
  16. 16. } privatevoid jButton1ActionPerformed(java.awt.event.ActionEventevt) { jTextField1.setText("hola"); } /** * @paramargs the command line arguments */ publicstaticvoidmain(Stringargs[]) { /* Set the Nimbus look and feel */ //<editor-folddefaultstate="collapsed" desc=" Look and feelsettingcode (optional) "> /* IfNimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * Fordetailssee http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfoinfo : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  17. 17. } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { publicvoid run() { new saludos().setVisible(true); } }); } // Variables declaration - do not modify privatejavax.swing.JButton jButton1; privatejavax.swing.JButton jButton2; privatejavax.swing.JTextField jTextField1; // End of variables declaration }

×