File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing the values in the list box

 
Anant Rao
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

There are two list box one with
listBox A (2001 English
20002 Maths....)
listBox B (1,2004 French
2,3002 Greek
3,2003 Italian)

Now i want to move data from listBox B to A by removing the content before comma and comma.( that I finished with substring and moving is also done)

Now the problem is suppose if i move Greek from listBox B to A the contents in ListBox B should change such way that
ListBox B(1,2004 French
2,2003 Italian)

i.e the value before comma should change ...
new option adds a new element but how to modify the existing element.

Its kind of urgent

Any help is appreciated,
Infyniti.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. A single name, a joke name, or a "handle" won't work here. You can change your display name here. Thanks for your cooperation.

Note that many people at the Ranch won't answer your questions until you comply.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
assuming the name is now OK, this might be what you're trying to do.
double click any item in the list - the item will be removed, and the
'lower' items re-numbered

 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand correctly, you want the numbering to change so that the items are numbered in increasing order without skipping any numbers when an item is removed. I assume that your "list box" is either a JList or a List. In either case, I think you should create a class that implements ListModel. This class can be responsible for ensuring that the number in front of the rest of the label is correct.

If you are using JComboBox instead, you should implement ComboBoxModel. In either case, the API provides an abstract model that implements many of the details that are often the same between different models. Check out the Java Tutorial for more details on how this works.

Layne
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic