I've Got A Java Bug. I Need Help!

A Member? Please Login  
type your username and password to login
Date: October 13, 2008, 10:55 PM
249572 members and 148242 Topics
Latest Member: Uzorstan
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  I've Got A Java Bug. I Need Help!
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: I've Got A Java Bug. I Need Help!  (Read 201 views)
danex (m)
I've Got A Java Bug. I Need Help!
« on: January 09, 2007, 08:01 PM »

hi fellow java programmers

can anyone send help on the following:

i was working on an applet. the applet actually is an online music store that is expected to display a list of music titles based on the type of music selected (i.e country, western, pop etc). the lists are check box items whose names are called from a file. when u click on the music type it should automatically generate the list based on the titles stored in the file(  *.that file).

heres my problem:

when a new music type is selected the applet is expected to clear the old list and paste the new one.
how do i achieve this?

anybody with a vivid picture of my bug should please send help. thanks

danex
rookie (m)
Re: I've Got A Java Bug. I Need Help!
« #1 on: January 10, 2007, 03:23 PM »

*Just to clarify -- you do NOT have a bug; you only need a little help

However, It's a little hard to help you in this case since I cannot see the code. First, what kind of applet are you working on? is it a jApplet? From your post I suspect that you might be a little new to Java. The easiest and fastest way to get help online is to search for tutorials on line. You will find tutorial online on almost every topic.

But if my assuption about your  experience with Java is wrong then, you might find this a little useful:

===========================================
String[] items = {"item1", "item2"};

JComboBox cb = new JComboBox(items);

  // Add an item to the start of the list
    cb.insertItemAt("item0", 0);
   
    // Add an item after the first item
    cb.insertItemAt("item0.5", 1);
   
    // Add an item to the end of the list
    cb.addItem("item3");
   
    // Remove first item
    cb.removeItemAt(0);
   
    // Remove the last item
    cb.removeItemAt(cb.getItemCount()-1);
   
    // Remove all items
    cb.removeAllItems();
==========================================

Assuming you are using a JComboBox as your dropdownlist, this should do the trick for you: cb.removeAllItems(); - It removes all items from the combobox.

Since you are working with a data file, you will need to read the data from the file, and add them to the combobox.
You can get help from this link: http://www.devdaily.com/java/edu/pj/pj010004/pj010004.shtml
or better still, you can always search on google for more help
danex (m)
Re: I've Got A Java Bug. I Need Help!
« #2 on: January 12, 2007, 02:38 PM »

 yea u'r right am new to java but not to programming(5years+). i'll see if i can implement ur code. but the only problem is that my method of generating the Checkbox items was not using an array. i generated them automatically using the readline() function in a while loop.

anyway i'll try to implement ur code and send a snippet of my code to see if u can work with it. thanks a billion!

danex Smiley   
 I Need A Tutor In Programming!  Browzer  World Class Ict Training At Price Bottom Prices  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.