Who can help me :)--a problem with java program(reset problem in java )

I do not know how to make the button reset,my program only could reset diagram but button.If any one who could help me to solve this problem.The problem is When the reset button is pressed, the image should immediately revert to the black square, and the 4 widgets listed above should show values that
correspond to the black square.The code like this,first one is shapes:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class shapes extends JFrame {
     private JPanel buttonPanel; // panel for buttons
     private DrawPanel myPanel;  // panel for shapes
     private JButton resetButton;
    private JComboBox colorComboBox;
     private JRadioButton circleButton, squareButton;
     private ButtonGroup radioGroup;
     private JCheckBox filledButton;
    private JSlider sizeSlider;
     private boolean isShow;
     private int shape;
     private boolean isFill=true;
    private String colorNames[] = {"black", "blue", "cyan", "darkGray", "gray",
                               "green", "lightgray", "magenta", "orange",
                               "pink", "red", "white", "yellow"};   // color names list in ComboBox
    private Color colors[] = {Color.black, Color.blue, Color.cyan, Color.darkGray,
                          Color.gray, Color.green, Color.lightGray, Color.magenta,
                          Color.orange, Color.pink, Color.red, Color.white, Color.yellow};
     public shapes() {
         super("Draw Shapes");
         // creat custom drawing panel
        myPanel = new DrawPanel(); // instantiate a DrawPanel object
        myPanel.setBackground(Color.white);
         // set up resetButton
        // register an event handler for resetButton's ActionEvent
        resetButton = new JButton ("reset");
         resetButton.addActionListener(
          // anonymous inner class to handle resetButton events
             new ActionListener() {
                   // draw a black filled square shape after clicking resetButton
                 public void actionPerformed (ActionEvent event) {
                         // call DrawPanel method setShowStatus and pass an parameter
                      // to decide if show the shape
                     myPanel.setShowStatus(true);
                         isShow = myPanel.getShowStatus();
                         shape = DrawPanel.SQUARE;
                     // call DrawPanel method setShape to indicate shape to draw
                         myPanel.setShape(shape);
                     // call DrawPanel method setFill to indicate to draw a filled shape
                         myPanel.setFill(true);
                     // call DrawPanel method draw
                         myPanel.draw();
                         myPanel.setFill(true);
                         myPanel.setForeground(Color.black);
               }// end anonymous inner class
         );// end call to addActionListener
        // set up colorComboBox
        // register event handlers for colorComboBox's ItemEvent
        colorComboBox = new JComboBox(colorNames);
        colorComboBox.setMaximumRowCount(5);
        colorComboBox.addItemListener(
             // anonymous inner class to handle colorComboBox events
             new ItemListener() {
                 // select shape's color
                 public void itemStateChanged(ItemEvent event) {
                     if(event.getStateChange() == ItemEvent.SELECTED)
                         // call DrawPanel method setForeground
                         // and pass an element value of colors array
                         myPanel.setForeground(colors[colorComboBox.getSelectedIndex()]);
                    myPanel.draw();
            }// end anonymous inner class
        ); // end call to addItemListener
        // set up a pair of RadioButtons
        // register an event handler for RadioButtons' ItemEvent
         squareButton = new JRadioButton ("Square", true);
         circleButton = new JRadioButton ("Circle", false);
         radioGroup = new ButtonGroup();
         radioGroup.add(squareButton);
         radioGroup.add(circleButton);
        squareButton.addItemListener(
            // anonymous inner class to handle squareButton events
            new ItemListener() {
                   public void itemStateChanged (ItemEvent event) {
                       if (isShow==true) {
                             shape = DrawPanel.SQUARE;
                             myPanel.setShape(shape);
                             myPanel.draw();
               }// end anonymous inner class
         );// end call to addItemListener
         circleButton.addItemListener(
               // anonymous inner class to handle circleButton events
            new ItemListener() {
                   public void itemStateChanged (ItemEvent event) {
                         if (isShow==true) {
                             shape = DrawPanel.CIRCLE;
                             myPanel.setShape(shape);
                             myPanel.draw();
                         else
                             System.out.println("Please click Reset button first");
               }// end anonymous inner class
         );// end call to addItemListener
         // set up filledButton
        // register an event handler for filledButton's ItemEvent
        filledButton = new JCheckBox("Filled", true);
         filledButton.addItemListener(
          // anonymous inner class to handle filledButton events
        new ItemListener() {
              public void itemStateChanged (ItemEvent event) {
                if (isShow==true) {
                        if (event.getStateChange() == ItemEvent.SELECTED) {
                              isFill=true;
                              myPanel.setFill(isFill);
                              myPanel.draw();
                        else {
                            isFill=false;
                              myPanel.setFill(isFill);
                              myPanel.draw();
                else
                    System.out.println("Please click Reset button first");
          }// end anonymous inner class
         );// end call to addItemListener
        // set up sizeSlider
        // register an event handler for sizeSlider's ChangeEvent
        sizeSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 300, 100);
        sizeSlider.setMajorTickSpacing(10);
        sizeSlider.setPaintTicks(true);
        sizeSlider.addChangeListener(
             // anonymous inner class to handle sizeSlider events
             new ChangeListener() {
                  public void stateChanged(ChangeEvent event) {
                      myPanel.setShapeSize(sizeSlider.getValue());
                         myPanel.draw();
             }// end anonymous inner class
         );// end call to addChangeListener
        // set up panel containing buttons
         buttonPanel = new JPanel();
        buttonPanel.setLayout(new GridLayout(4, 1, 0, 50));
         buttonPanel.add(resetButton);
         buttonPanel.add(filledButton);
        buttonPanel.add(colorComboBox);
        JPanel radioButtonPanel = new JPanel();
        radioButtonPanel.setLayout(new GridLayout(2, 1, 0, 20));
        radioButtonPanel.add(squareButton);
        radioButtonPanel.add(circleButton);
        buttonPanel.add(radioButtonPanel);
        // attach button panel & draw panel to content panel
        Container container = getContentPane();
        container.setLayout(new BorderLayout(10,10));
        container.add(myPanel, BorderLayout.CENTER);
         container.add(buttonPanel, BorderLayout.EAST);
        container.add(sizeSlider, BorderLayout.SOUTH);
        setSize(500, 400);
         setVisible(true);
     public static void main(String args[]) {
         shapes application = new shapes();
         application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}second one is drawpanel:
import java.awt.*;
import javax.swing.*;
public class DrawPanel extends JPanel {
     public final static int CIRCLE = 1, SQUARE = 2;
     private int shape;
     private boolean fill;
     private boolean showStatus;
    private int shapeSize = 100;
    private Color foreground;
     // draw a specified shape
    public void paintComponent (Graphics g){
          super.paintComponent(g);
          // find center
        int x=(getSize().width-shapeSize)/2;
          int y=(getSize().height-shapeSize)/2;
          if (shape == CIRCLE) {
             if (fill == true){
                 g.setColor(foreground);
                  g.fillOval(x, y, shapeSize, shapeSize);
            else{
                   g.setColor(foreground);
                g.drawOval(x, y, shapeSize, shapeSize);
          else if (shape == SQUARE){
             if (fill == true){
                 g.setColor(foreground);
                    g.fillRect(x, y, shapeSize, shapeSize);
            else{
                    g.setColor(foreground);
                g.drawRect(x, y, shapeSize, shapeSize);
    // set showStatus value
    public void setShowStatus (boolean s) {
          showStatus = s;
     // return showstatus value
    public boolean getShowStatus () {
          return showStatus;
     // set fill value
    public void setFill(boolean isFill) {
          fill = isFill;
     // set shape value
    public void setShape(int shapeToDraw) {
          shape = shapeToDraw;
    // set shapeSize value
    public void setShapeSize(int newShapeSize) {
          shapeSize = newShapeSize;
    // set foreground value
    public void setForeground(Color newColor) {
          foreground = newColor;
     // repaint DrawPanel
    public void draw (){
          if(showStatus == true)
          repaint();
}If any kind people who can help me.
many thanks to you!

4 widgets???
maybe this is what you mean.
add this inside your actionPerformed method for the reset action
squareButton.setSelected(true);
colorComboBox.setSelectedIndex(0);
if not be more clear in your post.

Similar Messages

  • HI THERE!IS THERE ANY ONE WHO CAN HELP ME HAVING TROUBLE WITH MY IPHONE 3GS AFTER UPGRADING TO IOS5.0 IT WONT READ THE SIM AND NO SERVICE  AND IT WONT ACTIVATED.PLEASE HELP

    HI THERE IS THERE ANYONE WHO CAN HELP ME?I UPGRADE MY IPHONE 3GS TO IOS5 AND NOW IT WONT ACTIVATE AND SAYS THE SIM CARD IS NOT SUPPORTED I CHANGE FOR ANEW SIM ALREADY BUT STILL WONT ACTIVATE.PLEASE HELP

    you're responding to a post that's almost 2 months old. Time to post your own thread.

  • A problem with java program(reset problem in java GUY)

    I do not know how to make the button reset,my program only could reset diagram but button.If any one who could help me to solve this problem.The problem is When the reset button is pressed, the image should immediately revert to the black square, and the 4 widgets listed above should show values that
    correspond to the black square.
    import java.awt.*;
    import javax.swing.*;
    public class DrawPanel extends JPanel {
         public final static int CIRCLE = 1, SQUARE = 2;
         private int shape;
         private boolean fill;
         private boolean showStatus;
        private int shapeSize = 100;
        private Color foreground;
         // draw a specified shape
        public void paintComponent (Graphics g){
              super.paintComponent(g);
              // find center
            int x=(getSize().width-shapeSize)/2;
              int y=(getSize().height-shapeSize)/2;
              if (shape == CIRCLE) {
                 if (fill == true){
                     g.setColor(foreground);
                      g.fillOval(x, y, shapeSize, shapeSize);
                else{
                       g.setColor(foreground);
                    g.drawOval(x, y, shapeSize, shapeSize);
              else if (shape == SQUARE){
                 if (fill == true){
                     g.setColor(foreground);
                        g.fillRect(x, y, shapeSize, shapeSize);
                else{
                        g.setColor(foreground);
                    g.drawRect(x, y, shapeSize, shapeSize);
        // set showStatus value
        public void setShowStatus (boolean s) {
              showStatus = s;
         // return showstatus value
        public boolean getShowStatus () {
              return showStatus;
         // set fill value
        public void setFill(boolean isFill) {
              fill = isFill;
         // set shape value
        public void setShape(int shapeToDraw) {
              shape = shapeToDraw;
        // set shapeSize value
        public void setShapeSize(int newShapeSize) {
              shapeSize = newShapeSize;
        // set foreground value
        public void setForeground(Color newColor) {
              foreground = newColor;
         // repaint DrawPanel
        public void draw (){
              if(showStatus == true)
              repaint();
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class shapes extends JFrame {
         private JPanel buttonPanel; // panel for buttons
         private DrawPanel myPanel;  // panel for shapes
         private JButton resetButton;
        private JComboBox colorComboBox;
         private JRadioButton circleButton, squareButton;
         private ButtonGroup radioGroup;
         private JCheckBox filledButton;
        private JSlider sizeSlider;
         private boolean isShow;
         private int shape;
         private boolean isFill=true;
        private String colorNames[] = {"black", "blue", "cyan", "darkGray", "gray",
                                   "green", "lightgray", "magenta", "orange",
                                   "pink", "red", "white", "yellow"};   // color names list in ComboBox
        private Color colors[] = {Color.black, Color.blue, Color.cyan, Color.darkGray,
                              Color.gray, Color.green, Color.lightGray, Color.magenta,
                              Color.orange, Color.pink, Color.red, Color.white, Color.yellow};
         public shapes() {
             super("Draw Shapes");
             // creat custom drawing panel
            myPanel = new DrawPanel(); // instantiate a DrawPanel object
            myPanel.setBackground(Color.white);
             // set up resetButton
            // register an event handler for resetButton's ActionEvent
            resetButton = new JButton ("reset");
             resetButton.addActionListener(
              // anonymous inner class to handle resetButton events
                 new ActionListener() {
                       // draw a black filled square shape after clicking resetButton
                     public void actionPerformed (ActionEvent event) {
                             // call DrawPanel method setShowStatus and pass an parameter
                          // to decide if show the shape
                         myPanel.setShowStatus(true);
                             isShow = myPanel.getShowStatus();
                             shape = DrawPanel.SQUARE;
                         // call DrawPanel method setShape to indicate shape to draw
                             myPanel.setShape(shape);
                         // call DrawPanel method setFill to indicate to draw a filled shape
                             myPanel.setFill(true);
                         // call DrawPanel method draw
                             myPanel.draw();
                             myPanel.setFill(true);
                             myPanel.setForeground(Color.black);
                   }// end anonymous inner class
             );// end call to addActionListener
            // set up colorComboBox
            // register event handlers for colorComboBox's ItemEvent
            colorComboBox = new JComboBox(colorNames);
            colorComboBox.setMaximumRowCount(5);
            colorComboBox.addItemListener(
                 // anonymous inner class to handle colorComboBox events
                 new ItemListener() {
                     // select shape's color
                     public void itemStateChanged(ItemEvent event) {
                         if(event.getStateChange() == ItemEvent.SELECTED)
                             // call DrawPanel method setForeground
                             // and pass an element value of colors array
                             myPanel.setForeground(colors[colorComboBox.getSelectedIndex()]);
                        myPanel.draw();
                }// end anonymous inner class
            ); // end call to addItemListener
            // set up a pair of RadioButtons
            // register an event handler for RadioButtons' ItemEvent
             squareButton = new JRadioButton ("Square", true);
             circleButton = new JRadioButton ("Circle", false);
             radioGroup = new ButtonGroup();
             radioGroup.add(squareButton);
             radioGroup.add(circleButton);
            squareButton.addItemListener(
                // anonymous inner class to handle squareButton events
                new ItemListener() {
                       public void itemStateChanged (ItemEvent event) {
                           if (isShow==true) {
                                 shape = DrawPanel.SQUARE;
                                 myPanel.setShape(shape);
                                 myPanel.draw();
                   }// end anonymous inner class
             );// end call to addItemListener
             circleButton.addItemListener(
                   // anonymous inner class to handle circleButton events
                new ItemListener() {
                       public void itemStateChanged (ItemEvent event) {
                             if (isShow==true) {
                                 shape = DrawPanel.CIRCLE;
                                 myPanel.setShape(shape);
                                 myPanel.draw();
                             else
                                 System.out.println("Please click Reset button first");
                   }// end anonymous inner class
             );// end call to addItemListener
             // set up filledButton
            // register an event handler for filledButton's ItemEvent
            filledButton = new JCheckBox("Filled", true);
             filledButton.addItemListener(
              // anonymous inner class to handle filledButton events
            new ItemListener() {
                  public void itemStateChanged (ItemEvent event) {
                    if (isShow==true) {
                            if (event.getStateChange() == ItemEvent.SELECTED) {
                                  isFill=true;
                                  myPanel.setFill(isFill);
                                  myPanel.draw();
                            else {
                                isFill=false;
                                  myPanel.setFill(isFill);
                                  myPanel.draw();
                    else
                        System.out.println("Please click Reset button first");
              }// end anonymous inner class
             );// end call to addItemListener
            // set up sizeSlider
            // register an event handler for sizeSlider's ChangeEvent
            sizeSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 300, 100);
            sizeSlider.setMajorTickSpacing(10);
            sizeSlider.setPaintTicks(true);
            sizeSlider.addChangeListener(
                 // anonymous inner class to handle sizeSlider events
                 new ChangeListener() {
                      public void stateChanged(ChangeEvent event) {
                          myPanel.setShapeSize(sizeSlider.getValue());
                             myPanel.draw();
                 }// end anonymous inner class
             );// end call to addChangeListener
            // set up panel containing buttons
             buttonPanel = new JPanel();
            buttonPanel.setLayout(new GridLayout(4, 1, 0, 50));
             buttonPanel.add(resetButton);
             buttonPanel.add(filledButton);
            buttonPanel.add(colorComboBox);
            JPanel radioButtonPanel = new JPanel();
            radioButtonPanel.setLayout(new GridLayout(2, 1, 0, 20));
            radioButtonPanel.add(squareButton);
            radioButtonPanel.add(circleButton);
            buttonPanel.add(radioButtonPanel);
            // attach button panel & draw panel to content panel
            Container container = getContentPane();
            container.setLayout(new BorderLayout(10,10));
            container.add(myPanel, BorderLayout.CENTER);
             container.add(buttonPanel, BorderLayout.EAST);
            container.add(sizeSlider, BorderLayout.SOUTH);
            setSize(500, 400);
             setVisible(true);
         public static void main(String args[]) {
             shapes application = new shapes();
             application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }Many thanks

    Who is this Java guy anyway?

  • HT4759 I cannot get my calendar to sync up with the company's iCloud calendar.  The Techs all have Macs and I have Dell Dimension M4600 PC.  Can I talk to someone who can help me sync up with the company calendar.

    I cannot sync up with the company iCloud Calendar.  For some reason it does not work.  I use IE-8 and my PC is a pretty good one, Dell Precision M4600.  Any suggestions.  Thanks. 

    You would have to be using Outlook 2007 or 2010, and be signed into the iCloud account that your company is using in order to do that.  This explains how to set this up on your PC: http://www.apple.com/icloud/setup/pc.html.
    Alternatively, someone could share the calendar with you as explained here: http://help.apple.com/icloud/#mm6b1a9479.

  • We're new here, who can help us?

    Hi everyone, well, i'm very interesting in Abode LiveCycle. And the main problem is: I have a working well system, which can take some requests from users and after resend them PDF documents with digital sign (electronic digital signature). Who can help me to deal with that. Remember that if you teach somebody, your self position will be upgraded and your fillings will be better!!! Thanks alot!

    Hello Michael.
    Maybe you know some source in the WEB or PDF books which include full-ilustrated tutorials. Cause I served the Internet and I didn't find specific literature.
    Let me tell you, what a promblem I have! I found a job, i'm a developer here, so they gave me an old project which works with IBM WebSphere Portal 6.0 and Adobe LiveCycle. So, our citizens can goto the Web site (http://egov2c.kz) and ask many questions and queries to the whole System. The main purpose of the System is getting some information from citizens and after many processes returning the PDF Document which singed by digital sign. This digital sing content much information about citizen, query and the main answer. After that, the Citizen can use this document for his needs and every authorities have to take them (documents) without any problems.
    To sum up the message, I need an information, from which point or book I have to start study this question. I work well with IBM WebSphere but I know nothing about Adobe LiveCycle. Please, give me a real advice!!! Thanks alot!

  • Problem With GUI ( Who can help me! )

    Hallo,
    It�s a very simple program to See the Clock on a panel. The program works well, but if I want to include a GUI to my program, it don�t want. I use runable action and I think that is be the problem.
    Here below you can see the code�s. I�m sure there is someone who can help me.
    Thanks a lot,
    Seyyed
    The code:
    public class Clock_maken extends java.applet.Applet
    implements Runnable {
    public volatile Thread clockThread = null;
    JLabel           Datuum_label;
    DateFormat      formatter;
    Locale           locale;
    Date           currentDate;
    String          today;
    public void init(){ 
    locale = Locale.getDefault();
    Datuum_label = new JLabel("date");
    public void start() {       
    Datuum_label.setForeground(Color.black);
    add(Datuum_label);
    if(clockThread == null) {
    clockThread = new Thread(this);
    clockThread.start();
    public void run() {
         Thread myThread = Thread.currentThread();
         while (clockThread == myThread) {
         currentDate = new Date();
    formatter =                     DateFormat.getDateTimeInstance(DateFormat.FULL,
              DateFormat.MEDIUM, locale);
    today = formatter.format(currentDate);
    Datuum_label.setText(today);
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e){ }
    public void stop() {clockThread = null;}
    public static void main(String[] args){
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame      lunarPhasesFrame = new JFrame("Lunar Phases");
    lunarPhasesFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Clock_maken phases = new Clock_maken();
    phases.init();
    phases.start();
    lunarPhasesFrame.pack();
    lunarPhasesFrame.setVisible(true);
    Now i want to create a GUI like folowing, but it dont work. Do u know wat is de probleem of mijn prograam.
    private static void createAndShowGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true);
         /*     JFrame      lunarPhasesFrame = new JFrame("Lunar Phases");
              lunarPhasesFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    */ Clock_maken phases = new Clock_maken();
         /*     phases.init();
              phases.start();
              lunarPhasesFrame.pack();
         lunarPhasesFrame.setVisible(true);*/
    public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }

    Continued here, with formatted code:
    http://forum.java.sun.com/thread.jspa?threadID=725022

  • I think pesimo customer service three days, I'm looking for someone I can ayudr activation problem with my CC and can not find anyone who can help me.

    I think pesimo customer service three days, I'm looking for someone I can ayudr activation problem with my CC and can not find anyone who can help me.

    Online Chat Now button near the bottom for Activation and Deactivation problems may help
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html

  • When I try to install the latest version (10.5) of iTunes, the following message appears: "There was a problem with this Windows Installer package. A program running during installation is terminated unexpectedly." Is there somebody who can help me?thanks

    When I try to install the latest version (10.5) of iTunes, the following message appears: "There was a problem with this Windows Installer package. A program running during installation is terminated unexpectedly." Is there somebody who can help me?thanks

    I used this site and it fixed my problems. Hoping it will help with yours too
    http://support.microsoft.com/mats/Program_Install_and_Uninstall

  • Hi! I have problems with my calender. The diarise of dates is sometimes not authentic, dates dissapeare or were put on a wrong day. Who can help?

    Hi! I have problems with my calender. The diarise of dates is sometimes not authentic, dates dissapeare or were put on a wrong day. Who can help?

    Don't worry I've sorted it! I just had to turn off Reminders as well in iCloud. Calendar then worked fine, even when I turned Calendar and Reminders back on.

  • Hello is there anybody who can help me in german? i have the same problem like the guy with i tunes. it won´t open an give me an error "An application has made an attempt to load the C runtimelibrary incorrectly" Please contact the application´s support..

    I´ve so many privat things on I tunes like pictures, music etc.and i won´t loose them. is there anybody who can help me to save my private things and help me to solve teh problem
    Thanks you for help greetings from austria

    I just had the same error: 
    R6034
    An application has made an attempt to load the C runtime library incorrectly.  Please contact the apps support team for more info.
    I went to http://support.apple.com/kb/ht1925 and did a complete removal and reinstallation of iTunes. You MUST follow the directions here exactly...it's more than just iTunes that must be removed, and it MUST be done in the order in which the support article says.  I followed the exact instructions, and iTunes is back on my machine (no more C runtime error) and you do NOT lose your music...it's all in my library, as it was before.
    Good luck!

  • I will pay for who can help me with this applet

    Hi!, sorry for my english, im spanish.
    I have a big problem with an applet:
    I�ve make an applet that sends files to a FTP Server with a progress bar.
    Its works fine on my IDE (JBuilder 9), but when I load into Internet Explorer (signed applet) it crash. The applet seems like blocked: it show the screen of java loading and dont show the progress bar, but it send the archives to the FTP server while shows the java loading screen.
    I will pay with a domain or with paypal to anyone who can help me with this problematic applet. I will give my code and the goal is only repair the applet. Only that.
    My email: [email protected]
    thanks in advance.
    adios!

    thaks for yours anwswers..
    harmmeijer: the applet is signed ok, I dont think that is the problem...
    itchyscratchy: the server calls are made from start() method. The applet is crashed during its sending files to FTP server, when finish, the applet look ok.
    The class I use is FtpBean: http://www.geocities.com/SiliconValley/Code/9129/javabean/ftpbean/
    (I test too with apache commons-net, and the same effect...)
    The ftp is Filezilla in localhost.
    This is the code, I explain a little:
    The start() method calls iniciar() method where its is defined the array of files to upload, and connect to ftp server. The for loop on every element of array and uploads a file on subirFichero() method.
    Basicaly its this.
    The HTML code is:
    <applet
           codebase = "."
           code     = "revelado.Upload.class"
           archive  = "revelado.jar"
           name     = "Revelado"
           width    = "750"
           height   = "415"
           hspace   = "0"
           vspace   = "0"
           align    = "middle"
         >
         <PARAM NAME="usern" VALUE="username">
         </applet>
    package revelado;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import java.io.*;
    import javax.swing.border.*;
    import java.net.*;
    import ftp.*;
    public class Upload
        extends Applet {
      private boolean isStandalone = false;
      JPanel jPanel1 = new JPanel();
      JLabel jLabel1 = new JLabel();
      JLabel jlmensaje = new JLabel();
      JLabel jlarchivo = new JLabel();
      TitledBorder titledBorder1;
      TitledBorder titledBorder2;
      //mis variables
      String DIRECTORIOHOME = System.getProperty("user.home");
      String[] fotos_sel = new String[1000]; //array of selected images
      int[] indice_tamano = new int[1000]; //array of sizes
      int[] indice_cantidad = new int[1000]; //array of quantitys
      int num_fotos_sel = 0; //number of selected images
      double importe = 0; //total prize
      double[] precios_tam = {
          0.12, 0.39, 0.60, 1.50};
      //prizes
      String server = "localhost";
      String username = "pepe";
      String password = "pepe01";
      String nombreusuario = null;
      JProgressBar jProgreso = new JProgressBar();
      //Obtener el valor de un par�metro
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
            (getParameter(key) != null ? getParameter(key) : def);
      //Construir el applet
      public Upload() {
      //Inicializar el applet
      public void init() {
        try {
          jbInit();
        catch (Exception e) {
          e.printStackTrace();
      //Inicializaci�n de componentes
      private void jbInit() throws Exception {
        titledBorder1 = new TitledBorder("");
        titledBorder2 = new TitledBorder("");
        this.setLayout(null);
        jPanel1.setBackground(Color.lightGray);
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setBounds(new Rectangle(113, 70, 541, 151));
        jPanel1.setLayout(null);
        jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
        jLabel1.setText("Subiendo archivos al servidor");
        jLabel1.setBounds(new Rectangle(150, 26, 242, 15));
        jlmensaje.setFont(new java.awt.Font("Dialog", 0, 10));
        jlmensaje.setForeground(Color.red);
        jlmensaje.setHorizontalAlignment(SwingConstants.CENTER);
        jlmensaje.setText(
            "Por favor, no cierre esta ventana hasta que termine de subir todas " +
            "las fotos");
        jlmensaje.setBounds(new Rectangle(59, 49, 422, 30));
        jlarchivo.setBackground(Color.white);
        jlarchivo.setBorder(titledBorder2);
        jlarchivo.setHorizontalAlignment(SwingConstants.CENTER);
        jlarchivo.setBounds(new Rectangle(16, 85, 508, 24));
        jProgreso.setForeground(new Color(49, 226, 197));
        jProgreso.setBounds(new Rectangle(130, 121, 281, 18));
        jPanel1.add(jlmensaje, null);
        jPanel1.add(jlarchivo, null);
        jPanel1.add(jProgreso, null);
        jPanel1.add(jLabel1, null);
        this.add(jPanel1, null);
        nombreusuario = getParameter("usern");
      //Iniciar el applet
      public void start() {
        jlarchivo.setText("Start() method...");
        iniciar();
      public void iniciar() {
        //init images selected array
        fotos_sel[0] = "C:/fotos/05160009.JPG";
        fotos_sel[1] = "C:/fotos/05160010.JPG";
        fotos_sel[2] = "C:/fotos/05160011.JPG";
         // etc...
         num_fotos_sel=3; //number of selected images
        //conectar al ftp (instanciar clase FtpExample)
        FtpExample miftp = new FtpExample();
        miftp.connect();
        //make the directory
         subirpedido(miftp); 
        jProgreso.setMinimum(0);
        jProgreso.setMaximum(num_fotos_sel);
        for (int i = 0; i < num_fotos_sel; i++) {
          jlarchivo.setText(fotos_sel);
    jProgreso.setValue(i);
    subirFichero(miftp, fotos_sel[i]);
    try {
    Thread.sleep(1000);
    catch (InterruptedException ex) {
    //salida(ex.toString());
    jlarchivo.setText("Proceso finalizado correctamente");
    jProgreso.setValue(num_fotos_sel);
    miftp.close();
    //Detener el applet
    public void stop() {
    //Destruir el applet
    public void destroy() {
    //Obtener informaci�n del applet
    public String getAppletInfo() {
    return "Subir ficheros al server";
    //Obtener informaci�n del par�metro
    public String[][] getParameterInfo() {
    return null;
    //sube al ftp (a la carpeta del usuario) el archivo
    //pedido.txt que tiene las lineas del pedido
    public void subirpedido(FtpExample miftp) {
    jlarchivo.setText("Iniciando la conexi�n...");
    //make folder of user
    miftp.directorio("www/usuarios/" + nombreusuario);
    //uploads a file
    public void subirFichero(FtpExample miftp, String nombre) {
    //remote name:
    String nremoto = "";
    int lr = nombre.lastIndexOf("\\");
    if (lr<0){
    lr = nombre.lastIndexOf("/");
    nremoto = nombre.substring(lr + 1);
    String archivoremoto = "www/usuarios/" + nombreusuario + "/" + nremoto;
    //upload file
    miftp.subir(nombre, archivoremoto);
    class FtpExample
    implements FtpObserver {
    FtpBean ftp;
    long num_of_bytes = 0;
    public FtpExample() {
    // Create a new FtpBean object.
    ftp = new FtpBean();
    // Connect to a ftp server.
    public void connect() {
    try {
    ftp.ftpConnect("localhost", "pepe", "pepe01");
    catch (Exception e) {
    System.out.println(e);
    // Close connection
    public void close() {
    try {
    ftp.close();
    catch (Exception e) {
    System.out.println(e);
    // Go to directory pub and list its content.
    public void listDirectory() {
    FtpListResult ftplrs = null;
    try {
    // Go to directory
    ftp.setDirectory("/");
    // Get its directory content.
    ftplrs = ftp.getDirectoryContent();
    catch (Exception e) {
    System.out.println(e);
    // Print out the type and file name of each row.
    while (ftplrs.next()) {
    int type = ftplrs.getType();
    if (type == FtpListResult.DIRECTORY) {
    System.out.print("DIR\t");
    else if (type == FtpListResult.FILE) {
    System.out.print("FILE\t");
    else if (type == FtpListResult.LINK) {
    System.out.print("LINK\t");
    else if (type == FtpListResult.OTHERS) {
    System.out.print("OTHER\t");
    System.out.println(ftplrs.getName());
    // Implemented for FtpObserver interface.
    // To monitor download progress.
    public void byteRead(int bytes) {
    num_of_bytes += bytes;
    System.out.println(num_of_bytes + " of bytes read already.");
    // Needed to implements by FtpObserver interface.
    public void byteWrite(int bytes) {
    //crea un directorio
    public void directorio(String nombre) {
    try {
    ftp.makeDirectory(nombre);
    catch (Exception e) {
    System.out.println(e);
    public void subir(String local, String remoto) {
    try {
    ftp.putBinaryFile(local, remoto);
    catch (Exception e) {
    System.out.println(e);
    // Main
    public static void main(String[] args) {
    FtpExample example = new FtpExample();
    example.connect();
    example.directorio("raul");
    example.listDirectory();
    example.subir("C:/fotos/05160009.JPG", "/raul/foto1.jpg");
    //example.getFile();
    example.close();

  • First of all, I would have to say that getting in touch with you is a nightmare and I am not at all happy that I can't just email or live chat with someone who can help!  I am not a technical person, I just want to be able to use Photoshop Elements and ge

    First of all, I would have to say that getting in touch with you is a nightmare and I am not at all happy that I can't just email or live chat with someone who can help!  I am not a technical person, I just want to be able to use Photoshop Elements and get on with it. I bought Photoshop Elements via Amazon some months ago and it worked fine.  I then got a message that advised that the trial version would expire, which it subsequently has (I have been trawling your site for weeks and weeks trying to find an email or phone contact to get some assistance).  Relucltantly, I am now typing this - and I suspect it will not help in the slightest!  I bought the FULL not TRIAL edition of Photoshop Elements and I have contacted Amazon who confirmed this, but say I need to contact you.  Can you please let me know how I can resolve this?  Louise A Fraser

    Hi Louise, sorry to hear of your problems. This is not Adobe. We are mainly support volunteers, other users like you, trying to help one another.  You need to contact Adobe directly for activation and licencing issues. Click the link below. Use the dropdown menu for boxes (1) & (2) to scroll down the list and choose:
    1. Adobe Photoshop Elements
    2. Adobe ID, and signing-in
    3. Click on the blue button: Still need help? Contact us – then click the area marked chat 24/7, then click “start chat ”
    It’s usually possible to start a live chat, if an Adobe agent is free, and often to get the problem fixed right away. Have your serial number available. The agent can directly troubleshoot your system if you agree to activate the Adobe Connect add-on. Don’t let them pass the buck. Stay connected and ask to speak with a supervisor if necessary.
    Click here to get help now Contact Customer Care

  • This iphone is currently linked to an apple id *********sign in with the apple id that was used to  set up this iphone...i got this when i connect my iphone to itunes...who can help me???plzzz

    this iphone is currently linked to an apple id *********sign in with the apple id that was used to  set up this iphone...i got this when i connect my iphone to itunes...who can help me???plzzz

    Are you the original owner of this phone? If so sign in with the Apple ID and password you used when you first set it up.
    Or did you buy is phone used? Contact the person you bought it from and have him/her correct the problem or refund your money.
    You have encountered activation Lock that prevents stolen or lost phones from being activated. As stated the only way around this problem is to have the original owner clear the phone for your use.

  • Ive finished my first website now my next problem, who can help?

    Hi there,
    With lots of help from Nadia, ive finished my website..
    http://www.tlmgoldman.com/
    Now ive got to move on to an other level and i hope you can help me.
    As you can see the website is working fine. Now ive got one new question from my client. Is it possible that my client can change the text himself? And he want to add a new page with a lot off new pictures.. for the employers.
    What is the best way to do this. Is it possible to do this without a cms system because cms is for me like flying to mars..
    Is there some kind of program so my client can upload some pictures and changes some text on all the pages?
    I will be happy to hear from you..
    Regards Brian

    Hi thank you for your response,
    but when i replace the text my whole left column dissapears. Must i replace the first text or just add it can you tell me where to put it?
    Welkome bij TLM Goldman<br />
    TLM Goldman levert sinds 2007 consultingdiensten in de branche Trading & Investments. De focus van onze cliënten ligt op de handel in financiële instrumenten en derivaten zoals aandelen, obligaties, energie, carbon, opties, equity swaps, futures en gerelateerde producten. TLM Goldman zet zich in voor zijn cliënten opdat zij concurrerend blijven in hun markt, operationele voordelen behalen en aan internationale wet- en regelgeving voldoen.
    Date: Mon, 24 May 2010 15:54:07 -0600
    From: [email protected]
    To: [email protected]
    Subject: Ive finished my first website now my next problem, who can help?
    Switch to Code View.
    <div id="left_column">
    h3. Welcome to TLM Goldman
    <!begin Cushy CMS editable division>
    <div class="cushycms">
    </div>  <!end cushycms>
    </div>  <!end left_column>
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com
    >

  • I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    Please note that running out of date versions of Firefox is not recommended, as you will open yourself up to known security issues, alongside bugs and other issues. Is there a specific problem you are having with Firefox that I can help you with?
    You can download Firefox 9 at [http://ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/ ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/]

Maybe you are looking for

  • Required File In Use - ERROR

    I just purchased a 8Gb Nano, I have it formatted for Mac. When I connect it via the USB cable, iTunes{7.0 (70)} launches almost immediately. I get the following error message: The iPod "iPod Nano" cannot be updated. The required file is in use. I hav

  • Can't export large movies

    I'm having a problem in iMovie where the larger the movie is, the lower quality I can export it in. iMovie either always quits unexpectedly, or the export just stops and iMovie keeps running. I never had this problem on my old MacBook (late 2009) run

  • VL10A Issue

    Hi The user is unable to create delivery from a sales order that is appearing in the Delivery Due List (VL10A). When I checked the error log in delivery creation, its says for item xxx After product selection, there is a remaining quantity of  12 NOS

  • HELP (after XSAN controller crash files are not accessible)

    Hi, We are having a major issue with one of our XSAN setups. During my breah one of the Xsan controller crashed and burned. So a college that to resuce it by rebuilding the contoller and adding the Luns to the Xsan volume. The files are not showing u

  • Problem with Reset

    Hi friends... I got one view iny application where i have few drop down list and input fields... i hve two buttons submuit and reset... when i submit i will get the table based on the i/ps from dropdownlist..... my requirement is  I have Reset button