From 5ca8e9312f5b06598071b817d984353baacbb387 Mon Sep 17 00:00:00 2001 From: mdb Date: Sun, 10 Mar 2002 20:28:56 +0000 Subject: [PATCH] Added support for enabling/disabling. git-svn-id: https://samskivert.googlecode.com/svn/trunk@646 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../com/samskivert/swing/ComboButtonBox.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/swing/ComboButtonBox.java b/projects/samskivert/src/java/com/samskivert/swing/ComboButtonBox.java index a88c910e..849dfdec 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/ComboButtonBox.java +++ b/projects/samskivert/src/java/com/samskivert/swing/ComboButtonBox.java @@ -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