[Schmitzm-commits] r1495 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 8 16:07:17 CET 2011


Author: alfonx
Date: 2011-02-08 16:07:17 +0100 (Tue, 08 Feb 2011)
New Revision: 1495

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancelButton.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancellableTabbedDialogAdapter.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/OkButton.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SmallButton.java
Log:
* some GUI tweaking, making buttons smaller
* added tje GpOptios dialog

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancelButton.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancelButton.java	2011-02-08 12:50:03 UTC (rev 1494)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancelButton.java	2011-02-08 15:07:17 UTC (rev 1495)
@@ -43,7 +43,7 @@
  * @author Stefan Alfons Tzeggai
  * 
  */
-public class CancelButton extends JButton {
+public class CancelButton extends SmallButton {
 	public static final Icon ICON_CANCEL_SMALL = new ImageIcon(
 			CancelButton.class.getResource("resource/icons/small/cancel.png"));
 

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancellableTabbedDialogAdapter.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancellableTabbedDialogAdapter.java	2011-02-08 12:50:03 UTC (rev 1494)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/CancellableTabbedDialogAdapter.java	2011-02-08 15:07:17 UTC (rev 1495)
@@ -29,14 +29,34 @@
 			public void insertTab(String title, Icon icon, Component component,
 					String tip, int index) {
 				super.insertTab(title, icon, component, tip, index);
+				// SwingUtil.setPreferredHeight(
+				// CancellableTabbedDialogAdapter.this.getContentPane(),
+				// CancellableTabbedDialogAdapter.this.getContentPane()
+				// .getPreferredSize().height
+				// + buttons.getPreferredSize().height);
 				CancellableTabbedDialogAdapter.this.pack();
+
+				SwingUtil.setHeight(CancellableTabbedDialogAdapter.this
+						.getContentPane(), CancellableTabbedDialogAdapter.this
+						.getContentPane().getHeight() + 22);
+				SwingUtil.setPreferredHeight(
+						CancellableTabbedDialogAdapter.this.getContentPane(),
+						CancellableTabbedDialogAdapter.this.getContentPane()
+								.getHeight() + 22);
+
 			}
 		};
 
+		// Fixing a bug? It seems the the jTabbedPanes are not high enough in
+		// their preferred size
+		// SwingUtil.setMinimumHeight(tabbedPane,
+		// tabbedPane.getMinimumSize().height + 30);
+
 		/**
 		 * Building the content pane
 		 */
-		final JPanel contentPane = new JPanel(new MigLayout("wrap 1"));
+		final JPanel contentPane = new JPanel(new MigLayout(
+				"wrap 1, gap 0, inset 0"));
 		contentPane.add(getTabbedPane());
 		contentPane.add(buttons);
 
@@ -53,7 +73,7 @@
 	 * <code>super.createButtons.add( newButton )</code> to add buttons.
 	 */
 	protected JPanel createButtons() {
-		final JPanel buttonsJPanel = new JPanel(new MigLayout());
+		final JPanel buttonsJPanel = new JPanel(new MigLayout("gap 1, inset 1"));
 
 		final OkButton okButton = new OkButton(new AbstractAction() {
 			{
@@ -69,8 +89,8 @@
 
 				// Set tool tip text
 				putValue(Action.SHORT_DESCRIPTION,
-						"Accept the changes made in this dialog."); // i8n i8n
-																	// i8n
+						"Accept the changes made in this dialog."); // i8n
+
 			}
 
 			//
@@ -80,7 +100,7 @@
 
 		});
 
-		buttonsJPanel.add(okButton, "tag ok");
+		buttonsJPanel.add(okButton, "tag ok, gap 1");
 
 		final CancelButton cancelButton = new CancelButton(new AbstractAction(
 				"") {
@@ -88,7 +108,7 @@
 				cancelClose();
 			}
 		});
-		buttonsJPanel.add(cancelButton, "tag cancel");
+		buttonsJPanel.add(cancelButton, "tag cancel, gap 1");
 
 		return buttonsJPanel;
 	}

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/OkButton.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/OkButton.java	2011-02-08 12:50:03 UTC (rev 1494)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/OkButton.java	2011-02-08 15:07:17 UTC (rev 1495)
@@ -42,10 +42,10 @@
  * 
  * @author <a href="mailto:tzeggai at wikisquare.de">Stefan Alfons Tzeggai</a>
  */
-public class OkButton extends JButton {
+public class OkButton extends SmallButton {
 
-	public static final Icon ICON_OK_SMALL = new ImageIcon(OkButton.class
-			.getResource("resource/icons/small/ok.png"));
+	public static final Icon ICON_OK_SMALL = new ImageIcon(
+			OkButton.class.getResource("resource/icons/small/ok.png"));
 
 	private static final Dimension DIMENSION = new Dimension(35, 25);
 

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SmallButton.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SmallButton.java	2011-02-08 12:50:03 UTC (rev 1494)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SmallButton.java	2011-02-08 15:07:17 UTC (rev 1495)
@@ -2,14 +2,15 @@
 
 import javax.swing.Action;
 import javax.swing.BorderFactory;
+import javax.swing.Icon;
 import javax.swing.JButton;
 
 public class SmallButton extends JButton {
 
 	public SmallButton() {
-		setBorder(BorderFactory.createCompoundBorder(BorderFactory
-				.createEtchedBorder(), BorderFactory.createEmptyBorder(0, 1, 0,
-				3)));
+		setBorder(BorderFactory.createCompoundBorder(
+				BorderFactory.createEtchedBorder(),
+				BorderFactory.createEmptyBorder(0, 1, 0, 3)));
 	}
 
 	public SmallButton(Action action, String tooltip) {
@@ -33,4 +34,9 @@
 		setAction(action);
 	}
 
+	public SmallButton(Icon icon) {
+		this();
+		setIcon(icon);
+	}
+
 }



More information about the Schmitzm-commits mailing list