[Schmitzm-commits] r746 - in trunk/src/schmitzm: jfree/feature swing
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 3 13:17:30 CET 2010
Author: alfonx
Date: 2010-03-03 13:17:30 +0100 (Wed, 03 Mar 2010)
New Revision: 746
Modified:
trunk/src/schmitzm/jfree/feature/AggregationFunctionJComboBox.java
trunk/src/schmitzm/swing/SwingUtil.java
Log:
Modified: trunk/src/schmitzm/jfree/feature/AggregationFunctionJComboBox.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/AggregationFunctionJComboBox.java 2010-03-03 12:14:47 UTC (rev 745)
+++ trunk/src/schmitzm/jfree/feature/AggregationFunctionJComboBox.java 2010-03-03 12:17:30 UTC (rev 746)
@@ -1,6 +1,7 @@
package schmitzm.jfree.feature;
import java.awt.Component;
+import java.awt.event.ItemEvent;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JComboBox;
@@ -14,7 +15,8 @@
/**
* A {@link JComboBox} to select one {@link AggregationFunction}s. Can be
- * initialized to also support a <code>null</code>.
+ * initialized to also support a <code>null</code>.<br/>
+ * Note: Different from {@link JComboBox}, this does not fire events for DESELCTED events.
*
* @author SK
*/
@@ -39,7 +41,7 @@
public AggregationFunctionJComboBox() {
this(true);
}
-
+
/**
* A static {@link DefaultListCellRenderer} that will render instances of
* {@link AggregationFunction} with the title and description field as a
@@ -73,5 +75,15 @@
return proto;
}
};
+
+ /**
+ * The {@link JComboBox} does not fire events for DESELCTED event
+ */
+ @Override
+ protected void fireItemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.DESELECTED) return;
+ super.fireItemStateChanged(e);
+ }
+
}
Modified: trunk/src/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/src/schmitzm/swing/SwingUtil.java 2010-03-03 12:14:47 UTC (rev 745)
+++ trunk/src/schmitzm/swing/SwingUtil.java 2010-03-03 12:17:30 UTC (rev 746)
@@ -1168,13 +1168,22 @@
if (e.getWheelRotation() < 0 && upIsUp
|| e.getWheelRotation() > 0 && !upIsUp) {
- if (comboBox.getSelectedIndex() < comboBox.getItemCount() - 1)
+ if (comboBox.getSelectedIndex() < comboBox.getItemCount() - 1) {
+// System.out.println("switching from "
+// + comboBox.getSelectedIndex() + " to "
+// + (comboBox.getSelectedIndex() + 1));
+
comboBox
.setSelectedIndex(comboBox.getSelectedIndex() + 1);
+ }
} else {
- if (comboBox.getSelectedIndex() > 0)
+ if (comboBox.getSelectedIndex() > 0) {
+// System.out.println("switching from "
+// + comboBox.getSelectedIndex() + " to "
+// + (comboBox.getSelectedIndex() - 1));
comboBox
.setSelectedIndex(comboBox.getSelectedIndex() - 1);
+ }
}
}
});
More information about the Schmitzm-commits
mailing list