[jsword-svn] r1287 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop bibledesktop/src/main/java/org/crosswire/bibledesktop/display/scrolled bibledesktop/src/main/java/org/crosswire/bibledesktop/passage common-swing/src/main/java/org/crosswire/common/config/swing common-swing/src/main/java/org/crosswire/common/progress/swing common-swing/src/main/java/org/crosswire/common/swing
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Fri Apr 20 11:50:17 MST 2007
Author: dmsmith
Date: 2007-04-20 11:50:16 -0700 (Fri, 20 Apr 2007)
New Revision: 1287
Added:
trunk/common-swing/src/main/java/org/crosswire/common/swing/CWScrollPane.java
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/scrolled/ScrolledBookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/QuickHelpDialog.java
Log:
Adjusted JScrollPane instances to follow MacOSX guidelines when on a Mac.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -56,6 +56,7 @@
import javax.swing.event.DocumentListener;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.jsword.index.search.SearchType;
@@ -187,7 +188,7 @@
txtSummary.setLineWrap(true);
txtSummary.setEditable(false);
txtSummary.setRows(2);
- scrSummary = new JScrollPane(txtSummary);
+ scrSummary = new CWScrollPane(txtSummary);
scrSummary.setVisible(false);
// chkHebGrk = new JCheckBox(actions.getAction(HEAD_ORIGINAL));
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -48,6 +48,7 @@
import org.crosswire.bibledesktop.passage.KeyTreeCellRenderer;
import org.crosswire.bibledesktop.passage.KeyTreeModel;
import org.crosswire.bibledesktop.passage.KeyTreeNode;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.FixedSplitPane;
import org.crosswire.common.util.Logger;
import org.crosswire.jsword.book.Book;
@@ -97,7 +98,7 @@
genBookKeyScroller = createGenBookPicker();
- JScrollPane scrDisplay = new JScrollPane(display.getComponent());
+ JScrollPane scrDisplay = new CWScrollPane(display.getComponent());
sptMain = new FixedSplitPane(false);
sptMain.setOrientation(JSplitPane.VERTICAL_SPLIT);
@@ -277,7 +278,7 @@
}
});
- return new JScrollPane(bookList);
+ return new CWScrollPane(bookList);
}
/**
@@ -323,7 +324,7 @@
newEntry();
}
});
- return new JScrollPane(dictionaryKeyList);
+ return new CWScrollPane(dictionaryKeyList);
}
/**
@@ -345,7 +346,7 @@
}
});
- return new JScrollPane(genBookKeyTree);
+ return new CWScrollPane(genBookKeyTree);
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -41,7 +41,6 @@
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.KeyStroke;
@@ -58,6 +57,7 @@
import org.crosswire.bibledesktop.passage.WholeBibleTreeModel;
import org.crosswire.bibledesktop.passage.WholeBibleTreeNode;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.jsword.passage.KeyFactory;
import org.crosswire.jsword.passage.NoSuchKeyException;
@@ -132,7 +132,7 @@
label.setLabelFor(treAll);
- return new JScrollPane(treAll);
+ return new CWScrollPane(treAll);
}
/**
@@ -152,7 +152,7 @@
label.setLabelFor(lstSel);
- return new JScrollPane(lstSel);
+ return new CWScrollPane(lstSel);
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/EditSitePane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -54,6 +54,7 @@
import javax.swing.event.ListSelectionListener;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.FixedSplitPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.jsword.book.install.InstallManager;
@@ -91,9 +92,8 @@
actions = new ActionFactory(EditSitePane.class, this);
lstSite = new JList(new InstallManagerComboBoxModel(imanager));
- JScrollPane scrSite = new JScrollPane();
- scrSite.add(lstSite, null);
- scrSite.getViewport().add(lstSite, null);
+ JScrollPane scrSite = new CWScrollPane(lstSite);
+
lstSite.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
lstSite.addListSelectionListener(new ListSelectionListener()
{
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -45,6 +45,7 @@
import javax.swing.tree.TreeSelectionModel;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.FixedSplitPane;
import org.crosswire.common.util.Reporter;
import org.crosswire.jsword.book.Book;
@@ -197,7 +198,7 @@
display = new TextPaneBookMetaDataDisplay();
lblSelected.setLabelFor(display.getComponent());
- JScrollPane scrSelected = new JScrollPane();
+ JScrollPane scrSelected = new CWScrollPane();
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(lblSelected, BorderLayout.PAGE_START);
@@ -231,10 +232,7 @@
}
});
- JScrollPane scroller = new JScrollPane();
- scroller.getViewport().add(treAvailable);
-
- return scroller;
+ return new CWScrollPane(treAvailable);
}
private TreeModel createTreeModel(BookList books)
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/AboutPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -46,6 +46,7 @@
import org.crosswire.common.swing.ActionFactory;
import org.crosswire.common.swing.AntiAliasedTextPane;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.swing.MapTableModel;
import org.crosswire.common.util.CollectionUtil;
@@ -120,9 +121,8 @@
warranty.setEditorKit(new HTMLEditorKit());
warranty.setText(license.getWarranty());
warranty.setCaretPosition(0);
- JScrollPane warrantyScr = new JScrollPane();
+ JScrollPane warrantyScr = new CWScrollPane(warranty);
warrantyScr.setPreferredSize(new Dimension(500, 300));
- warrantyScr.getViewport().add(warranty);
JPanel warrantyPnl = new JPanel(new BorderLayout());
warrantyPnl.add(warrantyScr, BorderLayout.CENTER);
warrantyPnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
@@ -134,9 +134,8 @@
details.setEditorKit(new HTMLEditorKit());
details.setText(license.getDetails());
details.setCaretPosition(0);
- JScrollPane detailScr = new JScrollPane();
+ JScrollPane detailScr = new CWScrollPane(details);
detailScr.setPreferredSize(new Dimension(500, 300));
- detailScr.getViewport().add(details);
JPanel detailsPnl = new JPanel(new BorderLayout());
detailsPnl.add(detailScr, BorderLayout.CENTER);
detailsPnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
@@ -150,9 +149,8 @@
MapTableModel mdlProps = new MapTableModel(CollectionUtil.properties2Map(System.getProperties()));
tblProps.setModel(mdlProps);
- JScrollPane scrProps = new JScrollPane();
+ JScrollPane scrProps = new CWScrollPane(tblProps);
scrProps.setPreferredSize(new Dimension(500, 300));
- scrProps.getViewport().add(tblProps);
JPanel pnlProps = new JPanel();
pnlProps.setLayout(new BorderLayout());
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/ViewSourcePane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -35,7 +35,6 @@
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
-import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;
@@ -44,6 +43,7 @@
import org.crosswire.bibledesktop.util.ConfigurableSwingConverter;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.util.Reporter;
import org.crosswire.common.xml.Converter;
@@ -155,7 +155,7 @@
txtOrig.setTabSize(2);
txtOrig.setEditable(false);
JPanel pnlOrig = new JPanel(new BorderLayout());
- pnlOrig.add(new JScrollPane(txtOrig), BorderLayout.CENTER);
+ pnlOrig.add(new CWScrollPane(txtOrig), BorderLayout.CENTER);
pnlOrig.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// This really looks nice but its performance was terrible.
@@ -172,7 +172,7 @@
txtOsis.setTabSize(2);
txtOsis.setEditable(false);
JPanel pnlOsis = new JPanel(new BorderLayout());
- pnlOsis.add(new JScrollPane(txtOsis), BorderLayout.CENTER);
+ pnlOsis.add(new CWScrollPane(txtOsis), BorderLayout.CENTER);
pnlOsis.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// This really looks nice but its performance was terrible.
@@ -189,7 +189,7 @@
txtHtml.setTabSize(2);
txtHtml.setEditable(false);
JPanel pnlHtml = new JPanel(new BorderLayout());
- pnlHtml.add(new JScrollPane(txtHtml), BorderLayout.CENTER);
+ pnlHtml.add(new CWScrollPane(txtHtml), BorderLayout.CENTER);
pnlHtml.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
textAreas = new JTextComponent[] { txtOrig, txtOsis, txtHtml };
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/scrolled/ScrolledBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/scrolled/ScrolledBookDataDisplay.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/scrolled/ScrolledBookDataDisplay.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -28,6 +28,7 @@
import org.crosswire.bibledesktop.display.BookDataDisplay;
import org.crosswire.bibledesktop.display.proxy.ProxyBookDataDisplay;
+import org.crosswire.common.swing.CWScrollPane;
/**
* An inner component of Passage pane that can't show the list.
@@ -44,9 +45,9 @@
public ScrolledBookDataDisplay(BookDataDisplay child)
{
super(child);
-
+ scrView = new CWScrollPane(getProxy().getComponent());
scrView.getViewport().setPreferredSize(new Dimension(500, 400));
- scrView.getViewport().add(getProxy().getComponent(), null);
+// scrView.getViewport().add(getProxy().getComponent(), null);
}
/* (non-Javadoc)
@@ -61,5 +62,5 @@
/**
* The scroller for the TextPaneBookDataDisplay component
*/
- private JScrollPane scrView = new JScrollPane();
+ private JScrollPane scrView;
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -39,6 +39,7 @@
import org.crosswire.bibledesktop.book.DisplaySelectEvent;
import org.crosswire.bibledesktop.book.DisplaySelectListener;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.passage.Key;
@@ -88,8 +89,7 @@
}
});
- JScrollPane scroll = new JScrollPane();
- scroll.getViewport().add(list);
+ JScrollPane scroll = new CWScrollPane(list);
ActionFactory actions = new ActionFactory(KeySidebar.class, this);
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AdvancedConfigEditor.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -39,6 +39,7 @@
import javax.swing.tree.DefaultTreeCellRenderer;
import org.crosswire.common.config.Choice;
+import org.crosswire.common.swing.CWScrollPane;
/**
* A mutable view of Fields setting array.
@@ -56,7 +57,9 @@
{
ctm = new AdvancedConfigureTreeModel();
tree = new JTree();
- JScrollPane scroll = new JScrollPane();
+ JScrollPane scroll = new CWScrollPane(tree);
+ scroll.setPreferredSize(new Dimension(150, 150));
+
CustomTreeCellRenderer render = new CustomTreeCellRenderer();
comps = new HashMap();
@@ -68,9 +71,6 @@
render.setLeafIcon(TASK_ICON_SMALL);
render.setBackgroundNonSelectionColor(bg);
- scroll.setPreferredSize(new Dimension(150, 150));
- scroll.setViewportView(tree);
-
tree.setBackground(bg);
tree.setModel(ctm);
tree.setCellRenderer(render);
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -41,6 +41,7 @@
import org.crosswire.common.config.Choice;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.util.Convert;
/**
@@ -70,8 +71,7 @@
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// list.setPreferredScrollableViewportSize(new Dimension(30, 100));
- JScrollPane scroll = new JScrollPane();
- scroll.setViewportView(list);
+ JScrollPane scroll = new CWScrollPane(list);
buttons.add(new JButton(actions.getAction(ADD)));
buttons.add(new JButton(actions.getAction(REMOVE)));
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -42,6 +42,7 @@
import org.crosswire.common.config.Choice;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.FieldLayout;
import org.crosswire.common.util.Convert;
@@ -72,8 +73,7 @@
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// list.setPreferredScrollableViewportSize(new Dimension(30, 100));
- JScrollPane scroll = new JScrollPane();
- scroll.setViewportView(list);
+ JScrollPane scroll = new CWScrollPane(list);
buttons.add(new JButton(actions.getAction(ADD)));
buttons.add(new JButton(actions.getAction(REMOVE)));
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 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -47,6 +47,7 @@
import org.crosswire.common.config.Choice;
import org.crosswire.common.config.Config;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.FormPane;
/**
@@ -125,7 +126,7 @@
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
//if (cards > 1)
- add(BorderLayout.WEST, new JScrollPane(tree));
+ add(BorderLayout.WEST, new CWScrollPane(tree));
add(BorderLayout.CENTER, panel);
add(BorderLayout.SOUTH, new ButtonPane(this));
@@ -158,7 +159,7 @@
FormPane card = (FormPane) decks.get(path);
if (card != null && card.getParent() == null)
{
- JScrollPane scroll = new JScrollPane(card);
+ JScrollPane scroll = new CWScrollPane(card);
scroll.setBorder(BorderFactory.createEmptyBorder());
deck.add(path, scroll);
}
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -47,6 +47,7 @@
import javax.swing.SwingUtilities;
import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.EdgeBorder;
import org.crosswire.common.swing.FormPane;
import org.crosswire.common.util.Logger;
@@ -130,7 +131,7 @@
FormPane card = (FormPane) decks.get(path);
if (card.getParent() == null)
{
- JScrollPane scroll = new JScrollPane(card);
+ JScrollPane scroll = new CWScrollPane(card);
scroll.setBorder(BorderFactory.createEmptyBorder());
deck.add(path, scroll);
wcards++;
Modified: trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/progress/swing/JobsViewPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -47,6 +47,7 @@
import org.crosswire.common.progress.Progress;
import org.crosswire.common.progress.WorkEvent;
import org.crosswire.common.progress.WorkListener;
+import org.crosswire.common.swing.CWScrollPane;
import org.crosswire.common.swing.GuiUtil;
import org.crosswire.common.util.Logger;
@@ -90,7 +91,7 @@
JPanel pnl = new JPanel(new BorderLayout());
pnl.add(jobsPanel, BorderLayout.NORTH);
- JScrollPane scrollPane = new JScrollPane(pnl);
+ JScrollPane scrollPane = new CWScrollPane(pnl);
scrollPane.setBorder(null);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
Added: trunk/common-swing/src/main/java/org/crosswire/common/swing/CWScrollPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/CWScrollPane.java (rev 0)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/CWScrollPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -0,0 +1,76 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: CWAction.java 1168 2006-10-19 21:47:42Z dmsmith $
+ */
+package org.crosswire.common.swing;
+
+import java.awt.Component;
+
+import javax.swing.JScrollPane;
+import javax.swing.ScrollPaneConstants;
+
+import org.crosswire.common.util.OSType;
+
+/**
+ * A ScrollPane that give appropriate cross platform behavior.
+ * Specifically, on the Mac the vertical and horizontal scrollbars should always appear.
+ *
+ * @see gnu.lgpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class CWScrollPane extends JScrollPane
+{
+ public CWScrollPane()
+ {
+ this(null);
+ }
+
+ public CWScrollPane(Component view)
+ {
+ super(view, verticalPolicy, horizontalPolicy);
+ }
+
+ private static int getXPlatformVerticalScrollBarPolicy()
+ {
+ if (OSType.MAC.equals(OSType.getOSType()))
+ {
+ return ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
+ }
+ return ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+ }
+
+ private static int getXPlatformHorizontalScrollBarPolicy()
+ {
+ if (OSType.MAC.equals(OSType.getOSType()))
+ {
+ return ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
+ }
+ return ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+ }
+
+ private static int verticalPolicy = getXPlatformVerticalScrollBarPolicy();
+ private static int horizontalPolicy = getXPlatformHorizontalScrollBarPolicy();
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -7774104652833574820L;
+}
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/ExceptionPane.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -134,7 +134,7 @@
text = new JTextArea();
text.setEditable(false);
text.setFont(courier);
- JScrollPane textScroll = new JScrollPane(text);
+ JScrollPane textScroll = new CWScrollPane(text);
textScroll.setColumnHeaderView(label);
List causes = new ArrayList();
@@ -158,7 +158,7 @@
split.setResizeWeight(0.2D);
split.setOrientation(JSplitPane.VERTICAL_SPLIT);
split.setContinuousLayout(true);
- split.setTopComponent(new JScrollPane(list));
+ split.setTopComponent(new CWScrollPane(list));
split.setBottomComponent(textScroll);
split.setBorder(BorderFactory.createEmptyBorder());
split.setPreferredSize(new Dimension(500, 300));
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/QuickHelpDialog.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/QuickHelpDialog.java 2007-04-20 17:59:19 UTC (rev 1286)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/QuickHelpDialog.java 2007-04-20 18:50:16 UTC (rev 1287)
@@ -83,8 +83,7 @@
}
});
- JScrollPane scrHelp = new JScrollPane();
- scrHelp.setViewportView(txtHelp);
+ JScrollPane scrHelp = new CWScrollPane(txtHelp);
scrHelp.setBorder(null);
JButton btnOK = new JButton(actions.getAction(OK));
More information about the jsword-svn
mailing list