diff options
| author | Simon Rettberg | 2015-03-05 18:45:29 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2015-03-05 18:45:29 +0100 |
| commit | 04cd6cd0a88bcfddd3aa7937b05ba440fc00f8e9 (patch) | |
| tree | 11b69c823d1bff926027dcc61026eaaa90cf363e /dozentenmodul/src/main/java/gui/helper/ColumnSelector.java | |
| parent | [client] Make SessionData a static class instead of a class that doesn't know... (diff) | |
| download | tutor-module-04cd6cd0a88bcfddd3aa7937b05ba440fc00f8e9.tar.gz tutor-module-04cd6cd0a88bcfddd3aa7937b05ba440fc00f8e9.tar.xz tutor-module-04cd6cd0a88bcfddd3aa7937b05ba440fc00f8e9.zip | |
MACHETE KILLT CODEZEILEN
Diffstat (limited to 'dozentenmodul/src/main/java/gui/helper/ColumnSelector.java')
| -rw-r--r-- | dozentenmodul/src/main/java/gui/helper/ColumnSelector.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/gui/helper/ColumnSelector.java b/dozentenmodul/src/main/java/gui/helper/ColumnSelector.java new file mode 100644 index 00000000..45929614 --- /dev/null +++ b/dozentenmodul/src/main/java/gui/helper/ColumnSelector.java @@ -0,0 +1,30 @@ +package gui.helper; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +import javax.swing.AbstractButton; +import javax.swing.JTable; + +public class ColumnSelector implements ItemListener { + + private final JTable table; + private final Integer[] columns; + + public ColumnSelector(JTable table, Integer... columns) { + this.table = table; + this.columns = columns; + } + + public void itemStateChanged(ItemEvent e) { + if (!(e.getSource() instanceof AbstractButton)) + return; + Boolean checked = e.getStateChange() == ItemEvent.SELECTED; + for (int x = 0, y = table.getRowCount(); x < y; x++) { + for (Integer col : columns) { + table.setValueAt(checked, x, col); + } + } + } + +} |
