1 /*
2 * Copyright (c) 2002, 2013, 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
43 implements SynthUI, PropertyChangeListener {
44 private SynthStyle style;
45 private Handler handler = new Handler();
46
47 /**
48 * Creates a new UI object for the given component.
49 *
50 * @param c component to create UI object for
51 * @return the UI object
52 */
53 public static ComponentUI createUI(JComponent c) {
54 return new SynthDesktopIconUI();
55 }
56
57 /**
58 * {@inheritDoc}
59 */
60 @Override
61 protected void installComponents() {
62 if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
63 iconPane = new JToggleButton(frame.getTitle(), frame.getFrameIcon()) {
64 @Override public String getToolTipText() {
65 return getText();
66 }
67
68 @Override public JPopupMenu getComponentPopupMenu() {
69 return frame.getComponentPopupMenu();
70 }
71 };
72 ToolTipManager.sharedInstance().registerComponent(iconPane);
73 iconPane.setFont(desktopIcon.getFont());
74 iconPane.setBackground(desktopIcon.getBackground());
75 iconPane.setForeground(desktopIcon.getForeground());
76 } else {
77 iconPane = new SynthInternalFrameTitlePane(frame);
78 iconPane.setName("InternalFrame.northPane");
79 }
80 desktopIcon.setLayout(new BorderLayout());
81 desktopIcon.add(iconPane, BorderLayout.CENTER);
82 }
83
84 /**
85 * {@inheritDoc}
86 */
87 @Override
88 protected void installListeners() {
89 super.installListeners();
90 desktopIcon.addPropertyChangeListener(this);
91
|
1 /*
2 * Copyright (c) 2002, 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
43 implements SynthUI, PropertyChangeListener {
44 private SynthStyle style;
45 private Handler handler = new Handler();
46
47 /**
48 * Creates a new UI object for the given component.
49 *
50 * @param c component to create UI object for
51 * @return the UI object
52 */
53 public static ComponentUI createUI(JComponent c) {
54 return new SynthDesktopIconUI();
55 }
56
57 /**
58 * {@inheritDoc}
59 */
60 @Override
61 protected void installComponents() {
62 if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
63 @SuppressWarnings("serial") // anonymous class
64 JToggleButton tmp = new JToggleButton(frame.getTitle(), frame.getFrameIcon()) {
65 @Override public String getToolTipText() {
66 return getText();
67 }
68
69 @Override public JPopupMenu getComponentPopupMenu() {
70 return frame.getComponentPopupMenu();
71 }
72 };
73 iconPane = tmp;
74 ToolTipManager.sharedInstance().registerComponent(iconPane);
75 iconPane.setFont(desktopIcon.getFont());
76 iconPane.setBackground(desktopIcon.getBackground());
77 iconPane.setForeground(desktopIcon.getForeground());
78 } else {
79 iconPane = new SynthInternalFrameTitlePane(frame);
80 iconPane.setName("InternalFrame.northPane");
81 }
82 desktopIcon.setLayout(new BorderLayout());
83 desktopIcon.add(iconPane, BorderLayout.CENTER);
84 }
85
86 /**
87 * {@inheritDoc}
88 */
89 @Override
90 protected void installListeners() {
91 super.installListeners();
92 desktopIcon.addPropertyChangeListener(this);
93
|