Results 1 to 4 of 4
  1. #1
    elitalobo is offline Member
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Default can someone please help me to debug this choicelist program

    package applets;
    import java.awt.*;
    import java.awt.event.*;

    class TestList extends Frame implements ActionListener
    {
    int msg[];
    List Choice;
    public TestList()
    {
    this.setSize(200, 200);
    FlowLayout layout=new FlowLayout(FlowLayout.LEFT);
    this.setLayout(layout);
    Label label=new Label("select one of these");
    //this.setVisible(true);
    Choice=new List(5,true);
    Choice.add("Windows 98");
    Choice.add("Windows 2000");
    Choice.add("Window Vista");
    Choice.add("Window XP");
    Choice.add("Window 7");
    add(label);
    Choice.addActionListener(this);
    add(Choice);
    this.setVisible(true);
    }
    public void actionPerformed(ActionEvent e) {
    throw new UnsupportedOperationException("Not supported yet.");
    /* try{}
    catch(Exception ae)
    {}*/
    // finally
    // {
    msg=Choice.getSelectedIndexes();
    repaint();

    // }
    }


    public void paint(Graphics g)
    {
    String str="";
    for(int i=0;i<msg.length;i++)
    {


    str=str+" "+ Choice.getItem(msg[i]);
    }
    g.drawString(str, 10, 100);

    }





    }
    class ListControll {
    public static void main(String[]args)
    {
    new TestList();
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: can someone please help me to debug this choicelist program

    Moved from Advanced Java. Please don't post beginner questions in that section. Also, go through the Forum Rules with particular reference to the third paragraph. Then go through Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming and edit your post accordingly.

    Why, in this day and age, are you using AWT which was superseded by Swing more than a decade ago?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,610
    Rep Power
    5

    Default Re: can someone please help me to debug this choicelist program

    Quote Originally Posted by DarrylBurke View Post

    Why, in this day and age, are you using AWT which was superseded by Swing more than a decade ago?

    db
    Not certain about this OP but I've come across a number of folks who are taking courses off of youtube or some other site. All the examples are using AWT. They don't know enough about Java to know that its old tech.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  4. #4
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: can someone please help me to debug this choicelist program

    Can we have some more information? what is wrong with the code? what error messages do you get, are they logic? runtime?

Similar Threads

  1. Replies: 1
    Last Post: 01-18-2011, 06:27 PM
  2. Help Debug
    By Desmond in forum New To Java
    Replies: 9
    Last Post: 03-18-2010, 03:33 PM
  3. Help with debug
    By SwEeTAcTioN in forum New To Java
    Replies: 9
    Last Post: 11-22-2009, 04:39 AM
  4. Debug challenge: how do you debug a Java program?
    By CJSLMAN in forum New To Java
    Replies: 60
    Last Post: 07-04-2009, 10:28 AM
  5. Not able to debug simple hello world program
    By amit123solanki in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 03:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •