Is there method to refresh applet?

I was wondering if theres a method to refresh an applet or refresh a panel in an applet. My problem is that at the click of a button i set a new content panel, but it appears as if nothing has happened, and i need to minimize and then restore the applet viewer and it changes.

do you want to refresh component like button, label etc
like
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class applet_component_refresh extends Applet implements ActionListener {
Button[] button;
Button changeButton;
String[] buttonString= {"Normal Text ", "Changed Text"};
int number = 260;
int count;
public void init()
     setBackground(new Color(225,225, 255));
     button = new Button[number];
     for (int i=0; i<number; i++)
          button[i] = new Button(buttonString[count%2]);
          add(button);
     changeButton = new Button("Change buttons label");
     changeButton.setBackground(new Color(150, 255, 150));
     add(changeButton);
     changeButton.addActionListener(this);
public void actionPerformed(ActionEvent ae)
     if (ae.getSource() == changeButton)
          count++;
          for (int i=0; i<number; i++) button[i].setLabel(buttonString[count%2]);
          invalidate();
          validate();
} // END OF Class component_refresh
you cant use location.reload method of javascript to do this....

Similar Messages

  • Trying to Imitate the html POST  method with an applet

    I am trying to imitate the POST method with an applet, so that I can eventually send sound from a microphone to a PHP script which will store it in a file on a server. I am starting out by trying to post a simple line of text by making the PHP script think that it is receiving the text within a POST-ed file. The reason I am doing things this way is in part because I am, for the time being, limited to a shared server without any support for servlets or any other server side java.
    The code I am trying is based in part on an old thread found elsewhere in this forum, concerning sending data to a PHP file by imitating the POST method:
    link:
    http://forum.java.sun.com/thread.jspa?threadID=530399&messageID=2603608
    someone named "harmmeijer" provided most of the answers on that thread. If that person is still around hope they take a look at this,also I have some questions to clarify what they said on the other thread..
    My first attempt at code is below. The applet is in a signed jar file and is trying to pass a text line to the PHP script in the same directory and on the same server that the applet came from. It is doing this by sending header information that is supposed to be identical to what an html form would send if it was uploading a .txt file with the line of text within it. The applet displays one button. When you press it, it sucessfully starts up the postsim method (defined at the end), which is supposed to send the info to the PHP script at the server.
    I have two questions:
    1) I know that the PHP script is starting up, because it prints out a few messages depending on what happens. However, the script does not recognize any file coming down the line, so it does not save anyting on the server, and prints out a message saying the no file was uploaded.
    Any idea what might be going wrong? I'm not getting any error messages from the applet. I've tried a few different variations of the 'header' information contained in the line:
    osToServer.writeBytes("--****4353\r\nContent-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n");
    The commented out line below it shows one variation (which was given in the thread mentioned above).
    2) You'll notice that I've commented out the two lines having to do with the input line:
    //InputStream isFromServer;
    and
    //isFromServer = uc.getInputStream();
    The reason is that the program crahes whenever I put the latter line in - to the extent that Opera closes down the JVM and then crashes when I tried to exit it.. I must be doing something horribly wrong there! I first tried using isFromServer = new DataInputStream(uc.getInputStream());
    becuase it was consistent with the output stream, but that caused the same problem.
    Here's the code:
    public class AudioUptest1 extends Applet{
    //There are a few spurious things defined in this section, having to do with the fact the microphone data is evenuatly going to be sent. haven't yet insterted code to get input from a microphone.
    AudioFormat audioFormat;
    TargetDataLine targetDataLine;
    SourceDataLine sourceDataLine;
    DataOutputStream osToServer;
    //InputStream isFromServer;
    URLConnection uc;
    final JButton captureBtn = new JButton("Capture");
    final JPanel btnPanel = new JPanel();
    public void init(){
    System.out.println("Started the applet");
    try
    URL url = new URL( "http://www.mywebsite.com/handleapplet.php" );
    uc = url.openConnection();
    //Post multipart data
    uc.setDoOutput(true);
    uc.setDoInput(true);
    uc.setUseCaches(false);
    //set request headers
    uc.setRequestProperty("Connection", "Keep-Alive");
    uc.setRequestProperty("HTTP_REFERER", "http://applet.getcodebase");
    uc.setRequestProperty("Content-Type","multipart/form-data; boundary=****4353");
    osToServer = new DataOutputStream(uc.getOutputStream());
    //isFromServer = uc.getInputStream();
    catch(IOException e)
    System.out.println ("Error etc. etc.");
    return;
    //Start of GUI stuff
    captureBtn.setEnabled(true);
    //Register listeners
    captureBtn.addActionListener(
    new ActionListener(){
    public void actionPerformed(
    ActionEvent e){
    captureBtn.setEnabled(false);
    //Postsim method will send simulated POST to PHP script on server.
    postsim();
    }//end actionPerformed
    }//end ActionListener
    );//end addActionListener()
    add(captureBtn);
    add(btnPanel);
    // getContentPane().setLayout(new FlowLayout());
    // setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(250,70);
    setVisible(true);
    }//end of GUI stuff, constructor.
    //These buffers might be made larger.
    byte tempOutBuffer[] = new byte[100];
    byte tempInBuffer[] = new byte[100];
    private void postsim(){
    System.out.println("Got to the postsim method");
    try{
    //******The next four lines are supposed to imitate a POST upload from a form******
    osToServer.writeBytes("--****4353\r\nContent-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n");
    //osToServer.writeBytes("Content-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n");
    //This is the text that's cupposed to be written into the file.
    osToServer.writeBytes("This is a test file");
    osToServer.writeBytes("--****4353--\r\n\r\n");
    osToServer.flush();
    osToServer.close();
    catch (Exception e) {
    System.out.println(e);
    System.out.println("did not sucessfully connect or write to server");
    System.exit(0);
    }//end catch
    }//end method postsim
    }//end AudioUp.java

    Hi All,
    I was trying to write a signed applet that helps the
    user of the applet to browse the local hard disk and
    select a file from the same. The JFileChooser class
    from Swing is what I used in my applet. The problem
    is with the policy file. I am not able to trace the
    exact way to write a policy file which gives a total
    access to read,write,delete,execute on all the drives
    of the local hard disk.
    I am successful in signing the applets and performing
    operations : read,write,delete & execute on a single
    file but failing to grant permission for the entire
    file.
    Any help would be highly appreciated.Which policy file are you using? there might be more than one policy file.
    also, u have to specify the alias of the signed certificate in the policy file to grant the necessary priviledges to the signed applet.

  • Is There A Graceful Refresh of an Interactive Report?

    Hello,
    I have created an Interactive Report and then modified it to get the update functionality for one column, thereby following the
    the clever solution of Roel Hartman:
    http://roelhartman.blogspot.com/2009/11/updateable-interactive-report-websheets.html
    Now all is working quite nicely, only there is one flaw. When I edit an entry and save it, the Interactive Report is refreshed and reset to the first page.
    Therefore, updating a number of rows can become very tedious when you have to navigate back to the resp. page after each edit action.
    I have tried several methods for refreshing the IR [for instance: gReport.search('SEARCH'); gReport.pull(); gReport.reset();] but not found a smart solution for a "graceful refresh" up to now.
    I'm using "window.location.reload();" now in my "save" function, which lets me stay on the current page of the IR on saving.
    Does anyone know of a better solution for this problem?
    Kind regards
    Roland
    PS: I'm using APEX 4.1 and Firefox 9
    Edited by: rbaier on 18.01.2012 04:48

    Hello Tobias,
    yes I have tried using a Dynamic Action. After refreshing, the IR once again displayed the first page.
    Regards
    Roland

  • Problem with using isAuthenticate method in my applet

    Hi everyone
    I want to be sure that everytime that I select my applet the secure channel has been opened. I found isAuthenticate method from SecurityService Interface and I think that I can use this method in my applet's select method for this purpose. But when I declare an object as this type like this:
    SecurityService Objsecurity;
    to use its isAuthenticate method , I'm able to build my code and make the cap file successfully but I recieve error 6F F6 while loading my applet, And I can't find the meaning of this error in GP.
    I'll appreciate it if anyone could tell me how can I use this method in my applet .
    And the other question is is there any other way to find out the authentication have been done or not?
    Best Regards
    Shili

    Hi Pedja,
    Thanks for the prompt reply.
    I have been following the link you mentioned to create ADF security and successfully implementedthe first part where if i directly give any internal page url it redirects me back to login page.
    Instead of using weblogic-sql authenticator, i wanted to manually authenticate the user in loginbean.java where i check the username passowrd against the db.
    I had also implemented the method to access username,password mentioned in the following thread
    Re: ADF security on my jspx  page as login page
    Insted of using authentication.login, i am calling the db method to do the validation.
    The thing is after my db validation it does redirect me to the success page(menu.jspx). but when i click links on menu.jspx it redirects me back to login page.
    so i understand that user is not yet set in the session.
    I am stuck at the point how do i code the login.jspx, currently my login.jspx does not have any j_security_check and i think this is what is creating the problem.
    while searching for adding jsecurity in jspx i landed on the blog of 2006 and started using that.
    Can you please point me to some link which explains how to code login.jspx , i have been trying hard for couple of days.
    Thanks again
    ash

  • Creating methods in an applet

    I am confused on how to create methods in an applet. I know how to create them in an application. However, if an applet, do you create the methods in the Class Header, after the init() method, or the paint (Graphics g) method.
    I am trying to create a method called StudentName where the Student name and class.
    I originally had the method in the class body but I received error messages -- mainly because I hadn't started the paint method yet.
    thanks for your help.
    Here is a sample of the code I am using:
    import javax.swing.*;
    import java.awt.Graphics;
    public class ClassAverageApplet extends JApplet
          String first,second, third, fourth,fifth, name, className;
          double a,b,c,d,e,f, sum;
        public void init() 
          ClassAverageApplet student = new ClassAverageApplet();
          name = JOptionPane.showInputDialog("Student's name please");
          className = JOptionPane.showInputDialog("Class");
          first = JOptionPane.showInputDialog("Please enter first Grade");
          a = Double.parseDouble(first);
          second = JOptionPane.showInputDialog("please enter second Grade");
          b = Double.parseDouble(second);
          third = JOptionPane.showInputDialog("please enter Third Grade");
          c = Double.parseDouble(third);
          fourth = JOptionPane.showInputDialog("please enter Fourth Grade");
          d = Double.parseDouble(fourth);
          fifth= JOptionPane.showInputDialog("please enter Fifth Grade");
          e = Double.parseDouble(fifth);
          f = (a + b + c + d + e)/5;
          sum = a + b + c + d + e;
       public void paint(Graphics g)
          public void StudentName()
             g.drawString("Student:    " + name,25,25);
             g.drawLine(25,25,70,25);
             g.drawString("Class:      " + className,25,40);
             g.drawLine(25,40,60,40);
           g.drawRect(15,10,300,150);
       if(f  > 89)
         student.StudentName();
    //I am replacing these next four statements with the StudentName method
       // g.drawString("Student:    " + name,25,25);
       // g.drawLine(25,25,70,25);
       // g.drawString("Class:      " + className,25,40);
       // g.drawLine(25,40,60,40);
        g.drawString("Your final grade is an A ",25,50);
        g.drawString("The sum of your grades out of 500 points is " + sum ,25,60);
        g.drawString("The grade average is " + f,25,70);
        g.drawString("Here are your grades for the class",70,90);
        g.drawLine(70,90,255,90);
        g.drawString("First Grade:    " + a,25,110);
        g.drawLine(25,110,90,110);
        g.drawString("Second Grade:   " + b ,25,120);
        g.drawLine(25,120,90,120);
        g.drawString("Third Grade:    " + c,25,130);
        g.drawLine(25,130,90,130);
        g.drawString("Fourth Grade:   " + d ,25,140);
        g.drawLine(25,140,90,140);
        g.drawString("Fifth Grade:    " + e,25,150);
        g.drawLine(25,150,90,150);
        }

    i don't think you know what you're talking about. there's no difference between the way you write an applet or application. one has an init() method one has main(String[] args) method. one extends applet, but i won't tell you which.
    i'm sure you need to define half of your methods inside the paint() method and the other half inside the init() method. it does matter what goes where as long as it's half and half. the important thing is to make sure you have an even number of methods, otherwise your applet will behave oddly.

  • Can I access the methods of an applet in a JTabbedPane?

    Hi,
    I have a jtabbedpane that can open multiple windows and in each window the component is a different instatiation of this one applet. I was just wondering if there is any way that I could access the methods of that applet w/in that tabbed pane position. So far I've tried making a copy of the component(the applet), and then access the method of the copy, and then setting the copy to be the component of that tabbed pane, but that just seemed a little resource heavy.
    Thanks, any help is greatly appreciated

    with HTML of course!
    if you want it in the center... do <center> appletcode </center>
    if you want it in the bottom right corner use tables to move it there.

  • JavaScript calls method on Java Applet-- Problem

    Hi all,
    I have a problem as following:
    I have a method on JavaScript calling a method on Java Applet. A method on JavaScript repeatedly retrieves data form the server , let's say; every 100 ms and it calls the method on Java to draw a graph(I use thread to call repaint()). The problem is, if I leave the applet site(or the site has lost the focus), the stop() will be called and I can't recieve data from JavaScript anymore. If I go back to the site, the applet starts, but the graph doesn't show the figure, as it supposes to show.
    how can I tell the browser doesn't call the stop() or there is another way to solve this problem?
    Thanks for all answers. CU.
    A-Pex

    my own fault.. it's not the browser or the applet.. It's my computer.. it's too old for this applet..
    Does anyone know, how to optimize the applet with thread? thanks..

  • Using Firefox 4, the URL bar no longer displays the web address for my current web-site so I can't copy and paste links. Plus there's no refresh button.

    I upgraded to Firefox 4 and so far I really don't like it, but I still would like to give it a chance. However, the URL address bar no longer shows the current address for websites that I surf into. So it makes sharing pages or emailing links next to impossible. In addition to that, there is no Refresh icon that I can find so I'm stuck just hitting F5 to refresh my page.
    Short of downgrading, is there anyway I can change those particular issues?

    That issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Is there any thing called applet loading timeout

    Friends...
    Is there anything known as applet loading timeout....
    One of my applets is geting loaded on intranet 1 which is faster but is not being loading on intranet 2 (a bit slower) keeping everything else same....
    please guide...
    what could be the reason...
    regards
    raghav..

    yes there are no exceptions until it says class not found exception..
    and yes of course they are into a jar file.
    raghav

  • Is there any method like refresh,reload etc

    Sir/Madam,
    when i m trying to add new controls dynamically, in a Frame ,they are not appeariing until we made a click on the window.Is there any method to reload,or refersh or update to make changes without made a click on window.

    validate(); OR repaint(); OR pack(); //this method resizes the frame though...... after you add components to the frame you should call validate();
    David

  • Help with refreshing applet

    If I recompile my applet and try to restart it in Netscape the changes do not take hold. I've tried refreshing and emptying the cache and even setting the cache to 0, but it won't run the new version of the program. The only way I can get it to work is to quit Netscape entirely, restart it, and start the Java program again. Why is this? And is there a way to get around this?
    And there is a a second related problem I have. My applet calls a CGI program and recieves html text in reply. This HTML text I display in a JEditorPane. The first time I run the program it displays it nicely, but everytime after that it displays the HTML commands mixed in with the text, i.e. "<TABLE><TR><TD>text" instead of a table.
    Does anyone know what causes this or how to prevent it?

    Thanks for the help again. I read the API myself and tried adding the new line, but it had no affect. I tried this:
    ResultsDisplay.getEditorKit().createDefaultDocument();
    ResultsDisplay.setContentType("text/html");               
    ResultsDisplay.setText(inputStore.toString());and even this:
    ResultsDisplay = new javax.swing.JEditorPane();
    ResultsDisplay.getEditorKit().createDefaultDocument();
    ResultsDisplay.setContentType("text/html");
    ResultsDisplay.setText(inputStore.toString());But neither solution fixed it.

  • Best method for refreshing a component's data?

    What's better when you want to refresh the content of an object? Should you just replace your JComponent with an entirely new one, or should you try to get access to the data and then remove the items and then re-add them.
    In my example, I have a JTree and am not sure which would be the best method to use. Should I try to remove all the nodes, or sometimes I think it would be easier to just remove the tree component from my panel, create a new tree and re-populate it?
    Thanks for any advice.

    pjbarbour wrote:
    I'm not quite sure what would be the best method for this.  My client is using a 4x3 screen and SD projector at a large meeting, and they want me to just create a DVD that is letterboxed.  I have one Premiere CS5 project that's 1920x1080, and another project that's 720x480 widescreen (1.2).  I created a new sequence in both projects that is 720x480, 4x3 (0.9), and what I do is just scale the timeline down so that it's letterboxed.  Is this the best method for achieving this?  Or would you do something else?  I don't like the idea of scaling my timeline down in Premiere.
    Hello.
    As Jim so rightly points out above, you do not need to do anything.
    Just use your normal 16:9 widescreen footage, and author as normal.
    Your player will letterbox automatically when it is connected to a 4:3 screen in setup (just make sure "Pan & Scan" is not also there)

  • Method to pause applet until all graphics are painted?

    Any method that will pause all threads in an applet to make sure all graphics are painted first? (something similiar to MediaTracker for images).

    I doubt you want to pasue all threads because that would include the one painting the images.
    Pausing threads is a poor way to stop user input. It will make you applet look like it is frozen i.e. crashed.
    There simple ways to stop use input. If you want to keep other things from happening, don't start those threads until the graphics are loaded.
    Use the glass pane feature to stop clicks. To stop keybard input it takes a little more work. An answer lies in these forums somewhere. I think I can find it.

  • Refresh applet display in browser.

    I have a JSP file which has an applet in it. The applet displays the correct text when the JSP is loaded from the server onto the client.
    public void paint(Graphics g) {
    g.drawString("Hello blimp ! ", 15, 15);
    When the screen loads in browser I see "Hello blimp" in the applet window.
    Now I have a public method callMeSucker() in the applet which is called by a javascript function depending on certain action by user.
    public void callMeSucker()
    this.getGraphics().drawString("applet refreshed! ", 15, 15);
    this.validate();
    After the user action I dont see the applet window refreshed with this message "applet refreshed! " . I have alerts around this method call to the applet and they get displayed. This shows that the applet method call is withour error but why is the display not getting refreshed.
    Thx

    This is just a guess, but maybe it is working -- but then the GUI threads call paint() again, immediately overwriting the "applet refreshed!" message so fast that you can't see it. I guess you could call this a conflict between active and passive rendering.
    If this is the case, you could fix it by having a field in the applet, say:
    private String message = "Hello blimp ! ";
    public void paint(Graphics g) {
      g.drawString(message, 15, 15);
    public void callMeSucker() {
      message = "applet refreshed! ";
      repaint();

  • SelectOneChoice value needed for find-method to refresh table

    I would like to implement a filter that will filter the dataset, resultset returned by my adf-table.
    The user has to select a value in the dropdown-list and after he has made a selection the table has to be refreshed using the value of the dropdown as a parameter-value for the find-method.
    I'm using a partialtrigger to raise the refresh-event on my table, autosubmit on my dropdown and partialtrigger-attribute on my table. Now I want to pass the value of the selectOneChoice to the key-value pair used for the find-method in my pageDefinition-file.
    What's the best practice to add this parameter-value?

    Frank,
    We tried the ValueChangeListener already on the selectOneChoice-component, but the listener doesn't get fired when you choose a new value in the selectOneChoice. Only the first time the method in our backing bean is accessed, and no other times.
    We are using datacontrols based on ejb 3.0 session beans as our persistence layer instead of BC and we would like to put the chosen value of the selectOneChoice-component in the parameter of our method binding. We should be able to it in the same manner as you've mentioned in the example, by accessing the paramMap.
    Thanks for the advise !

Maybe you are looking for

  • How to copy a column value in to a variable in Dataflow task?

    Hi All, I want to copy a column value to a variable inside the data flow task. Which is the best way to achieve it in SSIS? Thanks, Sri

  • Viewset - active view and data validation problem

    Hey there, I've a problem while using a viewset (1 col, 2 rows) and the data-validation in the wdDoBeforeAction() method. My application works basically like this: The first view is displayed with 2 mandatory input fields. Upon the evaluation result

  • View Database Tables in Multiple Tabs

    How do you configure JDev to allow you to open and view multiple database tables in multiple tabs. Currently if I open 1 table and then open another, it loads them within the same tab.

  • Poor image quality in export to powerpoint

    When I export a presentation to powerpoint format, the image quality of some elements is poor. Is there any way to preserve the image quality upon export?

  • Dreamweaver CS5-6 What is the difference

    HI I currently use CS4 and am wondering what the difference is between 5 and or 6. Do I need to upgrade? Is it worth the price? I currently most likely use about 40% of the features. Dougas SImons