Multiplication Applet gone horribly awry.

Some of the grunge:
I used a BorderLayout, with the multipliers in the NORTH and SOUTH. The table itself is a Panel, with a 9 by 9 GridLayout. The values are stored in the Panel as Labels, and each Label is also part of an array in the Applet. The applet implements TextListener to watch the multipliers, and as the multipliers change the appropriate Labels have their background and foreground colors changed with setBackground() and setForeground.
This is what i was supposed to do, im already way too late to actually pass this in for any credit at this point i just want to get it to work and understand how it works, here is the code i have:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.String;
import java.util.Arrays;
public class multiplier extends Applet{
      Label First = new Label();
      int columnNumber, rowNumber;
      int idx = 0;
      String Labels[];
     TextField tf1 = new TextField();
     TextField tf2 = new TextField();
private TextArea txtarea = new TextArea();
     public void init(){
          Panel p = new Panel();
          p.setLayout(new BorderLayout());
          p.add(tf1, BorderLayout.NORTH);
          p.add(tf2, BorderLayout.SOUTH);
          Panel p2 = new Panel();
          p2.setLayout(new GridLayout(9,9));
          p.add(p2, BorderLayout.CENTER);
          for(rowNumber=1;rowNumber<=9;rowNumber++){
               //System.out.print(rowNumber + "\t   ");
               for(columnNumber=2;columnNumber<=9;columnNumber++){
                    //System.out.print(columnNumber*rowNumber + "\t   ");
               Labels[idx++]=(""+(columnNumber*rowNumber));
               //System.out.println(Arrays.toString(Labels));
               //System.out.print("\n");
}My first problem, my for loop generates the actual values for the multiplication table and they are stored in my Array called Labels, but how do i Add Labels into panel 2???
Thanks, any help would be appreciated

that line of code seemed to work perfectly but now something odd is happening. It compiled and ran without and exceptions, but it went right to a blank screen, but when i clicked reload it flashed the table i wanted with the text areas above and below it then went back to blank screen?!? heres the updated code:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.String;
import java.util.Arrays;
public class multiplier extends Applet{
      Label First = new Label();
      int columnNumber, rowNumber;
      int idx = 0;
      String Labels[];
     TextField tf1 = new TextField();
     TextField tf2 = new TextField();
private TextArea txtarea = new TextArea();
     public void init(){
          Panel p = new Panel();
          p.setLayout(new BorderLayout());
          p.add(tf1, BorderLayout.NORTH);
          p.add(tf2, BorderLayout.SOUTH);
          Panel p2 = new Panel();
          p2.setLayout(new GridLayout(9,9));
          for(rowNumber=1;rowNumber<=9;rowNumber++){
               for(columnNumber=2;columnNumber<=9;columnNumber++){
               p2.add(new Label(" " + (columnNumber*rowNumber)));
               p.add(p2, BorderLayout.CENTER);
               this.add(p);
               //System.out.print("\n");
}

Similar Messages

  • How to Debug multiple Applets in a IDE

    Hi,
    I am relatively new to Java. At work, I have a client-server style application where applets are deployed to the clients in an html page.
    Background:*
    The sequence is something like this:
    - Client goes to the relevant url
    - The returned html page has an embedded login applet
    - Upon successful login, an html page is returned that has two embedded applets
    - On the client side, navigation buttons within the applets take them to other applets
    On the server there is an application running that listens to the relevant socket (that the client sends data to) and sends out appropriate responses and data.
    Question:*
    How do i setup this system in any IDE (any IDE is ok with me) so that i can do the following:
    - Step through and debug the applets (appletviewer doesnt work because it seems to work with independent applets only. In my case, all the applets have relationships among them. eg. unless the login applet successfully completes, the other applets cannot work... etc)
    - Visually view / edit existing applets UI (something like a WYSIWYG tool)
    Thank you so much.
    schinni

    Hi,
    I am actually, working in an applet too, and I also need to debug it. With Eclipse you will easily get it, just click with Right button on the project�s name and choose: Debug As-> Java Applet. You can arrive also by: Debug As-> Open Debug Dialog. At the end you will have a window where you will be able to add the applet parameters in the Parameters tab. Finally you only have to set breakpoint (double click in the left side of any code line) and with F5, F6 and F7 you will get the absolute control. I don't think you've problems even you run multiple applets.
    Hope it helps you (sorry for my poor English).

  • Reinitialization of static data by multiple applets

    Hi,
    I have a problem with initialization of shared static data by multiple applets. I have three applets running inside of different HTML frames in a multi-frame HTML framework. Applets are loaded as JAR files. In addition, every applet has one or two 3rd party JARs listed in the APPLET tag. Applets share the same codebase and run inside the same JVM.
    I use static data to perform the inter-applet communication. This is simply a static list of applet references that is being maintained in the base applet class (all applet classes are inherited from that class). The problem is that when applets get constructed, the static data in the base class sometimes gets reinitialized multiple times. As I understand, the static data should be initialized just once on initial load of the base applet class (applets have the same codebase).
    This problem seems to be caused by the race condition (applets initialize on different threads launched by the browser). Under some circumstances (I change the number and order of JARs, etc.) everything works fine. I can reproduce this problem on both Explorer 5.x and Netscape 4.7 (did not try others). I run applets using native browser's JVM.
    Has anybody had such problem before? Is it caused by the large number of JARs ? Is there any way to guarantee that static data will be initialized once in the multi-applet environment ?
    Thanks,
    hparfen

    Hi,
    Did you find something to solve your problem because I have exactly the same.
    Tony

  • Handling multiple applets inside applet window

    Hi all,
    Does anyone know of a tutorial for handling multiple applets inside an applet window ?? Any suggestions would be greatly appreciated.
    Regards,

    Hello vhhuynh,
    Did you ever get a solution to your question: 'tutorial for handling multiple applets inside an applet window'?
    I have the same situation...
    thanks, msp@duke

  • Forms 11g: Multiple applets same oracle session??

    Hi,
    I am developing an AJAX environment that integrates different technologies, including Forms 11g.
    I need to open multiple forms within the environment, I'm calling to various forms and works fine.
    But the problem is that it opens a database session for each applet that is executed.
    Is it possible to have multiple applets with a unique session of Oracle?
    Did you configure the Forms Service? With the Parameters to environment?
    Thanks in advanced

    That's a feature that would make the whole Forms Community happy. Not me, and most others B-)
    http://talk2gerd.blogspot.com/2011/08/result-of-2011-oracle-forms-poll-part-7.html
    My most wanted would be the same as #1 on that list: reintroduction Client/Server.
    Anyway, as for the OP:
    I am developing an AJAX environment that integrates different technologies, including Forms 11g.Are you looking for something like this?
    http://www.oracle.com/technetwork/articles/adf/wilfred-adf-forms-099635.html

  • Removing imlib2-cvs: "something has gone horribly wrong

    Hi there,
    I did a pacman -Syu today, and pacman wanted to replace imlib2-cvs with imlib2. So far, so good. I said "yes" to the removal, but pacman complained that ffmpeg and adesklets require imlib2-cvs.
    So I deinstalled those two packages.
    Now, if I try to upgrade, I get the following error message:
    error: something has gone horribly wrong
    If I pacman -R imlib2-cvs, it claims that imlib2-cvs is required by adesklets and ffmpeg--even though those two packages have been removed.
    So obviously, something has gone wrong with the pacman "database." Question is: how can I fix it? Delete the entries for adesklets and ffmpeg in /var/lib/pacman? Delete the entry for imlib2-cvs? Do something completely different?
    Some feedback would be much welcome. I hope my system is not broken for good ...
    Cheers,
    -Sascha.rb

    pacman -Rd imlib2-cvs
    pacman -S imlib2
    ... let me install the new imlib2 package, after all. No idea whether it fixed the weird dependency issue I had ("something has gone horribly wrong"), but at least it's working ...

  • Pacman: "something has gone horribly wrong"

    Hi all,
    So I started The Big Xorg Upgrade on my laptop. First I removed xorg (to get around the bitstream fonts conflict) and started pacman -Syu. During the package downloads I noticed that I still use some old configuration where the downloads come from ftp.nethat.com , which is very far from me, whereas now I have a much closer mirror ftp.estpak.ee . So I killed pacman and wget, corrected pacman.conf, and rerun pacman -Syu. The downloads were finished nicely, but then I got the following message:
    checking package integrity...done
    error: something has gone horribly wrong
    I have never seen such an error before, and probably I should not have seen it at all. But still I did:) So can anyone tell me what it is about and under which conditions is it shown? Should I file a bug report?
    Jan
    Edit: I cleared the package cache, downloaded all the packages from the same source and I still get the same message. So it was not a problem caused by the interrupted upgrade (and in fact I have done interrupted upgrades in the past with no problems). Any ideas and/or explanations are greatly welcome.
    Jan

    Cerebral wrote:
    Hm... try upgrading xorg first, maybe?   
    pacman -S xorg
      then the full update?
    Tried that and the message is still the same.
    Cerebral wrote:On an unhelpful note: that's possibly the scariest error message I've ever seen.
    Yeah, Arch is not for cowards:D
    But the mystery still stays ... any comments from the developers?
    Jan

  • Loading multiple applets

    Dear users,
    I am using Gemplus Cards. I am trying to
    load multiple applets with same package ID but
    not able to load. Please can any body
    let me know a set of clean steps or any source of Information
    Docs/Tutorials etc..
    Thanks
    Aslam

    hi!
    I was facing the same problem as you and had it fixed recently. You must change the code from your cardconvert batch file accordingly.
    Keeping in mind the command for the creation of a jca file should remain like this -->
    converter <options> package_name package_aid major_version.minor_version
    So we just change the <options> code to accomodate the additional applets. All else remains unchanged. Hope it helps =)

  • Plugin reloading too slow of multiple applets per page

    Hi,
    I want to share a problem with this community and try to shed some light on this.
    We all know that an applet loads slow when the JVM loads for the first time or when an applets JAR gets loaded. Fine and not the problem here.
    However, applets load too slow when loaded again during the same browser session. Why is this important? Well, in an AJAX-like intranet application you may use multiple applets per page which are loaded again and again as you navigate. The applets could enrich the user experience much the way AJAX does -- if only the applets would not slow down loading of pages.
    For example: we have pages with about 10 applets which take about 4 seconds to reload, or 400 ms per applet. This is disappointingly slow because there is no technical excuse for this -- everything is up and running on the Java side and Flash prooves that loading ActiveX can be fast, too. Moreover, it became slower and slower from 1.1 to 1.5.
    Nobody at Sun or elsewhere seems to care about this. And therefore, the plugin has now became problematic in Ajax-like intranet scenarios.
    This is a pitty and we would very much welcome any kind of activity to improve this.
    Anybody knows why this is slow and what is planned to improve this?

    There is one known optimization (which may be useful for the readers of this topic):
    One may try to keep at least ONE applet with the given EXACT (IDENTICAL archive string) classpath active, e.g., in a frame. This keeps the classloader referenced all the time and avoids reconstruction of the class loader.
    However, we already apply this technique and the question is how to get reloading of applets with a ready classloader as fast as FLASH...

  • Package with multiple applets

    Hi
    I want to install 2 applets on real java card. They both are in the same package and cna use each other.
    How can i do this on JCOP ?
    and what if they are on difference packages and what if i am using some other lib as well ? do i need to install that lib too if yes then how ?
    BR
    Umer

    If your packages and applets are in one JCOP Java Card project, this should be handled for you. You can have multiple applets in a package, you can have multiple instances of a single applet, and you can have multiple packages with multiple applets as well as library packages.
    If you want to access an applet from another applet in the same package, it is like referencing any other class instance. If they are in different packages you need to use shareable objects. This is because of the applet firewall.
    Cheers
    Shane

  • Urgent: How to run Multiple Applets from a URL

    Hi,
    I am developing an applet that needs memory more than 64MB and I have used -Xmx to set it to 128 MB.
    On my web page, I have 3 applications that use the same JAR file of the applet, but the problem is all applets are opened/loaded in same heap space by JVM. So, when I load first applet, it uses 80 MB and when I start 2nd applet, after using 40 MB, it throws OutOfMemory exception.
    Is there a way to start each applet with fresh 128 MB heap space rather than all applets sharing 128 MB heap space?
    Thanks,
    Ajit

    That's some hefty requirements for an applet. I believe that the only way to do the Xmx thing on the client side is to have them manually add it in the JVM arguments section of the Java Plugin Control Panel.
    The browser/plugin is going to use the same JVM to run all 3 applets in a page. I've never seen a way to tell it to do otherwise. The only separation is the applet contexts, but that is more of a security manager grouping thing.
    Maybe you should look into how you can better manage your data so you don't need so much memory.

  • Multiple Applet Instances

    Hi.
    I'm writing an asp application that reports on performance indicators.
    When you click on an item in the report, a window opens to an asp page that interrogates a database for historical data on the selected indicator, passes the results to the client via hidden fields, and the client converts this data into X/Y coordinates that are then passed to an applet that draws a graph. Trouble is, when several instances of the graph window are opened they get overlaid on to each other and when you bring focus back to an overlaid graph, the graph gets re-drawn with the results of the most recent instance of the graph class (I hope my terminology is correct here!) not the instance that it created when it was first opened. The end result is that every instance of the graph window that looses then regains visibility shows the same graph.
    Unexpected!
    I don't have enough Java (yet) to know where to look for a solution, can someone shove me in the right direction?
    Thanks.
    Neil.

    There are only 3 ways I can think of for that to happen.
    1. Your graph applet is querying the db on its own somehow, and when it refreshes, it gets the data from the last query
    2. Your web browser (ie?) gets confused, reloads, and again, you get the new data from the db
    3. Web browser somehow gets its applet cache screwed up and displays the wrong one

  • Master-Detail on multiple applets

    Any help would be greatly appreciated....What I'm trying to do is to create 2 seperate applets with a master detal relationship. For example say in applet1 I have the scott.dept table and applet2 the scott.emp table. How can i link these 2 applets so that navigation in applet 1 affects the result in applet 2.
    Thanks

    I'm not sure how to do this with two separate applets, but you can do it with two separate panels (which may be displayed in separate frames).
    Refer to the thread "Share sessionInfo?" for more info.
    -- Brian

  • Multiple applets problem

    Hi,
    I have applet, which operates some device. It's fine as far as I want to open second applet (in fact the same applet but in new window). The problem is with Internet Explorer, because it uses the first applet window to open the second applet. So in fact it thinks that the first window is same as the second one which I want to open, so simply reloads the content of the window and the first one's content disappears. How can I open that second one in new "applet window"?
    In Firefox it is OK.
    Thanks
    A. J.

    Hi,
    Did you find something to solve your problem because I have exactly the same.
    Tony

  • Reuse ImageIcon across multiple applets

    I have 5 applets and a gif image that all reside in the same JAR file. I have a common class that loads up the gif and then paints it onto a JPanel in each of the applets. When I run the different applets, using Java Plug-in 1.3.1 (IE 5.0), the image displays fine in the first applet i run, but all subsequent applets fail to load it. I'm loading it each time the applet launches using the following method:
    animatedGif = new ImageIcon(
    Toolkit.getDefaultToolkit().getImage(getClass().getResource(imageFileName)));
    Anyone have any idea why it only displays in the first applet launched? Thanks.

    I tried cloning the image, but did not solve the problem. I added code to check the load status of the image, and found that MediaTracker is reporting an ERRORED load status on the second, and subsequent loads. Is there any way to get more specific info on the reason MediaTracker errored? It's not throwing any exceptions.
    animatedGif = new ImageIcon(
              Toolkit.getDefaultToolkit().getImage(getClass().getResource(imageFileName)), "Loading image");
    System.out.println("******** animated GIF=" + animatedGif);
    int err = animatedGif.getImageLoadStatus();
    if (err == MediaTracker.ERRORED) {
         System.out.println("******MediaTracker ERROR");
    } else if (err == MediaTracker.COMPLETE) {
         System.out.println("******MediaTracker COMPLETE");
         }

Maybe you are looking for

  • Apex With SSO not working

    When running htmldb 2.0.00.29 with SSO , we receive ORA-06550: line 2, column 1: PLS-00201: identifier 'WWSEC_SSO_ENABLER_PRIVATE.GENERATE_REDIRECT' must be declared ORA-06550: line 1, column 45: PL/SQL: Statement ignored Error Unable to run portal_s

  • How to relate a report page to a tabular form?

    I have a table called PRODUCT SQL> desc product Name                                      Null?    Type PRODUCTNUMBER                             NOT NULL VARCHAR2(15 CHAR) PRODUCTDESCRIPTION                                 VARCHAR2(30 CHAR) LOCATION

  • Setting 1 dimension in ROLAP mode cause issues, the system try to filter on dynamic set names!

    Hi, I suffer a strange behavior. I have an SSAS 2014 solution which works fine. I do some test to convert 1 dimension in ROLAP mode. (all the other dimensions and partitions are MOLAP only) after this I cant process any cube!!! even a process clear o

  • "Set Reminder" inoperative after DVR recording

    Hello All,  I set the DVR via the website to record a movie. It worked fine, after stopping movie, and saving it for later, I exited the DVR menus. When I try to use the "Set Reminder" function in the TV Listings, a dialog box pops up asking me if I

  • Accruals in Tax Procedure

    Hi Experts, Can any body through some light on Accruals in Tax Procedure and configuration steps for the same.  Thanks in advance