01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Sergey Burlak, Anton Avtamonov
20: * @version $Revision$
21: */package javax.swing.plaf.metal;
22:
23: import java.beans.PropertyChangeEvent;
24: import java.beans.PropertyChangeListener;
25:
26: import javax.swing.JComponent;
27: import javax.swing.JScrollPane;
28: import javax.swing.plaf.ComponentUI;
29: import javax.swing.plaf.basic.BasicScrollPaneUI;
30:
31: public class MetalScrollPaneUI extends BasicScrollPaneUI {
32: private PropertyChangeListener scrollBarSwapListener;
33:
34: // TODO: there is no clear scenario of swapping scrolbars to check what is expected here
35: private class ScrollBarSwapListener implements
36: PropertyChangeListener {
37: public void propertyChange(final PropertyChangeEvent e) {
38: }
39: }
40:
41: public static ComponentUI createUI(final JComponent x) {
42: return new MetalScrollPaneUI();
43: }
44:
45: public void installUI(final JComponent c) {
46: super .installUI(c);
47: }
48:
49: public void uninstallUI(final JComponent c) {
50: super .uninstallUI(c);
51: }
52:
53: public void installListeners(final JScrollPane scrollPane) {
54: super .installListeners(scrollPane);
55: scrollBarSwapListener = createScrollBarSwapListener();
56: scrollPane.addPropertyChangeListener(scrollBarSwapListener);
57: }
58:
59: public void uninstallListeners(final JScrollPane scrollPane) {
60: super .uninstallListeners(scrollPane);
61: scrollPane.removePropertyChangeListener(scrollBarSwapListener);
62: scrollBarSwapListener = null;
63: }
64:
65: protected PropertyChangeListener createScrollBarSwapListener() {
66: return new ScrollBarSwapListener();
67: }
68: }
|