Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,778,042 members, 6,619,688 topics. Date: Monday, 06 December 2021 at 10:56 PM

I've Got A Java Bug. I Need Help! - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I've Got A Java Bug. I Need Help! (902 Views)

Questions I've Got About Programming / Im A Java Expert Here To Teach Those Who Wants To Learn. / A Java J2me Application Developed By A Nigerian U Need To Have(must) (2) (3) (4)

(1) (Reply)

I've Got A Java Bug. I Need Help! by danex(m): 8:01pm On Jan 09, 2007
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(  *.dat 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 pls send help. thanks

Re: I've Got A Java Bug. I Need Help! by rookie(m): 3:23pm On Jan 10, 2007
*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
    // Remove first item
    // Remove the last item
    // Remove all items

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
Re: I've Got A Java Bug. I Need Help! by danex(m): 2:38pm On Jan 12, 2007
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()[color=#000099][/color] 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

(1) (Reply)

Is This Programming / Coding Habit: What Habits Help You Code? / Lotto Script Need !

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 44
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.