From 0294881568264a86171b313731133b83fa475f2d Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 31 Jul 2015 18:28:40 +0200 Subject: [client] swingified disclaimer --- .../gui/window/layout/DisclaimerWindowLayout.java | 55 +++++++++++----------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'dozentenmodul') diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java index e8f79ab3..47c027b0 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java @@ -1,13 +1,17 @@ package org.openslx.dozmod.gui.window.layout; -import java.awt.Composite; +import java.awt.BorderLayout; import java.awt.Frame; -import java.awt.GridLayout; -import javax.swing.BoxLayout; +import javax.swing.BorderFactory; +import javax.swing.Box; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; public abstract class DisclaimerWindowLayout extends JDialog { @@ -31,42 +35,39 @@ public abstract class DisclaimerWindowLayout extends JDialog { private static String continueButtonLabel = "Weiter"; // Buttons - protected JButton agreeBox; + protected JCheckBox agreeBox; protected JButton continueButton; public DisclaimerWindowLayout(Frame modalParent) { super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS); - this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); + this.setLayout(new BorderLayout()); // information before the disclaimer // the group - JGroup noticeGroup = new JGroup(this, SWT.NONE); - noticeGroup.setLayout(new GridLayout()); - noticeGroup.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - noticeGroup.setText(noticeLabel); - // text inside the group - JLabel noticeLabel = new JLabel(noticeGroup, SWT.NONE); - noticeLabel.setText(notice); + JLabel noticePanel = new JLabel(); + noticePanel.setBorder(BorderFactory.createTitledBorder(noticeLabel)); + noticePanel.setText(notice); + add(noticePanel, BorderLayout.NORTH); // the disclaimer text box with scrolling functionality - JText disclaimerText = new JText(this, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - GridData disclaimerLayoutData = new GridData(GridData.FILL, GridData.FILL, true, true); - disclaimerLayoutData.widthHint = 900; - disclaimerLayoutData.heightHint = 600; - disclaimerText.setLayoutData(disclaimerLayoutData); - disclaimerText.setText(disclaimer); + JTextArea disclaimerText = new JTextArea(disclaimer, 30, 20); + disclaimerText.setLineWrap(true); + disclaimerText.setWrapStyleWord(true); + JScrollPane disclaimerPanel = new JScrollPane(disclaimerText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + add(disclaimerPanel, BorderLayout.CENTER); // checkbox for acknowledging the disclaimer - Composite checkboxComposite = new Composite(this, SWT.BORDER); - checkboxComposite.setLayout(new GridLayout()); - checkboxComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - agreeBox = new JButton(checkboxComposite, SWT.CHECK); - agreeBox.setText(checkboxText); - + JPanel buttonPanel = new JPanel(); + agreeBox = new JCheckBox(checkboxText); + buttonPanel.add(agreeBox); + // spacer + buttonPanel.add(Box.createGlue()); // the continue button - continueButton = new JButton(this, SWT.PUSH); - continueButton.setText(continueButtonLabel); + continueButton = new JButton(continueButtonLabel); continueButton.setEnabled(false); - continueButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); + buttonPanel.add(continueButton); + add(buttonPanel, BorderLayout.SOUTH); + pack(); } } -- cgit v1.2.3-55-g7522