Applet reloads (applet newbie)

Hi all.
I've got a problem with an applet i'm developing. I try to show a line chart representing values where each point is associated with an image. This is contained within a JPanel and at the same time the JPanel is within a JApplet. The source of the problen is that when the explorer loads the applet, everything is ok but the images that doesn't appear anywhere. I've got two buttons for the user to be able to move from point to point of the chart and, when i click on one of them, the images happens to appear suddenly.
I've tried to refresh the applet just at the end of the init() method using the repaint() method but with no success.
For more info, the applet should run over jre1.4.0 and i'm using MSIE 6.0 because of the specifications of the project.
Any help would be appreciated.
Thanks.

Hi all again. If anyone has read the question thanks. But i have found a solution (don't know if the better one) to the problem i had. I've learned about the MediaTracker class and i've used it to keep track on the images loaded and waiting until all of them have been loaded.
Thanks again.

Similar Messages

  • Java Studio Applet Newbie Tutorials?

    Hello,
    I am a newbie to Java Studio and java in general. However, I do have a vague idea of java thanks to my C++ programming experience.
    I am interested mainly in building java applets with Java Studio Enterprise. Can anyone please direct me to some good tutorials for developing applets with Java Studio, preferebly with "swing". (The only tutorials I could find were for web applications or portlets or things other than applets)
    Thanks a bundle,
    Aviv.

    A few useful links:
    Creating a GUI with JFC/Swing
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    Writing Applets
    http://java.sun.com/docs/books/tutorial/applet/index.html

  • Error loading class problem with applet (Newbie)

    Hi,
    I am new to Java applets. I try to display a simple sample. I put this into html file: <APPLET codebase="classes" code="NewApplet.class" width=350 height=200></APPLET>
    And it always appears one problem:
    Error loading class: NewApplet
    java.lang.NoClassDefFoundError
    java.lang.ClassNotFoundException: NewApplet
         at com/ms/vm/loader/URLClassLoader.loadClass
         at com/ms/vm/loader/URLClassLoader.loadClass
         at com/ms/applet/AppletPanel.securedClassLoad
         at com/ms/applet/AppletPanel.processSentEvent
         at com/ms/applet/AppletPanel.processSentEvent
         at com/ms/applet/AppletPanel.run
         at java/lang/Thread.run
    Can anybody help please? Thanks in advance.

    Now I am able to load the applet on MAC OS X 10.4.11. This is due to network issue.
    Now my problem with the applet functionality. My applet will display the map image. Applet contains the navigation arrow keys at the top left of my applet. These keys will be used to navigate through the map.
    The problem is while user using the navigation buttons, the image got squash and stretch.
    This is happened only on MAC OS X 10.4.11 and Its working fine on PC and MAC OS X 10.5.5.
    Please anyone help in this regard. Thanks in advance.

  • Applet newbie question

    Hello
    I have a class that compiles and executes fine. What do I have to do to have the System.out.println commands show in the applet window. They are just showing on std out. Shouldnt this be automatic? Again sorry for the naivete, but this is where it can be cured, grin.

    An applet isn't a non-writable container. You can write to it. But it's a GUI element, so you don't just write a stream of characters to it like standard output. As has already been explained, you can write to it using graphical commands like java.awt.Graphics.drawString.
    If you absolutely positively need to write a stream of characters to an applet, you can do it, essentially by creating a GUI widget that takes a stream of characters. But it's clumsy.
    So you have two choices:
    1) do it the right way. If you want text in your applet, use Label or Button widgets, or Graphics.drawString
    2) do it the clumsy way. You can create a TextArea and then create a java.io.Writer or a java.io.PrintStream that takes its input and sends it to the TextArea. If you use a PrintStream then you can use System.setOut, thus allowing you to redirect the output from System.out.println commands to the applet, not the console. Of course, by doing so, you're making the console unavailable for regular output which isn't a great idea, but that's the price you pay for being afraid to learn new things.

  • Applet newbie

    I am trying to develop an applet which can read a file on server & displays the same to the client. The File gets updated very frequently and the applets should display the updated version of the file everytime. I am not able to find a solution for this, can anyone show me some code snippet of the same or give some hints

    The subject line says it all.

  • ActionListener: Thread problem in JApplet with JButton?

    Sorry for crossposting, this is my first question on this list, and I posted my question in the "Applet Development" section first. Then I discovered that there is a SWING category as well, which is closer to my problem. So please read about my problem behind this link:
    http://forum.java.sun.com/thread.jspa?threadID=634757
    Thank you very much
    Jan

    Marcin,
    you pointed me in the right direction: I put the .java file in a fresh project and checked the bin folder: And there it was: The missing (second) file the VM was complaining about. I had just forgotten to put all the respective .class files in the webdirectory. Now it works (for a start) with these two files in the webdirectory. I will improve this by creating a jar and Manifest file soon.
    Thanks again
    Jan
    PS: This was truly an (applet) newbie mistake, sorry :-(

  • SJSE8 JTable creation doesn;t show column headers

    I am a swing/applet newbie. I am using SJSE8 GUI Editor to create an applet containing a JTable. When I use the table poperties to set the column headers and defaults data, I see the data but not the header. What am I doing wrong? The generated code follows:
            jTable1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 51)));
            jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][]
                    {"Elimination", "NFL", "$100+$10", "21/100", "June 1st", "Open", "$2100.00"},
                    {null, null, null, null, null, null, null},
                    {null, null, null, null, null, null, null},
                    {null, null, null, null, null, null, null}
                new String []
                    "TYPE", "Sport", "Price", "Players", "Closing", "Status", "Prize Pool"
                Class[] types = new Class []
                    java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
                boolean[] canEdit = new boolean []
                    false, false, false, false, false, false, false
                public Class getColumnClass(int columnIndex)
                    return types [columnIndex];
                public boolean isCellEditable(int rowIndex, int columnIndex)
                    return canEdit [columnIndex];
            jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
            jTable1.setCellSelectionEnabled(true);
            jTable1.setMinimumSize(new java.awt.Dimension(340, 90));
            jTable1.setTableHeader(null);

    Try to place JTable inside of JScrollPane.
    Generated code:
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            jTable1 = new javax.swing.JTable();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            jScrollPane1.setViewportView(jTable1);
            getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            pack();
        }

  • LookAndFeel issue reloading an Applet in a Web page

    Hey all,
    I have an Applet that runs on a web page (loaded by servlets and JSP's using Tomcat 3.2.1 and Apache). I created my own LookAndFeel class and have a static function in the applet that sets the LookAndFeel to my new class. Everything works fine when the Applet is first loaded. However, when you exit the applet and then reload it, the custom LookAndFeel is gone and all I get is the default Metal. If I load the applet with appletviewer, I can reload it as much as I want and it always loads my LookAndFeel class.
    The static function is as follows
    /** Static initializer to set the LookAndFeel
    static {
    try {
    UIManager.setLookAndFeel(new MyNewLookAndFeel());
    catch (Exception e) {}
    I do not get any exceptions and like I said, everything works great when loaded with appletviewer.
    I have tried adding the SwingUtilities.updateComponentTreeUI(this); in either the start(), init(), or my own createGUI() function and it still does not work.
    Any ideas? Could this be a problem with the browser caching the applet? I am using IE 5.50.

    I have the same problem
    putting them in static doesn't keep the look and feel
    putting them in the applet constructor does'nt keep it
    putting them in init() doesn't keep it
    putting them in start() doesn't keep it
    heck, even putting them in all 4 of them together doesn't keep the look and feel, it always reverts back to metal

  • Reloading applet

    Hi all!
    I have been searching for a while for a code that would let me reload my Applet, but I haven't found anything really. Would anyone be able to tell me if there's a code that would allow that to happen.
    It's just that I've created an Applet and there's a button whose event handler must restart the whole Applet but up to now it's not operating at all. I would be grateful if somebody could answer me this.
    Yours,
    Saulo

    All I need is to make the same graphics from the start of the Applet to be displayed once a certain button is clicked. I thought that by realoading the Applet the result would be the same... I tried to put reapeat the code I've written for the beginning on the instance where the button is but that caused me a series of errors. I wonder what that might be, as all I had were components of a paint method.
    Regards,
    Saulo

  • Reloading applet in opera throws NullPointerException in SunGraphics2D

    i have an Applet, which checks for Sun JVM. If MS JVM, it aborts. If Sun JVM, it starts new JApplet.
    Everything is working fine, until i tried to reload the html page with the applet tag in it.
    On MS IE, it is working. The Applet is stopped and then restarted.
    On Mozilla, it is working.
    But on Opera, the following Exception is thrown after i have reloaded the page once.
    After reloading, the Exception is also thrown everytime i scroll the page or reload the page.
    java.lang.NullPointerException
         at sun.java2d.SunGraphics2D.<init>(Unknown Source)
         at sun.awt.image.SunVolatileImage.createGraphics(Unknown Source)
         at java.awt.image.VolatileImage.getGraphics(Unknown Source)
         at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
         at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
         at javax.swing.JComponent.paint(Unknown Source)
         at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
         at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
         at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
         at java.awt.Container.paint(Unknown Source)
         at sun.awt.RepaintArea.paint(Unknown Source)
         at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    As said, i'm using an Applet class and an JApplet class. the Applet class has only AWT components,
    the JApplet class has swing components (a list and a few JButtons).
    i'm using a thread, but it is not started.
    also, after the reload in opera, the whole applet is started again (as usual), and AFTER the last debug message,
    this exception is thrown. so there is no code of myself after that last debug message.
    i am using java 1.4.2-beta, but users told me they have the same problem with my applet on other computers with
    other jvms.

    i tried a beta-version of opera 7.20 and here are some source code line numbers visible:
    perhaps someone can tell me now, what's happening there and give me a tipp how to solve this problem.
    java.lang.NullPointerException
    at sun.java2d.SunGraphics2D.<init>(SunGraphics2D.java:212)
    at sun.awt.image.SunVolatileImage.createGraphics(SunVolatileImage.java:176)
    at java.awt.image.VolatileImage.getGraphics(VolatileImage.java:223)
    at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4768)
    at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4748)
    at javax.swing.JComponent.paint(JComponent.java:798)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
    at java.awt.Container.paint(Container.java:1312)
    at sun.awt.RepaintArea.paint(RepaintArea.java:177)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
    at java.awt.Component.dispatchEventImpl(Component.java:3678)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • Newbie to applets! error message in java console

    hi, i'm kindof new to this, i've created a simple "hello world" applet!
    it doesn't seem to find the class! i've even put it in the bin dir of java. i'm using 1.4
    error message in java console:
    Java(TM) Plug-in: Version 1.4.2_01
    Using JRE version 1.4.2_01 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\mark gandolfo
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class FirstApplet.class not found.
    java.lang.ClassNotFoundException: FirstApplet.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.FileNotFoundException: C:\Program Files\Java\j2re1.4.2_01\bin\FirstApplet\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more

    :) never mind, stupid mistake! (another) but i'm sure there will be more!
    quick question though (so i dont' waste the thread)
    when i close my browser when i've loaded my own applet, the browser eats resources to the point where it freezes my AMD2.4ghz 512mb ram computer! :(
    any suggestions?

  • Applet reloaded : IE 7/8 problem only

    Hello all,
    I have this very weird issue with an applet : it does not stop reloading.
    More precisely, in IE, my applet is loaded in an ajax loaded DOM element. When I remove the DOM element : stop() is first invoked by the browser, but start() follows just after... !!!
    I have tried System.exit() in the destroy method, but depending on the browser and the java version, that may kill the browser itself.
    Has anyone encountered the same issue ? How can one properly dispose of the applet instance ?
    Thanks in advance for your replies.
    Anthony C.

    You may find the solution here:
    http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html

  • Background image/reloading/closing applet

    2 questions:
    1) How do I put a background gif/jpg image on a frame window?
    2) Is there a method or command that can restart or reload the current applet?
    3) What's the best normal way to kill/exit the applet? (System.exit() ?)
    What about browser, how do I close the applet in the browser.
    Appreciate any help.
    Regards,
    Helix
    http://www27.brinkster.com/helixical

    I think if you understand Applet's life cycle clearly you'll find answers to questions 2 and 3:
    init() - initializes the applet for the first time.
    start() - starts the applet after initialization and after every time it was stopped. (answer for your Q2)
    paint() - does the actual painting of the applet.
    stop() - stops the applet (kind of temporary), can be restarted anytime.
    destroy() - kills the applet once for all. (answer for your Q3, call this whenever you want the applet to be destroyed).
    answer to Q1, try the following:
    in init():
    MediaTracker tracker = new MediaTracker (this);
    bgImage = getImage (new URL(getCodeBase(), getParameter("bgImage")));
    tracker.addImage (bgImage, 0);
    tracker.waitForAll();
    public void update( Graphics g) {
    paint(g);
    public void paint(Graphics g) {
    if(bgImage != null) {
    int x = 0, y = 0;
    while(y < size().height) {
    x = 0;
    while(x< size().width) {
    g.drawImage(bgImage, x, y, this);
    x=x+bgImage.getWidth(null);
    y=y+bgImage.getHeight(null);
    else {
    g.clearRect(0, 0, size().width, size().height);
    happy trying...
    iDriZ

  • Browsing pages without applet reloading

    Hi.
    I'm working on a web project that has to keep the applet active over a multiple web pages.
    The applet should be active while the user is logged in. But because the reloading of the page will reload the applet, the work that the applet is doing will be restarted with the loading of the next page.
    So I hope that someone will help me to get over this problem with some advice.
    Regard.

              If you have your jsp workingDir in your WEBLOGICCLASSPATH or your JAVACLASSPATH,
              the jsps may recompile but will not reload.
              If you have your pageCheckSeconds set to -1, the page will not recompile.
              WLS is supposed to check if a JSP has been updated every pageCheckSeconds seconds.
              If you have WLS 5.1.0 sp8 or sp9, your pages may not recompile.
              Mike
              "venkatesh varma" <[email protected]> wrote:
              >
              >Hi Everybody
              >
              >Iam unable to get the jsp pages reloading automatically
              >when i request them..
              >
              >Please help me
              >thanks in Advance
              >venkatesh
              >
              

  • Frames and applet reloading

    Hello
    I have a for performance to stop my applet from reloading. I constructed a simple frameset with my applet in one and the view frame. It works fine the first time. I post out of the view to a struts configuration and to a getInputForward() to just get back with the same session but it reloads the applet. Is there a way to stop an applet from reloading if it is in a separate frame? I know I can use ajax, but would like to make this simpler approach work, if possible. tia.

    Hello
    It does work. I needed to set the input attribute and use the javascript location.reload() to update the page. It is here for some future search, or maybe not if it was so obvious, grin.

Maybe you are looking for

  • Can you lock touch screen when watching videos!??

    Can you lock the screen so it doesn't become a touch screen when watching videos!?? Just got new ipod (7th gen) and this driving me crazy that I think I'm going to continue to use my older one unless there is a solution out there. I watch tv shows wh

  • Error Message When Using a Class Files to Control Navigation

    This is my first attempt at using a class file in a flash project. My intent is to keep all of my navigation elements in class file called "Navigation".  However, I keep getting an error message when I publish. I am using a button to go back to the m

  • JVM heap size and performance

    We are kind of struggling with the good old "out of memory" issue of JVM while running our app on oracle 9i j2ee container (Solaris 2.6). I do not see much discussion about this particular problem in this forum. We are playing with heap allocation, g

  • SLcM integration with Loans Management

    Hi, I am aware that The Financial Accounting - Loans Integration ES bundle provides enterprise services that integrate the operational and analytical bank applications in the area of loan contract management. As SLcM uses Financial Accounting, does i

  • UNA Segment Issue in DMEE Tree

    Hi ,  I am creating custom DMEE trees in tcode DMEE . The issue that i have is with the segment UNA. The output format they want is UNA:+.? ' but i dont know how to get this in the output file ,  i mean i am not sure how to create the element for thi