Need help with advanced applet

I need help with designing an applet as follows. Can someone give me a basic layout of code and material so i can fill in the rest or at leats give me some hints so i can get started since i am like no good at applets.
Design and implement an applet that graphically displays the processing
of a selection sort. Use bars of various heights to represent
the values being sorted. Display the set of bars after each swap. Put
a delay in the processing of the sort to give the human observer a
chance to see how the order of the values changes.
heres a website that does something similar
http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html

elasolova wrote:
i will not help you this time. but if you buy me a candy maybe i can reconsider the issue. :PI suggest an all-day sucker.

Similar Messages

  • Need help with an applet that will only run as an application

    I am working on a slide show applet. The problem is that is won't run as an applet. I added a quite standard main method to stick the applet in a JFrame and this worked. I believe that the problem lies in how I am trying to open the files.
    here are two of the methods that I believe contain part of the problem
         private void showImage( String image_name )
              image_file = Toolkit.getDefaultToolkit().getImage( image_name );
              display_image.loadImage( image_file );
              repaint();
         private void setFileFolder( String folder )
              file_finder = new File( folder );
              file_results = file_finder.list();
         }image_file is an object of class Image, display_image is an object of class ImageComponent (extends JComponent to draw an image), and file_finder and file_results are both objects of class File
    I would greatly appreciate it if some one would help me with this.
    The full source can be found at http://www.geocities.com/enchantedforest/3688/ImSP.zip

    Ok. I got the image loading to work.
    Now how do I fix the second method shown in my first post? It is needed to find all of the images in one specific folder so that the slide show can run.

  • Need help with Java applet, might need NetBeans URL

    I posted the below question. It was never answered, only I was told to post to the NetBeans help forum. Yet I don't see any such forum on this site. Can someone tell me where the NetBeans help forum is located (URL).
    Here is my original question:
    I have some Java source code from a book that I want to compile. The name of the file is HashTest.java. In order to compile and run this Java program I created a project in the NetBeans IDE named javaapplication16, and I created a class named HashTest. Once the project was created, I cut and pasted the below source code into my java file that was default created for HashTest.java.
    Now I can compile and build the project with no errors, but when I try and run it, I get a dialog box that says the following below (Ignore the [...])
    [..................Dialog Box......................................]
    Hash Test class wasn't found in JavaApplication16 project
    Select the main class:
    <No main classes found>
    [..................Dialog Box......................................]
    Does anyone know what the problem is here? Why won't the project run?
    // Here is the source code: *****************************************************************************************************
    import java.applet.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import java.util.*;
    public class HashTest extends Applet implements ItemListener
    // public static void main(String[] args) {
    // Hashtable to add tile images
    private Hashtable imageTable;
    // a Choice of the various tile images
    private Choice selections;
    // assume tiles will have the same width and height; this represents
    // both a tile's width and height
    private int imageSize;
    // filename description of our images
    private final String[] filenames = { "cement.gif", "dirt.gif", "grass.gif",
    "pebbles.gif", "stone.gif", "water.gif" };
    // initializes the Applet
    public void init()
    int n = filenames.length;
    // create a new Hashtable with n members
    imageTable = new Hashtable(n);
    // create the Choice
    selections = new Choice();
    // create a Panel to add our choice at the bottom of the window
    Panel p = new Panel();
    p.add(selections, BorderLayout.SOUTH);
    p.setBackground(Color.RED);
    // add the Choice to the applet and register the ItemListener
    setLayout(new BorderLayout());
    add(p, BorderLayout.SOUTH);
    selections.addItemListener(this);
    // allocate memory for the images and load 'em in
    for(int i = 0; i < n; i++)
    Image img = getImage(getCodeBase(), filenames);
    while(img.getWidth(this) < 0);
    // add the image to the Hashtable and the Choice
    imageTable.put(filenames[i], img);
    selections.add(filenames[i]);
    // set the imageSize field
    if(i == 0)
    imageSize = img.getWidth(this);
    } // init
    // tiles the currently selected tile image within the Applet
    public void paint(Graphics g)
    // cast the sent Graphics context to get a usable Graphics2D object
    Graphics2D g2d = (Graphics2D)g;
    // save the Applet's width and height
    int width = getSize().width;
    int height = getSize().height;
    // create an AffineTransform to place tile images
    AffineTransform at = new AffineTransform();
    // get the currently selected tile image
    Image currImage = (Image)imageTable.get(selections.getSelectedItem());
    // tile the image throughout the Applet
    int y = 0;
    while(y < height)
    int x = 0;
    while(x < width)
    at.setToTranslation(x, y);
    // draw the image
    g2d.drawImage(currImage, at, this);
    x += imageSize;
    y += imageSize;
    } // paint
    // called when the tile image Choice is changed
    public void itemStateChanged(ItemEvent e)
    // our drop box has changed-- redraw the scene
    repaint();
    } // HashTest

    BigDaddyLoveHandles wrote:
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    That wasn't attention-grabbing enough apparantly. Let's try it again.
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}

  • Need Help with Advanced Button Actions

    I am a brand new Captivate 5 user and I have created a image button that I want to have a double action. When the user clicks on the image button, I want it to SHOW a new button AND SHOW another image. I used the Advanced Actions but it does not work when I preview project.  Help!

    Hello and welcome to the forum,
    Did you assign the advanced action to the image button as Success action? And the new button + the image have to be on the same slide, but with the status Invisible. You can not show hidden objects that are sitting on another slide then the slide with the advanced action.
    If you want to have more information about advanced actions, I do blog a lot about them. Here is the link to my blog:
    http://lilybiri.posterous.com
    Lilybiri

  • Need help with Advanced Selection in MSA

    Hi,
    Has anyone managed to identify how to create additional
    advanced selection criteria using links to existing combo engines ? Documentation on Mobile system maint is limited so looking for some additional help. Some criteria you can run the check against but not all why ? What should go in the hierachy fields and how do you select the choice list values ?
    Thanks in advance
    M

    Hi,
    Thanks,my issue is I want to use the combo box so the user can select from the drop down the relevant code from the choice list. Not rocket science really.
    Example of sql generated for profession whch is kna1 field.
    select  KNA1.TITLE,KNA1.SFAKNA2,KNA1.SFAKNA1,KNA1.PROFRESSION as PROFESSION,KNA1.PAFKT,KNA1.NAME2,KNA1.NAME1,KNA1.KVTGRP,KNA1.KVCPPOS,KNA1.KUNNR,KNA1.KTOKD,KNA1.BPACT,KNA1.ANRED,KNA1.ABTNR,ADRC.TELNR_LONG,ADRC.STREET,ADRC.POST_CODE1,ADRC.CITY1,ADRC.ADRCDFLT,ADDR.SFAKNBP , (KNA1.PROFESSION ='MIC') as ReturnValue1 from SMOKNA1 KNA1,SMOADRC ADRC,CDBD_ADDREXT ADDR where kna1.deleted='0' and KNA1.Source='CON' and ADRC.deleted='0' and ADDR.deleted = '0' and (ADRC.ADRCDFLT='S' or ADRC.ADRCDFLT='P') and (1=1) and kna1.sfakna1=adrc.sfakna1 and adrc.sfaadrc = addr.sfaadrc order by kna1.name1
    Code fails !
    I have set VAR1 as a free Combo with Bdoc as Choice, segment as Choice List with fields chkey/Textx so hiearchy fields looks like this //*/Profession hiearchy params being mandt/spras/list
    It will not check is this because there is an error in this definition ?
    Regards
    MM

  • Need help with advanced JTable

    The application I am converting to Java has a string grid (table) with special behavior that I need to be able to bring to the Java version. It let's users filter the column data (that I know how to do) using a locked first row (just below the column header) that always stays in place and that shows what filter is applied to each column (by showing a combo box).
    I usually write server apps and have only been trying to grasp Swing for about a week, and I find myself stuck :(
    Is this at all possible in Java? If not, can I make the header respond to mouse events and show a popup menu for each column? If so how?
    Please help!

    I have made an attempt as follows (to show where I am stuck).
    I have two TableModels that contain rows and data;
    a) the grid data that's coming from our EJB session facade
    b) the filter settings (a String[] with initially empty strings) which show what filter is used for each column.
    The two table models are shown in two tables that share a common TableColumnModel so that whenever i move or resize a column both tables are updated.
    The filter table shows it's header and the row of empty cells. The Table Model I've used for it is ripped from the Sorted Table example from Sun, so that I can capture mouse events, set the sort order for each column and notify the grid table that it needs to update accordingly.
    I attempted to use the filter table as a header view in a JScrollPane, which would keep it in place all the time while the user would be able to scroll and resize the grid table.
    This is where I fail - I can't even get it to show up in the header. And if I only put the two tables on a JPanel it seems impossible to get them to stick together when the pane is resized (aside from the fact that I no longer can capture the mouse events).
    I'd be happy to send someone the code fragments if you think you have a solution to this - that will allow users to resize, edit and move columns in a table where you initially have no clue as to how many columns it will contain.
    Please please continue to help me :)

  • Need help with advanced Query

    I am stuck on a query and hope someone can help me out with
    it. Basically I am trying to get the average score by team who has
    competed in four or more events.
    So far I have my query doing a join to pull in the teams name
    and their category. What I want to do is be able to count the
    unique locations and do an average of the four highest scores on a
    field called overall.
    I have tried putting a couple different COUNT in my query's
    WHERE statement but it errors out.
    Any ideas? Some how I have a feeling I need to create a new
    table.
    Thanks

    chieffan wrote:
    > I am stuck on a query and hope someone can help me out
    with it. Basically I am
    > trying to get the average score by team who has competed
    in four or more events.
    >
    > So far I have my query doing a join to pull in the teams
    name and their
    > category. What I want to do is be able to count the
    unique locations and do an
    > average of the four highest scores on a field called
    overall.
    >
    > I have tried putting a couple different COUNT in my
    query's WHERE statement
    > but it errors out.
    >
    > Any ideas? Some how I have a feeling I need to create a
    new table.
    >
    > Thanks
    You need to use GROUP BY. Will need to know more specifics
    about the
    table construction along with sample data, and an example of
    the
    expected results.
    Dooza

  • Need Help with Advanced Filters

    I hope someone can please help A.S.A.P. my current project
    depends on getting the searches to function correctly I have found
    the Multiple Filters very useful all it needs is a little tweaking,
    I have tried but failed
    1st Main Problem
    The problem with the multiple filter it only work
    alphabetical, I need to be able to filter facilities
    for example a restaurant has up to 10 facilities I would like
    to tick the facility to show the live result
    in the DB there is either a 1 or 0 in the field, so I tried
    the following code
    this is what I am trying to achieve but with the Live
    Searches
    http://www.dinewithus.co.uk/dining/shropshiresearch.php
    var dsCounties = new
    Spry.Data.XMLDataSet("http://www.dinewithus.co.uk/new/xml/county.xml",
    "/counties/county");
    var dsLocation = new Spry.Data.XMLDataSet("
    http://www.dinewithus.co.uk/new/xml/{dsCounties::url2}",
    "export/row");
    var gEffectInProgress = null;
    var gPendingSetRowIDRequest = -1;
    function ffAH(ds, row, index){ var c =
    row.smoking_al_fresco.charAt(0); return c = '1' ? null : row; };
    function ffIP(ds, row, index){ var c =
    row.disabled_access_facilities_fac.charAt(0); return c = '1' ? null
    : row; };
    function ffQZ(ds, row, index){ var c =
    row.real_ales_fac.charAt(0); return c = '1' ? null : row; };
    function ToggleFilter(enable, f)
    if (enable)
    pvLocation.addFilter(f, true);
    else
    pvLocation.removeFilter(f, true);
    function RemoveAllFilters()
    document.forms[0]["fAH"].checked = false;
    document.forms[0]["fIP"].checked = false;
    document.forms[0]["fQZ"].checked = false;
    pvLocation.removeAllFilters(true);
    2nd Issue (not sure if possible?)
    currently using the paging example I am able to show all the
    records in different regions, the only problem is the filter Area
    is a text box I need this to be a dropdown search, fetching
    DISTINCT results from the towns filed in the DB, I managed to do
    this creating another dynamic data set DISTINCT town which showed
    all the towns but once selecting an option did not change the
    results below ideally I need something similar my county search but
    for towns the town are dynamically showing from DB but the counties
    are showing from 1 XML file
    http://www.dinewithus.co.uk/new/xml/county.xml

    That's just it. I select Library or Filters from the Window dropdown menu and neither window opens up. Could it be my 15.4" MacBook Pro screen isn't big enough to see the interface?

  • Need help with java applet

    Hi all,
    Am having trouble with a java applet that won't run under Mozilla, Seamonkey, and IE 6 but will run under IE 7 Beta 2. Am posting the error info below in the hope that someone can see what could be wrong as i don't want to upgrade user's to IE 7 since it's a beta and also since most of them use mozilla. thanks in advance:
    load: class com.crystaldecisions.ReportViewer.ReportViewer not found.
    java.lang.ClassNotFoundException: com.crystaldecisions.ReportViewer.ReportViewer
         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.IOException: open HTTP connection failed.
         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
    Exception in thread "Thread-5" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception in thread "thread applet-com.crystaldecisions.ReportViewer.ReportViewer" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

    BigDaddyLoveHandles wrote:
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    That wasn't attention-grabbing enough apparantly. Let's try it again.
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}
    h1. {color:red}MULTIPOST: [http://forums.sun.com/thread.jspa?threadID=5358840&messageID=10564025]{color}

  • I need help with an applet

    dear experts:
    I need to transfer a single parameter from an applet to a JSP page, in this case a String primitive, how can i do that???
    thank you

    If you are talking client side: use JSObject to talk to javascript.
    Server side connect to the jsp page/servlet with HttpURLConnection opened through a URL instance and send the String/Object or add a query to the url.

  • Need help with my applet. I am new to applets...Please help..please...

    Here is one method from the class:
    public void update(Graphics g) {     
              Dimension d = size();
                   int w = sky.getWidth(this);
              int h = sky.getHeight(this);
                   // If we've loaded the moving image, draw it.
              if ((w > 0) && (h > 0)) {
                   g.drawImage(sky, ((frameNumber*12) % (w+d.width))-w,
         (d.height - h), this);
                   g.drawImage(bird,x,y,this);
    Okay. The applet runs. However, when the sky moves across as the background, as soon as it shifts completely off the view, it gets all wierd and blurry. Then, when it shifts in again, it goes back to normal. It's supposed to go from left to right, start again at the left again, and then go right again...going only right...How do I stop it from getting all wierd?
    Also, the bird image gets all staticky...all I do is increment/decrement the x and y (private int variables) in the keyPressed method (with a multi-way if). I read somewhere the solution to this problem is double-buffering...which I don't understand how to implement with my images....Sky and bird are both GIFs...
    Edited by: LinksApprentice on May 17, 2008 7:49 AM

    If you don't get a great answer (or even if you do) a great resource that I suggest you read is an article entitled [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html] . It will tell you how to formulate your questions so that the folks here will be better able to answer them. Good luck.

  • Need Help with Advanced SQL Query

    It's advanced for me, at least. I have three tables that I
    need to use:
    Product (product_id and product_title are the fields)
    shipRegion (shipRegion_ID)
    product_shipRegion_shipCharge (product_id, shipRegion_ID,
    primaryShipCharge, secondaryShipCharge)
    What I am trying to do is create a query that will look for
    two things:
    1. Any product that is listed in the
    product_shipRegion_shipCharge table that has a primary or secondary
    ship charge of $0.00 or is NULL.
    That part is easy:
    SELECT DISTINCT p.product_id, p.product_title
    FROM product p
    INNER JOIN product_shipRegion_shipCharge pss ON p.product_id
    = pss.product_id AND (pss.primaryShipCharge IS NULL OR
    pss.primaryShipCharge = 0 OR pss.secondaryShipCharge IS NULL OR
    pss.secondaryShipCharge = 0)
    WHERE p.display = 1
    AND p.price > 0
    It's this next part that's tricky for me:
    2. Get the product_id and product_title (from the product
    table) that does NOT have any entry in the
    product_shipRegion_shipCharge table.
    I'm guessing that I need to include some kind of LEFT JOIN in
    the above query to find out what all of the regions are (from the
    shipRegion table) and then see what's missing for each product in
    the product_shipRegion_shipCharge table, but I have no idea how to
    do it.
    Anyone?
    Josh

    This should be what the query would look like using the left
    join:
    SELECT product_table.product_id, product_table.product_title
    FROM product_table
    LEFT OUTER JOIN product_shipRegion_shipCharge
    ON product_shipRegion_shipCharge.product_id =
    product_table.product_id
    WHERE product_shipRegion_shipCharge. product_id IS NULL
    SQL Server's query optimizer will probably turn the '...IN
    (subquery)' or '...exists (subquery)' into this kind of execution
    plan on its own - depending on your table structures.

  • Need help with Drawing applet

    im in the process of making a network whiteboard as a project for college and i was wondering if anyone could help me with a problem im having. When my application minimises or a window is placed over the application the drawing is erased, even if a window is placed over a certain part of the application it erases the part it covers is there any way to stop this from happening i cant seem to fix it, any help is appreciated, thanks

    You should be buffering what the whiteboard is to draw, either as a BufferedImage or in some
    data structure so that you can refresh when asked to repaint. Are you doing that, or are you
    just drawing new graphics as it arrives from the server?

  • Need help with signing applets

    I'm trying to have an applet write a file on the client system, but I'm having issues signing my applet. I think I'm missing something and would appreciate any help. Here are the steps I am taking...
    1) keytool -genkey -alias blah
    2) answer all the questiosn
    3) jar -cvf Applet.jar *
    4) jarsigner Applet.jar blah
    5) applet code in the html file is:
    <applet code=Applet.class archive=Applet.jar width="900" height="600">
    6) run applet: appletviewer Applet.html
    I then get an AccessControlException. What am I missing? Also, why do I still get the AccessControlException when I run my applet through appletviewer? I was under the impression appletviewer automagically gave permissions, and the AccessControlExceptions were only when you tried to run the applet off a server.
    Some test code I'm using (AccessControlException at the System.getProperty line):
                        File out = new File(System.getProperty("user.dir") + "test.txt");
                        FileWriter writer = new FileWriter(out);
                        writer.write("blah");
                        writer.flush();
                        writer.close();

    It works now in my browser, after rebuilding jar and resigning. But it still doesn't work in Appletviewer...

  • Need help with advanced color adjustments

    Hello people,
    A costumer asked me to design a sofa brochure. All product images have the same yellowish lighting and I will have to adjust them of course. But I'm struggling with it.
    What is the best way to have 100% correct colors?

    Once you get a sample, you most likely will have to use curves to correct the color crossover of the color difference between the highlights (too yellow-red) and the shadows too cyan.  Depending upon your other images,  there are several ways to do this.  You can try just using straight curves to adjust the color difference between the highlights and the shadows, you can use color range to select the colors that are off and make a mask to balance those colors with either curves or hue/saturation, or if the other images have a solid color like this one, you can use a solid color adjustment layer set to color blend mode and tweak the blend if sliders to not have the deep shadows return them to a more neutral color.  The left half of the attached image uses the solid color fill layer, and the right half uses color range and curves.

Maybe you are looking for