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

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web (Moderador: #!drvy)
| | |-+  Subir archivos con applets
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Subir archivos con applets  (Leído 1,784 veces)
danielo-

Desconectado Desconectado

Mensajes: 218


:)


Ver Perfil
Subir archivos con applets
« en: 19 Junio 2011, 08:11 am »

Hola a todos!
Estoy tratando de subir archivos desde un JApplet, pero no me sale, se supone que deberia ser sencillo, pero llevo dias intentandolo, sin exito, y quisiera saber si alguno de ustedes me puden dar la solución, aqui les dejo mi codigo para que chequen

Código
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. /*
  7.  * app.java
  8.  *
  9.  * Created on 19/06/2011, 12:54:05 AM
  10.  */
  11.  
  12. package test;
  13.  
  14. import java.io.File;
  15. import javax.swing.JFileChooser;
  16.  
  17. /**
  18.  *
  19.  * @author pirataX
  20.  */
  21. public class app extends javax.swing.JApplet {
  22.  
  23.    /** Initializes the applet app */
  24.    public void init() {
  25.        try {
  26.            java.awt.EventQueue.invokeAndWait(new Runnable() {
  27.                public void run() {
  28.                    initComponents();
  29. choose();
  30.                }
  31. });
  32.        } catch (Exception ex) {
  33.            ex.printStackTrace();
  34.        }
  35.    }
  36.  
  37.    /** This method is called from within the init() method to
  38.      * initialize the form.
  39.      * WARNING: Do NOT modify this code. The content of this method is
  40.      * always regenerated by the Form Editor.
  41.      */
  42.    @SuppressWarnings("unchecked")
  43.    // <editor-fold defaultstate="collapsed" desc="Generated Code">
  44.    private void initComponents() {
  45.  
  46.        jFileChooser1 = new javax.swing.JFileChooser();
  47.  
  48.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  49.        getContentPane().setLayout(layout);
  50.        layout.setHorizontalGroup(
  51.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  52.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  53.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  54.                .addComponent(jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  55.                .addContainerGap())
  56.        );
  57.        layout.setVerticalGroup(
  58.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  59.            .addGroup(layout.createSequentialGroup()
  60.                .addComponent(jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  61.                .addContainerGap(22, Short.MAX_VALUE))
  62.        );
  63.    }// </editor-fold>
  64.    public void choose(){
  65.        String archivo="";
  66.        JFileChooser fileChooser = new JFileChooser();
  67.        fileChooser.setMultiSelectionEnabled(true);
  68. int retVal = fileChooser.showOpenDialog(this);
  69. if (retVal == fileChooser.APPROVE_OPTION){
  70.            File[] files = fileChooser.getSelectedFiles();
  71.            for (int i=0; i<files.length; i++) {
  72.                System.out.println(files[i].getName());
  73.            }
  74. }
  75.    }
  76.    // Variables declaration - do not modify
  77.    private javax.swing.JFileChooser jFileChooser1;
  78.    // End of variables declaration
  79.  
  80. }
  81.  
  82. Espero sus ayudas!
  83.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Subir archivos a un ftp « 1 2 3 »
Programación Visual Basic
RED_HORSE 22 7,180 Último mensaje 28 Abril 2006, 01:40 am
por RED_HORSE
Subir archivos...
Programación Visual Basic
sp26 2 1,734 Último mensaje 30 Diciembre 2006, 12:46 pm
por skapunky
Subir archivos
PHP
zhynar_X 3 2,333 Último mensaje 10 Agosto 2007, 03:46 am
por дٳŦ٭
Applets en ervidor web
Java
santiago.morenom 1 1,403 Último mensaje 26 Mayo 2015, 21:30 pm
por 0xFer
Java Applets
Java
JDM 2 2,309 Último mensaje 27 Julio 2020, 08:42 am
por JDM
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines