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

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Mensajes
Páginas: 1 ... 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [22] 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ... 79
211  Programación / Java / Re: Contar objetos creados de una clase en: 16 Agosto 2010, 19:20 pm
Código
  1. int numero[]=new int [11] ;
y eso a que ha venido XD,

Estas usando mal el for en ese caso, se emplean { } para denotar sus sentencias internas

Example:
Código
  1. for(int index=0;index<10;index++){
  2. //sentencias
  3. }

Si no le agregas los {} entonces solo tomara la primera sentencia.

Por lo demás has lo siguiente:
Crea un arreglo de objetos como te lo han dicho, pero al parecer no sabes como hacerlo bueno se hace asi.

Código
  1. Pelota []pelotas=new Pelota[10];
  2.  

y luego utilizas correctamente el for
Código
  1. Scanner scan = new Scanner(System.in);
  2. for(int index=0;
  3.     index<pelotas.length;
  4.         index++){
  5.                     System.out.println("\n") ;
  6.                 System.out.print("Ingrese el Peso: ");
  7.                 elPeso = scan.nextDouble();
  8.                 System.out.print("Ingrese el Color: ");
  9.                 elColor = scan.next();
  10.                 System.out.print("Ingrese la Marca: ");
  11.                 laMarca = scan.next();
  12.                 pelotas[index]=new Pelota(elPeso, elColor, laMarca);
  13.                 System.out.println(":"+(index+1)+" -> Obj creado.");
  14.             }

y ya solo te quedaría recorrer el arreglo de objetos y mostrar los datos de cada uno.

Un saludo.
212  Programación / Java / Re: GCJ en: 15 Agosto 2010, 07:16 am
http://casidiablo.blogspot.com/2006/10/instalando-el-gcj-en-windows.html
http://www.autexier.de/jmau/dev/gcj.html

Linux
Código:
sudo apt-get install gcj
http://www.linuxjournal.com/article/4860?page=0,1
213  Programación / Java / Re: obtener fecha en j2me en: 14 Agosto 2010, 23:03 pm
wtf mi eclipse no sirve :xD

Bueno en ese caso no se me ocurre nada, en un datefield no lo veo posible que se coloque como quieres o no se, una de las 2 :xD
Muestralo en un textfiel XD jaja textbox o StringItem
214  Programación / Java / Re: obtener fecha en j2me en: 14 Agosto 2010, 22:20 pm
que tal asi?

Código
  1. java.util.Date date = new java.util.Date();
  2. java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("dd/MM/yyyy");
  3. String StringDate=simpleDateFormat.format(date);
  4. System.out.println(StringDate);
215  Seguridad Informática / Bugs y Exploits / Re: Ayuda en XSS en: 13 Agosto 2010, 05:52 am
jajajaja :xD

http://www.google.co.ve/search?q=XSS+tutorial&btnG=Buscar&hl=es&sa=2

Esto va en Nivel Web
216  Sistemas Operativos / GNU/Linux / Re: MODIFICAR EL KERNEL DE LINUX en: 8 Agosto 2010, 01:51 am
Que esperabas?

:Aprende C y tendrás el camino abierto
217  Programación / Java / Re: [SOURCE]Capturando imagen y enviandola por sockets para reconstruirla en: 6 Agosto 2010, 21:39 pm
Primero eso de escribirla y leerla como archivo es innecesario

Puedes hacer todo internamente es decir

Código
  1. java.awt.image.BufferedImage bufferedImage=new java.awt.Robot().createScreenCapture(new java.awt.Rectangle(
  2. Toolkit.getDefaultToolkit().getScreenSize()));
  3.  

Y la envias con ImageIO, segun el API de este

Código:
static boolean write(RenderedImage im, String formatName, OutputStream output)

Puedes especificarle un OutputStream en este caso sera el OutputStream del Socket.

Example
Código
  1. javax.imageio.ImageIO.write(bufferedImage, "png",socket.getOutputStream());

Ya con eso se enviaría correctamente.

Y para recibirla en el Servidor puedes hacerlo tambien con ImageIO

Código:
static BufferedImage	read(InputStream input) 

Example:
Código
  1. BufferedImage b = ImageIO.read(socket.getInputStream());
  2. ImageIO.write(b, "png", new File("Screenshot.png"));

y asi tendrias 4 lineas para enviar y 4 para recibir una imagen ;)

