elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: [1]
1  Programación / Java / urgente matriz con interfaz grafica en java en: 23 Febrero 2012, 07:33 am
favor necesito ayuda urgente crear una interfaz grafica de una matriz en java no e conseguido documentacion al respecto si alguien tiene un aporte bienvenido sea, e visto pero solo con tex field y q no me sirve de mucho gracias

2  Programación / Ejercicios / Re: alguien tiene códigos de interfaces gráfica en java con IDE Netbeans? en: 21 Febrero 2012, 03:47 am
bueno amigo aqui te dejo un pequeño codigo haber si te sirve de ayudo
/**
 *
 * @author FRANCO
 */
public class probando extends javax.swing.JFrame {

    /**
     * Creates new form probando
     */
    public probando() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        scrollPane1 = new java.awt.ScrollPane();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setText("mostrar");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        scrollPane1.add(jLabel1);

        jScrollPane1.setViewportView(scrollPane1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(53, 53, 53)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(235, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(71, 71, 71)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(78, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>

    private void jButton1MousePressed(java.awt.event.MouseEvent evt) {                                     
     
     jLabel1.setText("Tu nombre "+jTextField1.getText());
     
    }                                     

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // TODO add your handling code here:
    }                                     

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

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(probando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(probando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(probando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(probando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new probando().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTextField1;
    private java.awt.ScrollPane scrollPane1;
    // End of variables declaration
}
3  Seguridad Informática / Hacking / Re: HACKERS BLACK BOOK muy interesante en: 13 Enero 2012, 18:55 pm
los links no estan funcionando
4  Programación / Ejercicios / Re: Ejercicios en JAVA en: 13 Enero 2012, 18:41 pm
bueno aca le dejo el primer ejercicio propuesto corregido lo hice asi sencillo si alguna duda pueden consultarme

import java.io.*;

public class suam{
   public static void main (String[] args) {

int n1=50,n2=30,suma=0,n3=0;

suma=n1+n2;

System.out.println("la suma es:"+suma);

suma=suma+n3;

System.out.println("su otra suma es:"+suma);


}
   
}


aca le dejo otro de suma pero esta vez esta iterativo y recursivo para que vean la diferencia ambos arrojan los mismo resultado

import java.io.*;

class sum{
   
   BufferedReader lei=new  BufferedReader (new InputStreamReader(System.in));
   
   int sumari(int i)throws Exception{
      
         if (i==5)
         
         return (i);
      
         
        else
         
         
         return (sumari(i+1)+i);
         }
         
      void mostrar(int i) throws Exception{
         
         if (sumari(i)>5){
            System.out.println(sumari(i));
            
         }
         
      }   
void iterar() throws Exception{
int i,p=0;
   
   
for(i=0;i<=5;i++){
   p=p+i;
   
}
System.out.println(p);
   
}   


}




   public class sumar {
   public static void main (String[] args) throws Exception {

int i=0;

sum sumao = new sum();

sumao.sumari(i);
sumao.mostrar(i);
sumao.iterar();
 
}
   
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines