1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
812 {
813 public void actionPerformed(ActionEvent ev) {
814 if (!dividerKeyboardResize) {
815 splitPane.requestFocus();
816 }
817 }
818 }
819
820 /**
821 * Returns the divider between the top Components.
822 */
823 public BasicSplitPaneDivider getDivider() {
824 return divider;
825 }
826
827
828 /**
829 * Returns the default non continuous layout divider, which is an
830 * instance of {@code Canvas} that fills in the background with dark gray.
831 */
832 protected Component createDefaultNonContinuousLayoutDivider() {
833 return new Canvas() {
834 public void paint(Graphics g) {
835 if(!isContinuousLayout() && getLastDragLocation() != -1) {
836 Dimension size = splitPane.getSize();
837
838 g.setColor(dividerDraggingColor);
839 if(orientation == JSplitPane.HORIZONTAL_SPLIT) {
840 g.fillRect(0, 0, dividerSize - 1, size.height - 1);
841 } else {
842 g.fillRect(0, 0, size.width - 1, dividerSize - 1);
843 }
844 }
845 }
846 };
847 }
848
849
850 /**
851 * Sets the divider to use when the splitPane is configured to
|
1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
812 {
813 public void actionPerformed(ActionEvent ev) {
814 if (!dividerKeyboardResize) {
815 splitPane.requestFocus();
816 }
817 }
818 }
819
820 /**
821 * Returns the divider between the top Components.
822 */
823 public BasicSplitPaneDivider getDivider() {
824 return divider;
825 }
826
827
828 /**
829 * Returns the default non continuous layout divider, which is an
830 * instance of {@code Canvas} that fills in the background with dark gray.
831 */
832 @SuppressWarnings("serial") // anonymous class
833 protected Component createDefaultNonContinuousLayoutDivider() {
834 return new Canvas() {
835 public void paint(Graphics g) {
836 if(!isContinuousLayout() && getLastDragLocation() != -1) {
837 Dimension size = splitPane.getSize();
838
839 g.setColor(dividerDraggingColor);
840 if(orientation == JSplitPane.HORIZONTAL_SPLIT) {
841 g.fillRect(0, 0, dividerSize - 1, size.height - 1);
842 } else {
843 g.fillRect(0, 0, size.width - 1, dividerSize - 1);
844 }
845 }
846 }
847 };
848 }
849
850
851 /**
852 * Sets the divider to use when the splitPane is configured to
|