[jsword-svn] r1911 - in trunk/common-swing/src/main/java/org/crosswire/common: config/swing swing
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Mon Jul 28 12:33:02 MST 2008
Author: dmsmith
Date: 2008-07-28 12:33:02 -0700 (Mon, 28 Jul 2008)
New Revision: 1911
Modified:
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java
Log:
Fixed and improved layout of Options.
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java 2008-07-25 19:00:43 UTC (rev 1910)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java 2008-07-28 19:33:02 UTC (rev 1911)
@@ -112,8 +112,7 @@
dialog.setTitle(config.getTitle());
// size and position
- dialog.setSize(800, 500);
- dialog.pack();
+ dialog.setSize(1000, 500);
GuiUtil.centerOnScreen(dialog);
dialog.setModal(true);
@@ -158,10 +157,6 @@
{
screenToLocal();
al.actionPerformed(ev);
- if (dialog != null)
- {
- dialog.pack();
- }
}
/**
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java 2008-07-25 19:00:43 UTC (rev 1910)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java 2008-07-28 19:33:02 UTC (rev 1911)
@@ -24,7 +24,6 @@
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
-import java.awt.Dimension;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Iterator;
@@ -34,6 +33,7 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
import javax.swing.JTree;
import javax.swing.SwingConstants;
import javax.swing.event.EventListenerList;
@@ -48,6 +48,7 @@
import org.crosswire.common.config.Choice;
import org.crosswire.common.config.Config;
import org.crosswire.common.swing.CWScrollPane;
+import org.crosswire.common.swing.FixedSplitPane;
import org.crosswire.common.swing.FormPane;
import org.crosswire.common.swing.GuiUtil;
@@ -81,7 +82,6 @@
blank.add(new JLabel(UserMsg.SELECT_SUBNODE.toString()));
deck.setLayout(layout);
- deck.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
deck.add(blank, BLANK);
dtcr.setLeafIcon(TASK_ICON_SMALL);
@@ -89,7 +89,6 @@
// These settings will need to change if we have a true tree.
tree.setModel(ctm);
tree.setCellRenderer(dtcr);
- tree.setPreferredSize(new Dimension(150, 150));
tree.setShowsRootHandles(false);
tree.setRootVisible(false);
tree.putClientProperty("JTree.lineStyle", "None"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -104,7 +103,6 @@
title.setIcon(TASK_ICON_LARGE);
title.setFont(getFont().deriveFont(Font.PLAIN, 16));
- title.setPreferredSize(new Dimension(30, 30));
title.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
title.setBackground(Color.gray);
title.setForeground(Color.white);
@@ -112,24 +110,22 @@
title.setText(UserMsg.PROPERTIES.toString());
title.setAlignmentX(SwingConstants.LEADING);
- // Use this if you want to have the tree touch the bottom. Then add
- // the button panel to content.South
- // JPanel content = new JPanel();
- // content.setLayout(new BorderLayout());
- // content.add(BorderLayout.CENTER, deck);
-
panel.setLayout(new BorderLayout());
- panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
+ panel.setBorder(BorderFactory.createEtchedBorder());
panel.add(BorderLayout.NORTH, title);
panel.add(BorderLayout.CENTER, deck);
- setLayout(new BorderLayout(5, 10));
+ setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- //if (cards > 1)
- add(BorderLayout.LINE_START, new CWScrollPane(tree));
+ JSplitPane sptMain = new FixedSplitPane();
+ sptMain.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
+ sptMain.setDividerLocation(0.25D);
+ sptMain.setResizeWeight(0.25D);
+ sptMain.setLeftComponent(new CWScrollPane(tree));
+ sptMain.setRightComponent(panel);
- add(BorderLayout.CENTER, panel);
+ add(BorderLayout.CENTER, sptMain);
add(BorderLayout.SOUTH, new ButtonPane(this));
GuiUtil.applyDefaultOrientation(this);
}
@@ -168,7 +164,7 @@
{
JScrollPane scroll = new CWScrollPane(card);
scroll.setBorder(BorderFactory.createEmptyBorder());
- deck.add(path, scroll);
+ deck.add(scroll, path);
}
}
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java 2008-07-25 19:00:43 UTC (rev 1910)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java 2008-07-28 19:33:02 UTC (rev 1911)
@@ -21,6 +21,7 @@
*/
package org.crosswire.common.swing;
+import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -45,8 +46,11 @@
*/
public FormPane()
{
- setLayout(new GridBagLayout());
+ setLayout(new BorderLayout());
+ inner = new JPanel(new GridBagLayout());
+ add(inner, BorderLayout.NORTH);
setBorder(BorderFactory.createEmptyBorder());
+ inner.setBorder(BorderFactory.createEmptyBorder());
GuiUtil.applyDefaultOrientation(this);
}
@@ -67,12 +71,12 @@
c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
c.fill = GridBagConstraints.NONE; //reset to default
c.weightx = 0.0; //reset to default
- add(label, c);
+ inner.add(label, c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
- add(comp, c);
+ inner.add(comp, c);
comps.put(prompt + SUFFIX_LABEL, label);
comps.put(prompt + SUFFIX_COMP, comp);
@@ -87,8 +91,8 @@
JLabel label = (JLabel) comps.get(prompt + SUFFIX_LABEL);
Component comp = (Component) comps.get(prompt + SUFFIX_COMP);
- remove(label);
- remove(comp);
+ inner.remove(label);
+ inner.remove(comp);
comps.remove(prompt + SUFFIX_LABEL);
comps.remove(prompt + SUFFIX_COMP);
@@ -144,6 +148,8 @@
*/
private static final long serialVersionUID = 3258135738867790641L;
+ private JPanel inner;
+
/**
* A store of the available components
*/
More information about the jsword-svn
mailing list