36 import javax.swing.plaf.*;
37 import javax.swing.border.Border;
38 import java.beans.*;
39 import sun.swing.DefaultLookup;
40
41
42
43 /**
44 * Divider used by BasicSplitPaneUI. Subclassers may wish to override
45 * paint to do something more interesting.
46 * The border effect is drawn in BasicSplitPaneUI, so if you don't like
47 * that border, reset it there.
48 * To conditionally drag from certain areas subclass mousePressed and
49 * call super when you wish the dragging to begin.
50 * <p>
51 * <strong>Warning:</strong>
52 * Serialized objects of this class will not be compatible with
53 * future Swing releases. The current serialization support is
54 * appropriate for short term storage or RMI between applications running
55 * the same version of Swing. As of 1.4, support for long term storage
56 * of all JavaBeans™
57 * has been added to the <code>java.beans</code> package.
58 * Please see {@link java.beans.XMLEncoder}.
59 *
60 * @author Scott Violet
61 */
62 @SuppressWarnings("serial") // Same-version serialization only
63 public class BasicSplitPaneDivider extends Container
64 implements PropertyChangeListener
65 {
66 /**
67 * Width or height of the divider based on orientation
68 * {@code BasicSplitPaneUI} adds two to this.
69 */
70 protected static final int ONE_TOUCH_SIZE = 6;
71
72 /**
73 * The offset of the divider.
74 */
75 protected static final int ONE_TOUCH_OFFSET = 2;
76
680 if (e.getSource() == BasicSplitPaneDivider.this) {
681 setMouseOver(false);
682 }
683 }
684 }
685
686
687 /**
688 * Handles the events during a dragging session for a
689 * HORIZONTAL_SPLIT oriented split pane. This continually
690 * messages <code>dragDividerTo</code> and then when done messages
691 * <code>finishDraggingTo</code>. When an instance is created it should be
692 * messaged with <code>isValid</code> to insure that dragging can happen
693 * (dragging won't be allowed if the two views can not be resized).
694 * <p>
695 * <strong>Warning:</strong>
696 * Serialized objects of this class will not be compatible with
697 * future Swing releases. The current serialization support is
698 * appropriate for short term storage or RMI between applications running
699 * the same version of Swing. As of 1.4, support for long term storage
700 * of all JavaBeans™
701 * has been added to the <code>java.beans</code> package.
702 * Please see {@link java.beans.XMLEncoder}.
703 */
704 @SuppressWarnings("serial") // Same-version serialization only
705 protected class DragController
706 {
707 /**
708 * Initial location of the divider.
709 */
710 int initialX;
711
712 /**
713 * Maximum and minimum positions to drag to.
714 */
715 int maxX, minX;
716
717 /**
718 * Initial location the mouse down happened at.
719 */
720 int offset;
|
36 import javax.swing.plaf.*;
37 import javax.swing.border.Border;
38 import java.beans.*;
39 import sun.swing.DefaultLookup;
40
41
42
43 /**
44 * Divider used by BasicSplitPaneUI. Subclassers may wish to override
45 * paint to do something more interesting.
46 * The border effect is drawn in BasicSplitPaneUI, so if you don't like
47 * that border, reset it there.
48 * To conditionally drag from certain areas subclass mousePressed and
49 * call super when you wish the dragging to begin.
50 * <p>
51 * <strong>Warning:</strong>
52 * Serialized objects of this class will not be compatible with
53 * future Swing releases. The current serialization support is
54 * appropriate for short term storage or RMI between applications running
55 * the same version of Swing. As of 1.4, support for long term storage
56 * of all JavaBeans
57 * has been added to the <code>java.beans</code> package.
58 * Please see {@link java.beans.XMLEncoder}.
59 *
60 * @author Scott Violet
61 */
62 @SuppressWarnings("serial") // Same-version serialization only
63 public class BasicSplitPaneDivider extends Container
64 implements PropertyChangeListener
65 {
66 /**
67 * Width or height of the divider based on orientation
68 * {@code BasicSplitPaneUI} adds two to this.
69 */
70 protected static final int ONE_TOUCH_SIZE = 6;
71
72 /**
73 * The offset of the divider.
74 */
75 protected static final int ONE_TOUCH_OFFSET = 2;
76
680 if (e.getSource() == BasicSplitPaneDivider.this) {
681 setMouseOver(false);
682 }
683 }
684 }
685
686
687 /**
688 * Handles the events during a dragging session for a
689 * HORIZONTAL_SPLIT oriented split pane. This continually
690 * messages <code>dragDividerTo</code> and then when done messages
691 * <code>finishDraggingTo</code>. When an instance is created it should be
692 * messaged with <code>isValid</code> to insure that dragging can happen
693 * (dragging won't be allowed if the two views can not be resized).
694 * <p>
695 * <strong>Warning:</strong>
696 * Serialized objects of this class will not be compatible with
697 * future Swing releases. The current serialization support is
698 * appropriate for short term storage or RMI between applications running
699 * the same version of Swing. As of 1.4, support for long term storage
700 * of all JavaBeans
701 * has been added to the <code>java.beans</code> package.
702 * Please see {@link java.beans.XMLEncoder}.
703 */
704 @SuppressWarnings("serial") // Same-version serialization only
705 protected class DragController
706 {
707 /**
708 * Initial location of the divider.
709 */
710 int initialX;
711
712 /**
713 * Maximum and minimum positions to drag to.
714 */
715 int maxX, minX;
716
717 /**
718 * Initial location the mouse down happened at.
719 */
720 int offset;
|