Scrolling applet - need help

I have an applet that contains too much information to fit on the screen, so I need a scrollbar so I can view the rest. The kind of scrollbar that's on the side of a web browser that lets you scroll down to view the rest of the page. It's a class that extends Applet and implements MouseListener and ActionListener. I've looked around the internet for the solution for an hour and found nothing. Any help would be much appreciated

Put a JScrollpane your ScrollPane as the main Panel of your applet, then put the content of your applet in a JPanel yourPanel and finaly call yourScrollPane.setViewPortView(yourPanel).
Try that. It should work.

Similar Messages

  • Filmstrip photo gallery scrolling effect, need help...

    Heya,
    If you visit
    http://www.hookmedia.biz/cabinet_source/v4_f
    and goto the photo gallery you'll notice that the photo gallery
    works well except that the filmstrips doesn't scroll left or right.
    Now, I built this one based off of a Kirupa tutorial, and when the
    photo gallery is in a sepereate .swf it works great. But as soon as
    I copy the frames to my site that particular effect, and only that,
    stops working. Can anyone help me? Thanks!
    You can access the fla at
    http://www.hookmedia.biz/cabinet_source/v4_f/index.fla

    Thanks aniebel, but I think that'll be a last resort for me
    considering I'm nearly done with this one, I just need help fixing
    whatever the issue is. But thanks a ton anyway!
    PS The link to the tutorial is:
    http://www.kirupa.com/developer/mx2004/thumbnails7.htm

  • Mouse scroll, I need help

    Hi
    I'am using java 1.4.2 in my app. The thing is that i want to be able to scroll my JScrollPane, which java 1.4.2 supportes. The problem is that it doesnt work on all clients. Can someone please show me how to make my own scroll, using mouselistner or something or does anyone know why it doesnt work on all computers, and what I can do about it?
    thanx

    Hi
    Try adding all your components to the Scrollpane and set scrollPane.setAutoscrolls(true); so that you can get the vertical and horizontal scroll bars
    for eg:to add a jtable to a scrollpane we use
    scrollPane = new JScrollPane(jTable1);
    jTable1.setBounds(new Rectangle(2, 20, 805, 300));
    scrollPane.setBounds(new Rectangle(2, 20, 805, 280));
    scrollPane.setAutoscrolls(true);
    Hope this helps.
    Thanks

  • Sizing an Applet, Need help.

    The height parameter of the applet tag can be entered either in terms of number of pixels or % of the browser height.
    Is there a way to specify the height as the maximum of two: a fixed size, say, 500 pixels, and a fixed percent, say, 70%, of the browser height? If a Javascript is necessary, could someone help me out with that?
    Thanks in advance,
    Sooby Bhattacharjee, SDSU

    It is possible to use a % height in the html document and resize() the applet (within the applet) to 500 pixels in height if smaller.
    Faifai

  • Basic Math Applet - Need Help

    Hi all,
    I made program work fine as an application, but I cannot get it to work as an applet. I'm trying to write an applet that asks the user to enter two floating-point numbers, obtain the two numbers from the user and draws the sum, product, difference, and quotient of the two numbers.I appreicate any help. My main errors are in the calculations og *,/,-,+ .... I do not know how to fix this though I suspect it simple. Thanks for any help.
    import java.awt.Graphics;
    import javax.swing.*;
    public class Math extends JApplet {
         double sum, product, difference, quotient;
         public void init ()
              String firstNumber,
              secondNumber;
              Double number1,number2;
         firstNumber = JOptionPane.showInputDialog ("Enter first floating pt value" );
         secondNumber = JOptionPane.showInputDialog ("Enter second floating pt value");
         number1 = Double.parseDouble( firstNumber );
         number2 = Double.parseDouble( secondNumber );
         sum = number1 + number2;
         product = number1 * number2;
         difference = number1 - number2;
         quotient = number1 / number2;
         public void paint( Graphics g )
         g.drawRect(15, 10, 270, 20);
         g.drawString("The sum is: " + sum + "\n" +
         "The difference is: " + difference + "\n" + "The qoutient is: "
         + quotient + "\n" + "The product is: " + product, 25,25);
         System.exit (0);
    }

    Arrgg.... When I use this code in HTML it doesn't drop lines.
         public void paint( Graphics g )
         g.drawRect(15, 10, 270, 20);
         g.drawString("The sum is: " + sum + "\n" +
         "The difference is: " + difference + "\n" + "The qoutient is: "
         + quotient + "\n" + "The product is: " + product, 25,25);
    Why are the "\n" not working? Any thoughts?
    HTML:
    <html>
    <applet code="Math.class" width=500 height=200>
    </applet>
    </html>

  • My Applet need help

    Don't get expected results from my Applet
    and Applet does not compile.
    // expected results in the JTextField "box"
    // AF.PA;36,39;4/5/2007;17h35;+1,25;35,53;36,62;35,52;2547827
    // LVMH.PA;84,28;4/3/2007;17h38;+1,16;83,80;84,58;83,32;1963844
    import java.applet.AppletContext;
    import javax.swing.*;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    import java.awt.event.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.*;

    public class ShowDocument extends JApplet
                              implements ActionListener {
        the_URLWindow the_URLWindow;

        public void init() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        createGUI();
            } catch (Exception e) {
                System.err.println("createGUI didn't successfully complete");

        private void createGUI() {
            JButton button = new JButton("Bring up the_URL window");
            button.addActionListener(this);
            add(button);

            JFrame.setDefaultLookAndFeelDecorated(true);
            the_URLWindow = new the_URLWindow(getAppletContext());
            the_URLWindow.pack();

        public void destroy() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        destroyGUI();
            } catch (Exception e) { }
        private void destroyGUI() {
            the_URLWindow.setVisible(false);
            the_URLWindow = null;

        public void actionPerformed(ActionEvent event) {
            the_URLWindow.setVisible(true);

    class the_URLWindow extends JFrame
                            implements ActionListener {
        JTextField the_URL_Field;
        JComboBox choice;
        AppletContext appletContext;

        public the_URLWindow(AppletContext appletContext) {
            super("Show a Document!");
            this.appletContext = appletContext;

            JPanel contentPane = new JPanel(new GridBagLayout());
            setContentPane(contentPane);
            contentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;

            JLabel label1 = new JLabel("the_URL of document to show: ",
                           JLabel.TRAILING);
            add(label1, c);

            the_URL_Field = new JTextField("http://fr.finance.yahoo.com/d/quotes.txt?m=PA&f=sl1d1t1c1ohgv&e=.csv&s=AF.PA&s=LVMH.PA", 20);
            label1.setLabelFor(the_URL_Field);
            the_URL_Field.addActionListener(this);
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 1.0;
            add(the_URL_Field, c);

            JLabel label2 = new JLabel("Window/frame to show it in: ",
                           JLabel.TRAILING);
            c.gridwidth = 1;
            c.weightx = 0.0;
            add(label2, c);

            String[] strings = {
                "(browser's choice)", //don't specify
                "My Personal Window", //a window named "My Personal Window"
                "_blank",             //a new, unnamed window
                "_self",
                "_parent",
                "_top"                //the Frame that contained this applet
            choice = new JComboBox(strings);
            label2.setLabelFor(choice);
            c.fill = GridBagConstraints.NONE;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.insets = new Insets(5,0,0,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(choice, c);
              JTextField box = new JTextField("Results");
              //box.setLines(10);
              box.setColumns(100);
              c.fill = GridBagConstraints.NONE;
              c.gridwidth = GridBagConstraints.REMAINDER;
              c.insets = new Insets(5,100,100,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(box, c);
            JButton button = new JButton("Show document");
            button.addActionListener(this);
            c.weighty = 1.0;
            c.ipadx = 10;
            c.ipady = 10;
            c.insets = new Insets(10,0,0,0);
            c.anchor = GridBagConstraints.PAGE_END;
            add(button, c);
        public void actionPerformed(ActionEvent event) {
            String the_URL_String = the_URL_Field.getText();
            URL the_URL = null;
            try {
                the_URL = new URL(the_URL_String);
            } catch (MalformedURLException e) {
                System.err.println("Malformed URL: " + the_URL_String);

            if (the_URL != null) {
                   box.setText(showDocument(the_URL));// *********** Java Compiler error *************
                   URLConnection conn = the_URL.openConnection();
                   BufferedReader in =
                        new BufferedReader(new InputStreamReader(conn.getInputStream()));
                        String inputLine;

                        while ((inputLine = in.readLine()) != null) {
                             System.out.println(inputLine);
                        in.close();
                   if (choice.getSelectedIndex() == 0) {
                    appletContext.showDocument(the_URL);
                } else {
                    appletContext.showDocument(the_URL,
                          (String)choice.getSelectedItem());
    }Simple but compiler error.
    If I uncomments the following lines:
                   if (choice.getSelectedIndex() == 0) {
                    appletContext.showDocument(the_URL);
                } else {
                    appletContext.showDocument(the_URL,
                          (String)choice.getSelectedItem());
                   */I get the info but the ASCII file is downloaded in my default downloads folder "/Downloads".
    Right now I have 12 dozens of files named "quotes. txt quotes-1.txt etc ... quotes-n.txt"
    correspondind to n clicks on the button. Unmanageable.
    Just want to get the following in my JTextField named "box":
    AF.PA;36,39;4/5/2007;17h35;+1,25;35,53;36,62;35,52;2547827
    LVMH.PA;84,28;4/3/2007;17h38;+1,16;83,80;84,58;83,32;1963844
    1 - If I succeed I will read the content of the JTextField - line by line - do a split(";")
    on each line to get a vector of data and finnally connect with connector/J to
    add records to a mySQL database.
    2 - If I succeed for step 1, I will create a Thread calling the stuff every 20 mn.
    This is my final objective.
    All the working and not working stuff is at http://www.edelphy.com/ShowDocumentOK/ShowDocument.html
    Please help,
    TIA
    Message was edited by: me
    dimitryous
    Message was edited by:
    dimitryous

    // expected results in the JTextField "box"
    // AF.PA;36,39;4/5/2007;17h35;+1,25;35,53;36,62;35,52;2547827
    // LVMH.PA;84,28;4/3/2007;17h38;+1,16;83,80;84,58;83,32;1963844
    import java.applet.AppletContext;
    import javax.swing.*;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    import java.awt.event.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.net.URLConnection;
    import java.io.*;
    public class ShowDocument extends JApplet
                              implements ActionListener {
        the_URLWindow the_URLWindow;
        public void init() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        createGUI();
            } catch (Exception e) {
                System.err.println("createGUI didn't successfully complete");
        private void createGUI() {
            JButton button = new JButton("Bring up the_URL window");
            button.addActionListener(this);
            add(button);
            JFrame.setDefaultLookAndFeelDecorated(true);
            the_URLWindow = new the_URLWindow(getAppletContext());
            the_URLWindow.pack();
        public void destroy() {
            //Execute a job on the event-dispatching thread:
            //creating this applet's GUI.
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        destroyGUI();
            } catch (Exception e) { }
        private void destroyGUI() {
            the_URLWindow.setVisible(false);
            the_URLWindow = null;
        public void actionPerformed(ActionEvent event) {
            the_URLWindow.setVisible(true);
    class the_URLWindow extends JFrame
                            implements ActionListener {
        JTextField the_URL_Field;
        JComboBox choice;
        AppletContext appletContext;
        JTextField box;
        public the_URLWindow(AppletContext appletContext) {
            super("Show a Document!");
            this.appletContext = appletContext;
            JPanel contentPane = new JPanel(new GridBagLayout());
            setContentPane(contentPane);
            contentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;
            JLabel label1 = new JLabel("the_URL of document to show: ",
                           JLabel.TRAILING);
            add(label1, c);
            the_URL_Field = new JTextField("http://fr.finance.yahoo.com/d/quotes.txt?m=PA&f=sl1d1t1c1ohgv&e=.csv&s=AF.PA&s=LVMH.PA", 20);
            label1.setLabelFor(the_URL_Field);
            the_URL_Field.addActionListener(this);
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 1.0;
            add(the_URL_Field, c);
            JLabel label2 = new JLabel("Window/frame to show it in: ",
                           JLabel.TRAILING);
            c.gridwidth = 1;
            c.weightx = 0.0;
            add(label2, c);
            String[] strings = {
                "(browser's choice)", //don't specify
                "My Personal Window", //a window named "My Personal Window"
                "_blank",             //a new, unnamed window
                "_self",
                "_parent",
                "_top"                //the Frame that contained this applet
            choice = new JComboBox(strings);
            label2.setLabelFor(choice);
            c.fill = GridBagConstraints.NONE;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.insets = new Insets(5,0,0,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(choice, c);
              box = new JTextField("Results");
              //box.setLines(10);
              box.setColumns(100);
              c.fill = GridBagConstraints.NONE;
              c.gridwidth = GridBagConstraints.REMAINDER;
              c.insets = new Insets(5,100,100,0);
            c.anchor = GridBagConstraints.LINE_START;
            add(box, c);
            JButton button = new JButton("Show document");
            button.addActionListener(this);
            c.weighty = 1.0;
            c.ipadx = 10;
            c.ipady = 10;
            c.insets = new Insets(10,0,0,0);
            c.anchor = GridBagConstraints.PAGE_END;
            add(button, c);
        public void actionPerformed(ActionEvent event) {
            String the_URL_String = the_URL_Field.getText();
            URL the_URL = null;
            try {
                the_URL = new URL(the_URL_String);
            } catch (MalformedURLException e) {
                System.err.println("Malformed URL: " + the_URL_String);
            if (the_URL != null) {
                   box.setText("Hellooooooooooo");// *********** Java Compiler error *************
              try{     
                   URLConnection conn = the_URL.openConnection();
                   BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                        String inputLine;
                        while ((inputLine = in.readLine()) != null) {
                             System.out.println(inputLine);
                        in.close();
              } catch (Exception e) {
                   e.printStackTrace();
                   if (choice.getSelectedIndex() == 0) {
                    appletContext.showDocument(the_URL);
                } else {
                    appletContext.showDocument(the_URL,
                          (String)choice.getSelectedItem());
    }Create a HTML page as
    <HTML>
    <HEAD>
    <TITLE>ShowDocument</TITLE>
    </HEAD>
    <BODY>
    <H1>ShowDocument</H1>
    <BR>
    <APPLET CODE="ShowDocument" WIDTH=600 HEIGHT=50>
    If you can see this, your browser does not support Java applets.
    </APPLET>
    </BODY>
    </HTML>

  • Display image in applet - need help

    Ive got this code in my applet
    Image image1 = toolkit.getImage("images/background.jpg");
    Which runs fine when run locally, but when I try to run it from a html in a browser it starts to fire off lots of security messages.
    How can i do this?
    the remainder is I set it as my background
    g.drawImage(image, 0, 0, this);

    I have tried the following while running the applet in a browser and it worked...so I guess you can give this a try...
    java.net.URL backgroundImage = getClass().getResource("back.jpg");
    ImageIcon icon = new ImageIcon(backgroundImage);
    and then use this ImageIcon to set the background.

  • Need help with JTextArea and Scrolling

    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    public class MORT_RETRY extends JFrame implements ActionListener
    private JPanel keypad;
    private JPanel buttons;
    private JTextField lcdLoanAmt;
    private JTextField lcdInterestRate;
    private JTextField lcdTerm;
    private JTextField lcdMonthlyPmt;
    private JTextArea displayArea;
    private JButton CalculateBtn;
    private JButton ClrBtn;
    private JButton CloseBtn;
    private JButton Amortize;
    private JScrollPane scroll;
    private DecimalFormat calcPattern = new DecimalFormat("$###,###.00");
    private String[] rateTerm = {"", "7years @ 5.35%", "15years @ 5.5%", "30years @ 5.75%"};
    private JComboBox rateTermList;
    double interest[] = {5.35, 5.5, 5.75};
    int term[] = {7, 15, 30};
    double balance, interestAmt, monthlyInterest, monthlyPayment, monPmtInt, monPmtPrin;
    int termInMonths, month, termLoop, monthLoop;
    public MORT_RETRY()
    Container pane = getContentPane();
    lcdLoanAmt = new JTextField();
    lcdMonthlyPmt = new JTextField();
    displayArea = new JTextArea();//DEFINE COMBOBOX AND SCROLL
    rateTermList = new JComboBox(rateTerm);
    scroll = new JScrollPane(displayArea);
    scroll.setSize(600,170);
    scroll.setLocation(150,270);//DEFINE BUTTONS
    CalculateBtn = new JButton("Calculate");
    ClrBtn = new JButton("Clear Fields");
    CloseBtn = new JButton("Close");
    Amortize = new JButton("Amortize");//DEFINE PANEL(S)
    keypad = new JPanel();
    buttons = new JPanel();//DEFINE KEYPAD PANEL LAYOUT
    keypad.setLayout(new GridLayout( 4, 2, 5, 5));//SET CONTROLS ON KEYPAD PANEL
    keypad.add(new JLabel("Loan Amount$ : "));
    keypad.add(lcdLoanAmt);
    keypad.add(new JLabel("Term of loan and Interest Rate: "));
    keypad.add(rateTermList);
    keypad.add(new JLabel("Monthly Payment : "));
    keypad.add(lcdMonthlyPmt);
    lcdMonthlyPmt.setEditable(false);
    keypad.add(new JLabel("Amortize Table:"));
    keypad.add(displayArea);
    displayArea.setEditable(false);//DEFINE BUTTONS PANEL LAYOUT
    buttons.setLayout(new GridLayout( 1, 3, 5, 5));//SET CONTROLS ON BUTTONS PANEL
    buttons.add(CalculateBtn);
    buttons.add(Amortize);
    buttons.add(ClrBtn);
    buttons.add(CloseBtn);//ADD ACTION LISTENER
    CalculateBtn.addActionListener(this);
    ClrBtn.addActionListener(this);
    CloseBtn.addActionListener(this);
    Amortize.addActionListener(this);
    rateTermList.addActionListener(this);//ADD PANELS
    pane.add(keypad, BorderLayout.NORTH);
    pane.add(buttons, BorderLayout.SOUTH);
    pane.add(scroll, BorderLayout.CENTER);
    addWindowListener( new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    String arg = lcdLoanAmt.getText();
    int combined = Integer.parseInt(arg);
    if (e.getSource() == CalculateBtn)
    try
    JOptionPane.showMessageDialog(null, "Got try here", "Error", JOptionPane.ERROR_MESSAGE);
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Got here", "Error", JOptionPane.ERROR_MESSAGE);
    if ((e.getSource() == CalculateBtn) && (arg != null))
    try{
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 1))
    monthlyInterest = interest[0] / (12 * 100);
    termInMonths = term[0] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 2))
    monthlyInterest = interest[1] / (12 * 100);
    termInMonths = term[1] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 3))
    monthlyInterest = interest[2] / (12 * 100);
    termInMonths = term[2] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Invalid Entry!\nPlease Try Again", "Error", JOptionPane.ERROR_MESSAGE);
    }                    //IF STATEMENTS FOR AMORTIZATION
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 1))
    loopy(7, 5.35);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 2))
    loopy(15, 5.5);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 3))
    loopy(30, 5.75);
    if (e.getSource() == ClrBtn)
    rateTermList.setSelectedIndex(0);
    lcdLoanAmt.setText(null);
    lcdMonthlyPmt.setText(null);
    displayArea.setText(null);
    if (e.getSource() == CloseBtn)
    System.exit(0);
    private void loopy(int lTerm,double lInterest)
    double total, monthly, monthlyrate, monthint, monthprin, balance, lastint, paid;
    int amount, months, termloop, monthloop;
    String lcd2 = lcdLoanAmt.getText();
    amount = Integer.parseInt(lcd2);
    termloop = 1;
    paid = 0.00;
    monthlyrate = lInterest / (12 * 100);
    months = lTerm * 12;
    monthly = amount *(monthlyrate/(1-Math.pow(1+monthlyrate,-months)));
    total = months * monthly;
    balance = amount;
    while (termloop <= lTerm)
    displayArea.setCaretPosition(0);
    displayArea.append("\n");
    displayArea.append("Year " + termloop + " of " + lTerm + ": payments\n");
    displayArea.append("\n");
    displayArea.append("Month\tMonthly\tPrinciple\tInterest\tBalance\n");
    monthloop = 1;
    while (monthloop <= 12)
    monthint = balance * monthlyrate;
    monthprin = monthly - monthint;
    balance -= monthprin;
    paid += monthly;
    displayArea.setCaretPosition(0);
    displayArea.append(monthloop + "\t" + calcPattern.format(monthly) + "\t" + calcPattern.format(monthprin) + "\t");
    displayArea.append(calcPattern.format(monthint) + "\t" + calcPattern.format(balance) + "\n");
    monthloop ++;
    termloop ++;
    public static void main(String args[])
    MORT_RETRY f = new MORT_RETRY();
    f.setTitle("MORTGAGE PAYMENT CALCULATOR");
    f.setBounds(600, 600, 500, 500);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    }need help with displaying the textarea correctly and the scroll bar please.
    Message was edited by:
    new2this2020

    What's the problem you're having ???
    PS.

  • 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.

  • Need HELP with Stick Figure Applet

    I need help with this java program for college....we need to make a applet which displays a stick figure or some type of person using appleviewer..please can someone help me......
    email: [email protected]

    import java.awt.*;
    import java.applet.*;
    public class StickMan extends Applet {
         public void init() {
         public void paint(Graphics g) {
              g.drawOval(....);
              g.drawLine(....);
              g.drawLine(....);
              g.drawLine(....);
              g.drawLine(....);

  • I need help in establishing a smale applet

    Pleaze i need help in creating this small program. any one can help me pleaze.
    All what is required is to write a java applet, that does the following:
    1) Creates an empty file on the client side. The name of the file is given
    by the client user.
    2) Reads a file (example: c:\tmp\toto.txt) from the client side. The name
    of the file is given by the client user. If the file does not exist, the
    applet should display a message error �File does not exist�.
    pleaze help me in thaaaaaat :(

    Applets cannot access client files by default: In order to do either of these you will need to sign your applet. Google for applet signing and see what you find.

  • I need help with the Quote applet.

    Hey all,
    I need help with the Quote applet. I downloaded it and encoded it in the following html code:
    <html>
    <head>
    <title>Part 2</title>
    </head>
    <body>
    <applet      codebase="/demo/quote/classes" code="/demo/quote/JavaQuote.class"
    width="300" height="125" >
    <param      name="bgcolor"      value="ffffff">
    <param      name="bheight"      value="10">
    <param      name="bwidth"      value="10">
    <param      name="delay"      value="1000">
    <param      name="fontname"      value="TimesRoman">
    <param      name="fontsize"      value="14">
    <param      name="link"      value="http://java.sun.com/events/jibe/index.html">
    <param      name="number"      value="3">
    <param      name="quote0"      value="Living next to you is in some ways like sleeping with an elephant. No matter how friendly and even-tempered is the beast, one is affected by every twitch and grunt.|- Pierre Elliot Trudeau|000000|ffffff|7">
    <param      name="quote1"      value="Simplicity is key. Our customers need no special technology to enjoy our services. Because of Java, just about the entire world can come to PlayStar.|- PlayStar Corporation|000000|ffffff|7">
    <param      name="quote2"      value="The ubiquity of the Internet is virtually wasted without a platform which allows applications to utilize the reach of Internet to write ubiquitous applications! That's where Java comes into the picture for us.|- NetAccent|000000|ffffff|7">
    <param      name="space"      value="20">
    </applet>
    </body>
    </html>When I previewed it in Netscape Navigator, a box with a red X appeared, and this appeared in the console when I opened it:
    load: class /demo/quote/JavaQuote.class not found.
    java.lang.ClassNotFoundException: .demo.quote.JavaQuote.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: \demo\quote\JavaQuote\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
    Exception in thread "Thread-4" 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)What went wrong? and how can I make it run correct?
    Thanks,
    Nathan Pinno

    JavaQuote.class is not where your HTML says it is. That is at the relative URL "/demo/quote/".

  • A Menu Applet Project (need help)

    The Dinner Menu Applet
    I would need help with those codes ...
    I have to write a Java applet that allows the user to make certain choices from a number of options and allows the user to pick three dinner menu items from a choice of three different groups, choosing only one item from each group. The total will change as each selection is made.
    Please send help at [email protected] (see the codes of the project at the end of that file... Have a look and help me!
    INSTRUCTIONS
    Design the menu program to include three soups, three
    entrees, and three desserts. The user should be informed to
    choose only one item from each group.
    Use the following information to create your project.
    Clam Chowder 2.79
    Vegetable soup 2.99
    Peppered Chicken Broth 2.49
    Chicken 12.79
    Fish 10.99
    Beef 14.99
    Vanilla Ice Cream 2.79
    Rice Pudding 2.99
    Cheesecake 4.29
    The user shouldn�t be able to choose more than one item
    from the same group. The item prices shouldn�t be visible to
    the user.
    When the user makes his or her first choice, the running
    total at the bottom of the applet should show the price of
    that item. As each additional item is selected, the running
    total should change to reflect the new total cost.
    The dinner menu should be 200 pixels wide &#56256;&#56437; 440 pixels
    high and be centered on the browser screen. The browser
    window should be titled �The Menu Program.�
    Use 28-point, regular face Arial for the title �Dinner Menu.�
    Use 16-point, bold face Arial for the dinner menu group titles
    and the total at the bottom of the applet. Use 14-point regular
    face Arial for individual menu items and their prices. If you
    do not have Arial, you may substitute any other sans-serif
    font in its place. Use Labels for the instructions.
    The checkbox objects will use the system default font.
    Note: Due to complexities in the way that Java handles
    numbers and rounding, your price may display more than
    two digits after the decimal point. Since most users are used
    to seeing prices displayed in dollars and cents, you�ll need to
    display the correct value.
    For this project, treat the item prices as integers. For example,
    enter the price of cheesecake as 429 instead of 4.29. That
    way, you�ll get an integer number as a result of the addition.
    Then, you�ll need to establish two new variables in place of
    the Total variable. Run the program using integers for the
    prices, instead of float variables with decimals.
    You�ll have the program perform two mathematical functions
    to get the value for the dollars and cents variables. First,
    divide the total price variable by 100. This will return a
    whole value, without the remainder. Then get the mod of the
    number versus 100, and assign this to the cents variable.
    Finally, to display the results, write the following code:
    System.out.println("Dinner Price is $ " + dollars +"." + cents);
    Please send code in notepad or wordpad to [email protected]
    Here are the expectations:
    HTML properly coded
    Java source and properly compiled class file included
    Screen layout as specified
    All menu items properly coded
    Total calculates correctly
    * MenuApplet.java
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    * @author Rulx Narcisse
         E-mail address: [email protected]
    public class MenuApplet extends java.applet.Applet implements ItemListener{
    //Variables that hold item price:
    int clamChowderPrice= 279;
    int vegetableSoupPrice= 299;
    int pepperedChickenBrothPrice= 249;
    int chickenPrice= 1279;
    int fishPrice= 1099;
    int beefPrice= 1499;
    int vanillaIceCreamPrice= 279;
    int ricePuddingPrice= 299;
    int cheeseCakePrice =429;
    int dollars;
    int cents=dollars % 100;
    //cents will hold the modulus from dollars
    Label entete=new Label("Diner Menu");
    Label intro=new Label("Please select one item from each category");
    Label intro2=new Label("your total will be displayed below");
    Label soupsTrait=new Label("Soups---------------------------");
    Label entreesTrait=new Label("Entrees---------------------------");
    Label dessertsTrait=new Label("Desserts---------------------------");
      *When the user makes his or her first choice, the running
         total (i.e. dollars) at the bottom of the applet should show the price of
         that item. As each additional item is selected, the running
         total should change to reflect the new total cost.
    Label theDinnerPriceIs=new Label("Dinner Price is $ "+dollars +"."+cents);
      *Crating face, using 28-point, regular face Arial for the title �Dinner Menu.�
         Using 16-point, bold face Arial for the dinner menu group titles
         and the total at the bottom of the applet & using 14-point regular
         face Arial for individual menu items and their prices.
    Font bigFont = new Font ("Arial", Font.PLAIN,28);
    Font bigFont2 = new Font ("Arial", Font.BOLD,16);
    Font itemFont = new Font ("Arial", Font.PLAIN,14);
    //Here are the radiobutton on the applet...
    CheckboxGroup soupsG = new CheckboxGroup();
        Checkbox cb1Soups = new Checkbox("Clam Chowder", soupsG, false);
        Checkbox cb2Soups = new Checkbox("Vegetable Soup", soupsG, true);
        Checkbox cb3Soups = new Checkbox("Peppered Chicken Broth", soupsG, false);
    CheckboxGroup entreesG = new CheckboxGroup();
        Checkbox cb1Entrees= new Checkbox("Chicken", entreesG, false);
        Checkbox cb2Entrees = new Checkbox("Fish", entreesG, true);
        Checkbox cb3Entrees = new Checkbox("Beef", entreesG, false);
    CheckboxGroup dessertsG = new CheckboxGroup();
        Checkbox cb1Desserts= new Checkbox("Vanilla Ice Cream", dessertsG, false);
        Checkbox cb2Desserts = new Checkbox("Pudding Rice", dessertsG, true);
        Checkbox cb3Desserts = new Checkbox("Cheese Cake", dessertsG, false);
        public void init() {
            entete.setFont(bigFont);
            add(entete);
            intro.setFont(itemFont);
            add(intro);
            intro2.setFont(itemFont);
            add(intro2);
            soupsTrait.setFont(bigFont2);
            add(soupsTrait);
            cb1Soups.setFont(itemFont);cb2Soups.setFont(itemFont);cb3Soups.setFont(itemFont);
            add(cb1Soups); add(cb2Soups); add(cb3Soups);
            cb1Soups.addItemListener(this);cb2Soups.addItemListener(this);cb2Soups.addItemListener(this);
            entreesTrait.setFont(bigFont2);
            add(entreesTrait);
            cb1Entrees.setFont(itemFont);cb2Entrees.setFont(itemFont);cb3Entrees.setFont(itemFont);
            add(cb1Entrees); add(cb2Entrees); add(cb3Entrees);
            cb1Entrees.addItemListener(this);cb2Entrees.addItemListener(this);cb2Entrees.addItemListener(this);
            dessertsTrait.setFont(bigFont2);
            add(dessertsTrait);
            cb1Desserts.setFont(itemFont);cb2Desserts.setFont(itemFont);cb3Desserts.setFont(itemFont);
            add(cb1Desserts); add(cb2Desserts); add(cb3Desserts);
            cb1Desserts.addItemListener(this);cb2Desserts.addItemListener(this);cb2Desserts.addItemListener(this);
            theDinnerPriceIs.setFont(bigFont2);
            add(theDinnerPriceIs);
           public void itemStateChanged(ItemEvent check)
               Checkbox soupsSelection=soupsG.getSelectedCheckbox();
               if(soupsSelection==cb1Soups)
                   dollars +=clamChowderPrice;
               if(soupsSelection==cb2Soups)
                   dollars +=vegetableSoupPrice;
               else
                   cb3Soups.setState(true);
               Checkbox entreesSelection=entreesG.getSelectedCheckbox();
               if(entreesSelection==cb1Entrees)
                   dollars +=chickenPrice;
               if(entreesSelection==cb2Entrees)
                   dollars +=fishPrice;
               else
                   cb3Entrees.setState(true);
               Checkbox dessertsSelection=dessertsG.getSelectedCheckbox();
               if(dessertsSelection==cb1Desserts)
                   dollars +=vanillaIceCreamPrice;
               if(dessertsSelection==cb2Desserts)
                   dollars +=ricePuddingPrice;
               else
                   cb3Desserts.setState(true);
                repaint();
        }

    The specific problem is that when I load he applet, the radio buttons do not work properly and any calculation is made.OK.
    I had a look at the soup radio buttons. I guess the others are similar.
    (a) First, a typo.
    cb1Soups.addItemListener(this);cb2Soups.addItemListener(this);cb2Soups.addItemListener(this);That last one should be "cb3Soups.addItemListener(this)". The peppered chicken broth was never responding to a click. It might be a good idea to write methods that remove such duplicated code.
    (b) Now down where you respond to user click you have:
    Checkbox soupsSelection=soupsG.getSelectedCheckbox();
    if(soupsSelection==cb1Soups)
        dollars +=clamChowderPrice;
    if(soupsSelection==cb2Soups)
        dollars +=vegetableSoupPrice;
    else
        cb3Soups.setState(true);What is that last bit all about? And why aren't they charged for the broth? Perhaps it should be:
    Checkbox soupsSelection=soupsG.getSelectedCheckbox();
    if(soupsSelection==cb1Soups) {
        dollars +=clamChowderPrice;
    } else if(soupsSelection==cb2Soups) {
        dollars +=vegetableSoupPrice;
    } else if(soupsSelection==cb3Soups) {
        dollars +=pepperedChickenBrothPrice;
    }Now dollars (the meal price in cents) will have the price of the soup added to it every time.
    (c) It's not enough to just calculate dollars, you also have to display it to the user. Up near the start of your code you have
    Label theDinnerPriceIs=new Label("Dinner Price is $ "+dollars +"."+cents);It's important to realise that theDinnerPriceIs will not automatically update itself to reflect changes in the dollars and cents variables. You have to do this yourself. One way would be to use the Label setText() method at the end of the itemStateChanged() method.
    (d) Finally, the way you have written itemStateChanged() you are continually adding things to dollars. Don't forget to make dollars zero at the start of this method otherwise the price will go on and on accumulating which is not what you intend.
    A general point: If you have any say in it use Swing (JApplet) rather than AWT. And remember that both Swing and AWT have forums of their own which may be where you get the best help for layout problems.

  • Need help with inserting frame with scrolling images

    Hi,
        Im a beginner and need help putting a single box/frame with scrolling images in the middle of my layout, so that when viewed in browser, the header and footer remain in place, while the images and info in the frame in the centre of the page can be scrolled down/up?

    You can use an iframe element <iframe src="" width="" height="" scrolling="yes"> though if you're concerned with crawlers you should avoid frames as much as possible. 

  • Partial Get via   IE Browser/applet failing ... need help !?

    Partial Get via IE Browser/applet failing ... need help !?
    I recall someone saying that IE client would not receive a partial get initiated by http URL with setRequestProperty("range","bytes=2-");
    Can anyone elaborate on why the client seems to balk at the returned result and the getinputStream seems to result in a FileNotFoundException
    Do I have to use sockets ??????

    Partial Get via IE Browser/applet failing ... need help !?
    I recall someone saying that IE client would not receive a partial get initiated by http URL with setRequestProperty("range","bytes=2-");
    Can anyone elaborate on why the client seems to balk at the returned result and the getinputStream seems to result in a FileNotFoundException
    Do I have to use sockets ??????

Maybe you are looking for