Added support for enabling/disabling.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@646 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ComboButtonBox.java,v 1.2 2002/03/10 05:27:35 mdb Exp $
|
||||
// $Id: ComboButtonBox.java,v 1.3 2002/03/10 20:28:56 mdb Exp $
|
||||
|
||||
package com.samskivert.swing;
|
||||
|
||||
@@ -90,6 +90,17 @@ public class ComboButtonBox extends JPanel
|
||||
addButtons(0, _model.getSize());
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void setEnabled (boolean enabled)
|
||||
{
|
||||
super.setEnabled(enabled);
|
||||
|
||||
int ccount = getComponentCount();
|
||||
for (int i = 0; i < ccount; i++) {
|
||||
getComponent(i).setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the model in use by the button box.
|
||||
*/
|
||||
@@ -229,6 +240,11 @@ public class ComboButtonBox extends JPanel
|
||||
// documentation inherited from interface
|
||||
public void mousePressed (MouseEvent e)
|
||||
{
|
||||
// ignore if we're not enabled
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// keep track of the selected button
|
||||
_selectedButton = (JLabel)e.getSource();
|
||||
// if the selected button is already selected, ignore the click
|
||||
|
||||
Reference in New Issue
Block a user