Un saludo.
218  Programación / Java / Re: [SOURCE]Capturando imagen y enviandola por sockets para reconstruirla en: 6 Agosto 2010, 20:43 pm
Sabian que se puede enviar una imagen por sockes con tan solo 4 lineas y recibirla en 4 tambien, No se por que se complican :xD
219  Programación / Java / Re: error con el while en: 3 Agosto 2010, 23:41 pm
Lee sobre swing

Código
  1.  
  2. public class triangulo{
  3.    public static void main(String[] args){
  4.    javax.swing.JDialog dialog =new  javax.swing.JDialog();
  5.    javax.swing.JTextArea   jTextArea = new javax.swing.JTextArea();
  6.    javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane(jTextArea);
  7.    dialog.setSize(500,500);
  8.    dialog.setDefaultCloseOperation(javax.swing.JDialog.DISPOSE_ON_CLOSE);
  9.    dialog.add(scrollPane, java.awt.BorderLayout.CENTER);  
  10.    dialog.setLocationRelativeTo(null);
  11.    dialog.setVisible(true);
  12.    try{
  13.    String n1=" ";
  14.      int n=0;
  15.      n1=javax.swing.JOptionPane.showInputDialog(dialog,"INGRSE PRIMERO PARAMETRO");
  16.      n=Integer.parseInt(n1);
  17.      while(n<10){
  18.         String amp1 =" ";
  19.         String freq1=" ";
  20.         int amp=0,freq=0,i=0;
  21.         amp1=javax.swing.JOptionPane.showInputDialog(dialog,"INGRSE SEGUNDO PARAMETRO");
  22.         freq1=javax.swing.JOptionPane.showInputDialog(dialog,"INGRSE TERCER PARAMETRO");
  23.         amp=Integer.parseInt(amp1);
  24.         freq=Integer.parseInt(freq1);
  25.         for(i=0; i<freq; i++){
  26.            int j=0,k=0;
  27.            for(j=1; j<=amp; j++){
  28.                 for(k=0;k<j;k++)
  29.                    jTextArea.append(String.valueOf(j));
  30.                 jTextArea.append("\n");
  31.            }
  32.            for(j=amp-1; j>0; j--){
  33.                 for(k=0;k<j;k++)
  34.                  jTextArea.append(String.valueOf(j));
  35.                 jTextArea.append("\n");
  36.            }
  37.            if (i < freq-1 || n !=0)
  38.              jTextArea.append("\n");
  39.         }
  40.         n--;  
  41.       }
  42.     }catch (Exception e) {
  43.     javax.swing.JOptionPane.showMessageDialog(dialog,
  44.     e.getMessage(),e.getLocalizedMessage(),javax.swing.JOptionPane.ERROR_MESSAGE);
  45.     System.exit(0);
  46.     }
  47.    }
  48. }
  49.  
220  Programación / Java / Re: error con el while en: 3 Agosto 2010, 20:11 pm
Sera por que haces JOptionPane y no un  System.out.println();
 :¬¬
Código
  1. import javax.swing.*;
  2.  
  3. public class triangulo{
  4.    public static void main(String[] args){
  5.      String n1=" ";
  6.      int n=0;
  7.      n1=JOptionPane.showInputDialog("INGRSE PRIMERO PARAMETRO");
  8.      n=Integer.parseInt(n1);
  9.      while(n<10){
  10.         String amp1 =" ";
  11.         String freq1=" ";
  12.         int amp=0,freq=0,i=0;
  13.         amp1=JOptionPane.showInputDialog("INGRSE SEGUNDO PARAMETRO");
  14.         freq1=JOptionPane.showInputDialog("INGRSE TERCER PARAMETRO");
  15.         amp=Integer.parseInt(amp1);
  16.         freq=Integer.parseInt(freq1);
  17.         for(i=0; i<freq; i++){
  18.            int j=0,k=0;
  19.            for(j=1; j<=amp; j++){
  20.                 for(k=0;k<j;k++)
  21.                     System.out.print(j);
  22.                 System.out.println();
  23.            }
  24.            for(j=amp-1; j>0; j--){
  25.                 for(k=0;k<j;k++)
  26.                   System.out.print(j);
  27.               System.out.println();
  28.            }
  29.            if (i < freq-1 || n !=0)
  30.             System.out.println();
  31.         }
  32.        n--;
  33.       }
  34.    }
  35. }
Páginas: 1 ... 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [22] 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ... 79
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines