[jsword-svn] common/java/swing/org/crosswire/common/swing s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Thu Jan 5 16:17:36 MST 2006
Update of /cvs/jsword/common/java/swing/org/crosswire/common/swing
In directory www.crosswire.org:/tmp/cvs-serv1256/java/swing/org/crosswire/common/swing
Modified Files:
FixedSplitPane.java
Log Message:
Added the ability to hide the border of a split pane's divider.
Index: FixedSplitPane.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/swing/FixedSplitPane.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** FixedSplitPane.java 27 Jul 2005 23:26:43 -0000 1.9
--- FixedSplitPane.java 5 Jan 2006 23:17:34 -0000 1.10
***************
*** 27,30 ****
--- 27,34 ----
import javax.swing.JComponent;
import javax.swing.JSplitPane;
+ import javax.swing.border.Border;
+ import javax.swing.border.EmptyBorder;
+ import javax.swing.plaf.SplitPaneUI;
+ import javax.swing.plaf.basic.BasicSplitPaneUI;
/**
***************
*** 69,72 ****
--- 73,87 ----
/**
+ * Constructor for FixedSplitPane that has no divider shadow
+ * and starts out with an empty border.
+ */
+ public FixedSplitPane(boolean visibleDividerBorder)
+ {
+ this();
+ this.visibleDividerBorder = visibleDividerBorder;
+ setBorder(EMPTY_BORDER);
+ }
+
+ /**
* Constructor for FixedSplitPane
*/
***************
*** 193,196 ****
--- 208,254 ----
}
+ /**
+ * Whether visible borders are hinted
+ *
+ * @return the divider border visiblity hint
+ */
+ public boolean isVisibleDividerBorder()
+ {
+ return visibleDividerBorder;
+ }
+
+ /**
+ * Set a hint whether the border should be visible or not.
+ * Look and feels may ignore this.
+ *
+ * @param newVisibility
+ */
+ public void setVisibleDividerBorder(boolean newVisibility)
+ {
+ boolean oldVisibility = isVisibleDividerBorder();
+ if (oldVisibility == newVisibility)
+ {
+ return;
+ }
+ visibleDividerBorder = newVisibility;
+ firePropertyChange(PROPERTYNAME_VISIBLE_DIVIDER_BORDER, oldVisibility, newVisibility);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.JComponent#updateUI()
+ */
+ public void updateUI()
+ {
+ super.updateUI();
+ if (!visibleDividerBorder)
+ {
+ SplitPaneUI splitPaneUI = getUI();
+ if (splitPaneUI instanceof BasicSplitPaneUI) {
+ BasicSplitPaneUI basicUI = (BasicSplitPaneUI) splitPaneUI;
+ basicUI.getDivider().setBorder(EMPTY_BORDER);
+ }
+ }
+ }
+
private static final Dimension DOT = new Dimension(0, 0);
private boolean firstValidate = true;
***************
*** 199,202 ****
--- 257,275 ----
/**
+ * Property for border visibility
+ */
+ public static final String PROPERTYNAME_VISIBLE_DIVIDER_BORDER = "visibleDividerBorder"; //$NON-NLS-1$
+
+ /**
+ * An Empty Border
+ */
+ private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
+
+ /**
+ * Hint for whether Divider border should be visible.
+ */
+ private boolean visibleDividerBorder;
+
+ /**
* Serialization ID
*/
More information about the jsword-svn
mailing list