Hi all,
I am a beginner in Java, making GUI in blueJ. I want to use CheckBoxList for multiple selection from a list for users.. I just want to learn how to make one of that. I saw some codes here .They use some sort of CheckListRenderer. I am also unfamiliar with that ! so someone please Guide me to to so.
Thnaks.

Hi all,
I am a beginner in Java, making GUI in blueJ. I want to use CheckBoxList for multiple selection from a list for users.. I just want to learn how to make one of that. I saw some codes here .They use some sort of CheckListRenderer. I am also unfamiliar with that ! so someone please Guide me to to so.
Thnaks.

here is some links that could help:http://docs.oracle.com/javase/6/docs/api/javax/swing/ListCellRenderer.html and http://www.devx.com/tips/Tip/5342 and also maybe this:http://stackoverflow.com/questions/19766/how-do-i-make-a-list-with-checkboxes-in-java-swing

I don't want to discourage you, but if you are a beginner you will probably find custom renderers and custom editors pretty challenging. Do you really have to use check boxes? Perhaps you can just use an ordinary multiple-selection JList for now?

ya i used jlist for single selection. also tried it for multiple selection but got some error while i was using the method "getSelectedValues()" of jlist in the "OK" JButton. so i thought to use CheckBoxList. i guessed that will be easy :p.. if you help me, how to get multiple selected values in from JList to use them in my program. i will do so.

ya i used jlist for single selection. also tried it for multiple selection but got some error while i was using the method "getSelectedValues()" of jlist in the "OK" JButton. so i thought to use CheckBoxList. i guessed that will be easy :p.. if you help me, how to get multiple selected values in from JList to use them in my program. i will do so.

see here for use of JLists:http://docs.oracle.com/javase/tutorial/uiswing/components/list.html

Easiest way with multiple selections is JList's getSelectedIndices method

public int[] getSelectedIndices()

Returns an array of all of the selected indices, in increasing order, or an empty array if nothing is selected

it too hard to implementing JList & Render with some of dirty hack, use JTable with one Column,

1) JTable with JCheckBox is represented with Boolean value only

2) no required any code for Renderer/Editor, because JTable knows Boolean value

3) JTable must be editable for Editor

4) everything here

ya. thanks. i just want to use the checkboxlist.......... curious you know :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.