summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window
diff options
context:
space:
mode:
authorSteffen Ritter2018-06-18 17:11:17 +0200
committerSteffen Ritter2018-06-18 17:11:17 +0200
commitda3fd66287d7d5350241d235bd65e6e894c5e6c2 (patch)
tree72a9a275dde575eb9a61b9db3055399ac97d6d8a /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window
parent[client] Use WordWrapLabel for HelpText (diff)
downloadtutor-module-da3fd66287d7d5350241d235bd65e6e894c5e6c2.tar.gz
tutor-module-da3fd66287d7d5350241d235bd65e6e894c5e6c2.tar.xz
tutor-module-da3fd66287d7d5350241d235bd65e6e894c5e6c2.zip
[client] Force user to scroll disclaimer down
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window')
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java18
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java4
2 files changed, 21 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
index 4660c8b6..94492d7f 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
@@ -3,10 +3,13 @@ package org.openslx.dozmod.gui.window;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
+import javax.swing.JScrollBar;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.Gui;
@@ -49,6 +52,21 @@ public abstract class GenericNoticeWindow extends GenericNoticeWindowLayout impl
chkAgreeBox.setVisible(false);
btnContinue.setText("Schließen");
btnContinue.setEnabled(true);
+ } else {
+ disclaimerPanel.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
+ @Override
+ public void adjustmentValueChanged(AdjustmentEvent e) {
+ JScrollBar scrollBar = (JScrollBar) e.getAdjustable();
+ int extent = scrollBar.getModel().getExtent();
+
+ int value = e.getValue() + extent;
+ int max = e.getAdjustable().getMaximum();
+
+ if (value >= max) {
+ chkAgreeBox.setEnabled(true);
+ }
+ }
+ });
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java
index 5b036892..56713dd5 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java
@@ -22,6 +22,7 @@ public abstract class GenericNoticeWindowLayout extends JDialog {
protected String info = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise:";
protected JTextArea notice;
+ protected JScrollPane disclaimerPanel;
protected String checkboxText = "Ja, ich akzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen.";
@@ -53,13 +54,14 @@ public abstract class GenericNoticeWindowLayout extends JDialog {
notice.setEditable(false);
notice.setLineWrap(true);
notice.setWrapStyleWord(true);
- JScrollPane disclaimerPanel = new JScrollPane(notice, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ disclaimerPanel = new JScrollPane(notice, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
// checkbox for acknowledging the notice
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
chkAgreeBox = new JCheckBox(checkboxText);
+ chkAgreeBox.setEnabled(false);
buttonPanel.add(chkAgreeBox);
// spacer
buttonPanel.add(Box.createHorizontalGlue());