Two Laptop Bag*
The moose likes Swing / AWT / SWT and the fly likes Checkbox items incombobox rendering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checkbox items incombobox rendering" Watch "Checkbox items incombobox rendering" New topic
Author

Checkbox items incombobox rendering

charanjeeta singh
Greenhorn

Joined: Dec 12, 2010
Posts: 2
Hi All,
I am trying to show checkboxes in combobox i.e. each element in the combobox will be a checkbox so that user can

select multiple options in the combobox. This will be same as "AutoFilter Option in MS Excel 2007". After much

googling around, I have the following solution with only one issue pending:


When you run the above code, you will see a combo box with three elements, "Item-A", "Item-B" and "Item-C". All the

three elements are checkboxes so that user can select multiple options. However, if you will select the option which

is already selected in the combobox, its checkbox will not be rendered correctly, even though the state of the

checkbox has changed correctly.
Ex: On running the sample application, if you open the combobox and select the "Item-A", its checkbox will not be

rendered correctly. If you move the mouse over other item (with pop up already opened), you will see the state of

the "Item-A" checkbox has indeed changed but it is not showing correctly. The same thing happens whenever you select

a already selected item in the combobox. It seems there is some rendering issue.
Please help.
Thanks,
Charanjeet
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Charanjeet, welcome to the Ranch! Please BeForthrightWhenCrossPostingToOtherSites.
http://www.java-forums.org/awt-swing/36086-checkbox-items-combox-rendering.html

edit http://forums.oracle.com/forums/thread.jspa?threadID=2143880


luck, db
There are no new questions, but there may be new answers.
charanjeeta singh
Greenhorn

Joined: Dec 12, 2010
Posts: 2
Quite obviously, the person looking for an answer to his/her query will post his query to different forums. And will obvoiusly choose the best answer that he will get from different forums. I dont understand the fuss about it.
Different folks follow different forums so to get the best answer, person will definitely post to different forums.
I have posted this to
Oracle (http://forums.oracle.com/forums/thread.jspa?messageID=9212576&)
Java Forums: http://www.java-forums.org/awt-swing/36086-checkbox-items-combox-rendering.html
Coderanch: http://www.coderanch.com/t/520234/GUI/java/Checkbox-items-incombobox-rendering
Codeguru: http://www.codeguru.com/forum/showthread.php?t=506434
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

charanjeeta singh wrote:Quite obviously, the person looking for an answer to his/her query will post his query to different forums. And will obvoiusly choose the best answer that he will get from different forums. I dont understand the fuss about it.
Different folks follow different forums so to get the best answer, person will definitely post to different forums.

We don't mind cross posting, as long as you tell us (and the other forum users). We might go spending quite a bit of time trying to find a solution, only to then find out that solution was already given on a different forum. It will make us feel like we wasted our time.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

charanjeeta singh wrote:Quite obviously, the person looking for an answer to his/her query will post his query to different forums.

Nothing obvious about it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Checkbox items incombobox rendering
 
Similar Threads
Using JCheckBox as CellRenderer in JComboBox
JCheckBox
any idea about JComboBox Modal? with JDBC
Components inside JComboBox
JComboBox