how do I veto a setSelected() on JCheckBox
- From: "rob" <rfwalker@xxxxxxxxxxx>
- Date: 24 Feb 2006 07:15:58 -0800
Hello all, I am confused as to how to do this?
I would like the change to veto a setSelected
when the event happens but not sure how to go about this.
If I am in the actionPerformed of a JCheckBox, I guess
at that point it is to late to veto right? I would liek to check
some business logic before allowing the check to take place
by using contstrained properties.
I was thinking I would have define my own checkbox like
MyVetoableCheckBox extends JCheckBox
{
void public setSelected(booleand b) { setVetableSelected(b); }
void public setVetableSelected(boolean b) throws
ProvertyVetoException
{
if( some business logic tells me not to allow the check )
{
Boolean oldValue = isSelected ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = selected ? Boolean.TRUE : Boolean.FALSE;
fireVetoableChange("selected", oldValue, newValue);
}
else
{
super.setSelected(b);
}
}
am I even approaching this right?
.
- Follow-Ups:
- Re: how do I veto a setSelected() on JCheckBox
- From: Knute Johnson
- Re: how do I veto a setSelected() on JCheckBox
- From: Steve W. Jackson
- Re: how do I veto a setSelected() on JCheckBox
- From: Vova Reznik
- Re: how do I veto a setSelected() on JCheckBox
- Prev by Date: Re: How to make Image size as the label has?
- Next by Date: Re: how do I veto a setSelected() on JCheckBox
- Previous by thread: Frames Switching Manager in MDI Java Application
- Next by thread: Re: how do I veto a setSelected() on JCheckBox
- Index(es):
Relevant Pages
|
|