Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extending Data Models

Status
Not open for further replies.

kmcculler

Programmer
Jul 5, 2000
81
US
Does anyone know how I can extend an existing model (specifically Im trying for DefaultListModel) to accept a boolean status along with the object in the list?
Im used to programming but new to Java so Im probably just overlooking something simple... Thanks Kris McCuller
Programmer Portiva Corp.
kmcculler@portiva.com
 
Yes that was what I was after and the page you directed to worked rather well.. Thanks alot...
I still have one issue left however..
Now that I have this CheckBoxList built I can't get it to do anything... the checkboxes seem to be disabled (won't check or uncheck after they are initally set my the data) Any ideas how to fix them so they can be changed by the user?? Kris McCuller
Programmer Portiva Corp.
kmcculler@portiva.com
 

Add a listener to the listitem object and set the
the state in some event code. ActionPerformed perhaps.

class MyCellRenderer extends MyObject
implements ListCellRenderer,ActionListener {
public MyCellRenderer () {
addActionListener(this);
}

bla...
bla...
bla...
public void actionPerformed(
this.checkbox.setSelected(!(this.checkbox.getSelected()));

bla...
bla...


 
Sorry that's wrong

It should be the object that you are using as the list
object that implements that ActionLister interface
and the addActionListener(this) should be in the
constructor code for that object not the renderer.
Oops!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top