Parent Directory
|
Revision Log
Change patch system from dpatch to quilt.
1 | Author: <gregor+debian@comodo.priv.at> |
2 | Description: remove windows look |
3 | --- libjgoodies-looks-java.orig/build.xml |
4 | +++ libjgoodies-looks-java/build.xml |
5 | @@ -90,7 +90,7 @@ |
6 | <!-- C O M P I L A T I O N --> |
7 | <!-- ***************************************************************** --> |
8 | <target name="compile" |
9 | - depends="compile-core, compile-demo, compile-tests" |
10 | + depends="compile-core, compile-tests" |
11 | description="Compiles the l&fs, demo, and tests." /> |
12 | |
13 | <!-- ***************************************************************** --> |
14 | @@ -115,33 +115,11 @@ |
15 | <copy toDir="${build.core.dir}" > |
16 | <fileset dir="${src.core.dir}" |
17 | includes="com/jgoodies/looks/common/shadow.png, |
18 | - com/jgoodies/looks/plastic/icons/**/*, |
19 | - com/jgoodies/looks/windows/icons/**/*" /> |
20 | + com/jgoodies/looks/plastic/icons/**/*" /> |
21 | </copy> |
22 | </target> |
23 | |
24 | <!-- ***************************************************************** --> |
25 | - <target name="compile-demo" depends="compile-core" |
26 | - description="Compiles the demo sources." > |
27 | - <javac |
28 | - srcdir ="${src.demo.dir}" |
29 | - destdir ="${build.demo.dir}" |
30 | - encoding ="${build.encoding}" |
31 | - executable ="${build.compile.executable}" |
32 | - fork ="${build.compile.fork}" |
33 | - debug ="${build.compile.debug}" |
34 | - depend ="${build.compile.depend}" |
35 | - deprecation ="${build.compile.deprecation}" |
36 | - nowarn ="${build.compile.nowarn}" |
37 | - optimize ="${build.compile.optimize}" |
38 | - source ="${build.compile.source}" |
39 | - target ="${build.compile.target}" |
40 | - verbose ="${build.compile.verbose}" |
41 | - classpathref ="classpath.demo" /> |
42 | - <!-- bootclasspath="${build.boot.classpath}" --> |
43 | - </target> |
44 | - |
45 | - <!-- ***************************************************************** --> |
46 | <target name="compile-tests" depends="compile-core" if="junit.jar.present" |
47 | description="Compiles the unit tests." > |
48 | <mkdir dir="${build.test.dir}"/> |
49 | @@ -209,7 +187,7 @@ |
50 | <!-- J A R --> |
51 | <!-- ***************************************************************** --> |
52 | <target name="jar" |
53 | - depends="jar-all, jar-plastic, jar-windows, jar-demo, jar-tiny, jar-fonttest" |
54 | + depends="jar-all, jar-plastic, jar-demo, jar-tiny, jar-fonttest" |
55 | description="Creates library and example jars." > |
56 | </target> |
57 | |
58 | @@ -264,20 +242,6 @@ |
59 | </target> |
60 | |
61 | <!-- ***************************************************************** --> |
62 | - <target name="jar-windows" depends="compile, manifest" |
63 | - description="Creates the library jar for the windows l&f." > |
64 | - <jar |
65 | - destfile="${build.windows.jar}" |
66 | - manifest="${build.manifest}" > |
67 | - <fileset dir="${build.core.dir}" |
68 | - excludes="com/jgoodies/looks/plastic/**/*" /> |
69 | - <zipfileset dir="${descriptors.dir}" |
70 | - includes="windows.txt" |
71 | - fullpath="META-INF/services/javax.swing.LookAndFeel" /> |
72 | - </jar> |
73 | - </target> |
74 | - |
75 | - <!-- ***************************************************************** --> |
76 | <target name="jar-demo" depends="jar-plastic" |
77 | description="Creates the demo jar." > |
78 | <jar |
79 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/Options.java |
80 | +++ libjgoodies-looks-java/src/core/com/jgoodies/looks/Options.java |
81 | @@ -38,8 +38,6 @@ |
82 | |
83 | import com.jgoodies.looks.common.ShadowPopup; |
84 | import com.jgoodies.looks.plastic.PlasticLookAndFeel; |
85 | -import com.jgoodies.looks.windows.WindowsLookAndFeel; |
86 | -import com.sun.java.swing.plaf.windows.WindowsComboBoxUI; |
87 | |
88 | /** |
89 | * Provides access to optional features of the JGoodies L&Fs |
90 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsArrowButton.java |
91 | +++ /dev/null |
92 | @@ -1,142 +0,0 @@ |
93 | -/* |
94 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
95 | - * |
96 | - * Redistribution and use in source and binary forms, with or without |
97 | - * modification, are permitted provided that the following conditions are met: |
98 | - * |
99 | - * o Redistributions of source code must retain the above copyright notice, |
100 | - * this list of conditions and the following disclaimer. |
101 | - * |
102 | - * o Redistributions in binary form must reproduce the above copyright notice, |
103 | - * this list of conditions and the following disclaimer in the documentation |
104 | - * and/or other materials provided with the distribution. |
105 | - * |
106 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
107 | - * its contributors may be used to endorse or promote products derived |
108 | - * from this software without specific prior written permission. |
109 | - * |
110 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
111 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
112 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
113 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
114 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
115 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
116 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
117 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
118 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
119 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
120 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
121 | - */ |
122 | - |
123 | -package com.jgoodies.looks.windows; |
124 | - |
125 | -import java.awt.Color; |
126 | -import java.awt.Dimension; |
127 | -import java.awt.Graphics; |
128 | - |
129 | -import javax.swing.UIManager; |
130 | -import javax.swing.plaf.basic.BasicArrowButton; |
131 | - |
132 | -/** |
133 | - * The JGoodies Windows Look&Feel implementation for |
134 | - * arrow buttons used in scrollbars and comboboxes. |
135 | - * <p> |
136 | - * It differs from <code>BasicArrowButton</code> in that the preferred size |
137 | - * is always a square. |
138 | - * It differs from <code>WindowsScrollBarUI.WindowsArrowButton</code> |
139 | - * in that the triangle is black and positioned correctly. |
140 | - * |
141 | - * @author Karsten Lentzsch |
142 | - * @version $Revision: 1.3 $ |
143 | - */ |
144 | -final class WindowsArrowButton extends BasicArrowButton { |
145 | - |
146 | - public WindowsArrowButton(int direction) { |
147 | - super(direction); |
148 | - } |
149 | - |
150 | - public Dimension getPreferredSize() { |
151 | - int width = Math.max(5, UIManager.getInt("ScrollBar.width")); |
152 | - return new Dimension(width, width); |
153 | - } |
154 | - |
155 | - public void paintTriangle( |
156 | - Graphics g, |
157 | - int x, |
158 | - int y, |
159 | - int size, |
160 | - int triangleDirection, |
161 | - boolean isEnabled) { |
162 | - Color oldColor = g.getColor(); |
163 | - int mid, i, j; |
164 | - |
165 | - j = 0; |
166 | - size = Math.max(size, 2); |
167 | - mid = (size - 1) / 2; // Modified by JGoodies |
168 | - |
169 | - g.translate(x, y); |
170 | - if (isEnabled) |
171 | - g.setColor(Color.black); |
172 | - else |
173 | - g.setColor(UIManager.getColor("controlShadow")); |
174 | - |
175 | - switch (triangleDirection) { |
176 | - case NORTH : |
177 | - for (i = 0; i < size; i++) { |
178 | - g.drawLine(mid - i, i, mid + i, i); |
179 | - } |
180 | - if (!isEnabled) { |
181 | - g.setColor(UIManager.getColor("controlLtHighlight")); |
182 | - g.drawLine(mid - i + 2, i, mid + i, i); |
183 | - } |
184 | - break; |
185 | - case SOUTH : |
186 | - if (!isEnabled) { |
187 | - g.translate(1, 1); |
188 | - g.setColor(UIManager.getColor("controlLtHighlight")); |
189 | - for (i = size - 1; i >= 0; i--) { |
190 | - g.drawLine(mid - i, j, mid + i, j); |
191 | - j++; |
192 | - } |
193 | - g.translate(-1, -1); |
194 | - g.setColor(UIManager.getColor("controlShadow")); |
195 | - } |
196 | - |
197 | - j = 0; |
198 | - for (i = size - 1; i >= 0; i--) { |
199 | - g.drawLine(mid - i, j, mid + i, j); |
200 | - j++; |
201 | - } |
202 | - break; |
203 | - case WEST : |
204 | - for (i = 0; i < size; i++) { |
205 | - g.drawLine(i, mid - i, i, mid + i); |
206 | - } |
207 | - if (!isEnabled) { |
208 | - g.setColor(UIManager.getColor("controlLtHighlight")); |
209 | - g.drawLine(i, mid - i + 2, i, mid + i); |
210 | - } |
211 | - break; |
212 | - case EAST : |
213 | - if (!isEnabled) { |
214 | - g.translate(1, 1); |
215 | - g.setColor(UIManager.getColor("controlLtHighlight")); |
216 | - for (i = size - 1; i >= 0; i--) { |
217 | - g.drawLine(j, mid - i, j, mid + i); |
218 | - j++; |
219 | - } |
220 | - g.translate(-1, -1); |
221 | - g.setColor(UIManager.getColor("controlShadow")); |
222 | - } |
223 | - |
224 | - j = 0; |
225 | - for (i = size - 1; i >= 0; i--) { |
226 | - g.drawLine(j, mid - i, j, mid + i); |
227 | - j++; |
228 | - } |
229 | - break; |
230 | - } |
231 | - g.translate(-x, -y); |
232 | - g.setColor(oldColor); |
233 | - } |
234 | -} |
235 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsBorders.java |
236 | +++ /dev/null |
237 | @@ -1,589 +0,0 @@ |
238 | -/* |
239 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
240 | - * |
241 | - * Redistribution and use in source and binary forms, with or without |
242 | - * modification, are permitted provided that the following conditions are met: |
243 | - * |
244 | - * o Redistributions of source code must retain the above copyright notice, |
245 | - * this list of conditions and the following disclaimer. |
246 | - * |
247 | - * o Redistributions in binary form must reproduce the above copyright notice, |
248 | - * this list of conditions and the following disclaimer in the documentation |
249 | - * and/or other materials provided with the distribution. |
250 | - * |
251 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
252 | - * its contributors may be used to endorse or promote products derived |
253 | - * from this software without specific prior written permission. |
254 | - * |
255 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
256 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
257 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
258 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
259 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
260 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
261 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
262 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
263 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
264 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
265 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
266 | - */ |
267 | - |
268 | -package com.jgoodies.looks.windows; |
269 | - |
270 | -import java.awt.Color; |
271 | -import java.awt.Component; |
272 | -import java.awt.Graphics; |
273 | -import java.awt.Insets; |
274 | - |
275 | -import javax.swing.AbstractButton; |
276 | -import javax.swing.ButtonModel; |
277 | -import javax.swing.JButton; |
278 | -import javax.swing.JToggleButton; |
279 | -import javax.swing.UIDefaults; |
280 | -import javax.swing.UIManager; |
281 | -import javax.swing.border.AbstractBorder; |
282 | -import javax.swing.border.Border; |
283 | -import javax.swing.border.CompoundBorder; |
284 | -import javax.swing.border.EmptyBorder; |
285 | -import javax.swing.plaf.BorderUIResource; |
286 | -import javax.swing.plaf.UIResource; |
287 | -import javax.swing.plaf.basic.BasicBorders; |
288 | -import javax.swing.plaf.basic.BasicGraphicsUtils; |
289 | - |
290 | -/** |
291 | - * Consists of static inner classes that define different |
292 | - * <code>Borders</code> used in the JGoodies Windows look&feel. |
293 | - * |
294 | - * @author Karsten Lentzsch |
295 | - * @version $Revision: 1.5 $ |
296 | - */ |
297 | -final class WindowsBorders { |
298 | - |
299 | - private WindowsBorders() { |
300 | - // Overrides default constructor; prevents instantiation. |
301 | - } |
302 | - |
303 | - // Accessing and Creating Borders *************************************************** |
304 | - |
305 | - private static Border menuBorder; |
306 | - private static Border xpMenuBorder; |
307 | - private static Border menuItemBorder; |
308 | - private static Border popupMenuBorder; |
309 | - private static Border noMarginPopupMenuBorder; |
310 | - private static Border separatorBorder; |
311 | - private static Border etchedBorder; |
312 | - private static Border menuBarHeaderBorder; |
313 | - private static Border toolBarHeaderBorder; |
314 | - private static Border rolloverButtonBorder; |
315 | - |
316 | - |
317 | - /** |
318 | - * Returns a <code>Border</code> for a <code>JButton</code>. |
319 | - */ |
320 | - public static Border getButtonBorder() { |
321 | - UIDefaults table = UIManager.getLookAndFeelDefaults(); |
322 | - Border outerBorder = new ButtonBorder(table.getColor("Button.shadow"), |
323 | - table.getColor("Button.darkShadow"), table |
324 | - .getColor("Button.light"), table |
325 | - .getColor("Button.highlight"), table |
326 | - .getColor("controlText")); |
327 | - |
328 | - Border buttonBorder = new BorderUIResource.CompoundBorderUIResource( |
329 | - outerBorder, new BasicBorders.MarginBorder()); |
330 | - return buttonBorder; |
331 | - } |
332 | - |
333 | - |
334 | - /** |
335 | - * Returns a Border for a JMenu in classic mode. |
336 | - */ |
337 | - static Border getMenuBorder() { |
338 | - if (menuBorder == null) { |
339 | - menuBorder = new BorderUIResource.CompoundBorderUIResource( |
340 | - new MenuBorder(), |
341 | - new BasicBorders.MarginBorder()); |
342 | - } |
343 | - return menuBorder; |
344 | - } |
345 | - |
346 | - /** |
347 | - * Returns a Border for a JMenu in XP mode. |
348 | - */ |
349 | - static Border getXPMenuBorder() { |
350 | - if (xpMenuBorder == null) { |
351 | - xpMenuBorder = new BasicBorders.MarginBorder(); |
352 | - } |
353 | - return xpMenuBorder; |
354 | - } |
355 | - |
356 | - /** |
357 | - * Returns a border instance for a <code>JMenuItem</code>. |
358 | - */ |
359 | - static Border getMenuItemBorder() { |
360 | - if (menuItemBorder == null) { |
361 | - menuItemBorder = new BorderUIResource(new BasicBorders.MarginBorder()); |
362 | - } |
363 | - return menuItemBorder; |
364 | - } |
365 | - |
366 | - /** |
367 | - * Returns a separator border instance for <code>JMenuBar</code> or <code>JToolBar</code>. |
368 | - */ |
369 | - static Border getSeparatorBorder() { |
370 | - if (separatorBorder == null) { |
371 | - separatorBorder = new BorderUIResource.CompoundBorderUIResource( |
372 | - new SeparatorBorder(), |
373 | - new BasicBorders.MarginBorder()); |
374 | - } |
375 | - return separatorBorder; |
376 | - } |
377 | - |
378 | - /** |
379 | - * Returns an etched border instance for <code>JMenuBar</code> or <code>JToolBar</code>. |
380 | - */ |
381 | - static Border getEtchedBorder() { |
382 | - if (etchedBorder == null) { |
383 | - etchedBorder = new BorderUIResource.CompoundBorderUIResource( |
384 | - new EtchedBorder(), |
385 | - new BasicBorders.MarginBorder()); |
386 | - } |
387 | - return etchedBorder; |
388 | - } |
389 | - |
390 | - /** |
391 | - * Returns a special border for a <code>JMenuBar</code> that |
392 | - * is used in a header just above a <code>JToolBar</code>. |
393 | - */ |
394 | - static Border getMenuBarHeaderBorder() { |
395 | - if (menuBarHeaderBorder == null) { |
396 | - menuBarHeaderBorder = new BorderUIResource.CompoundBorderUIResource( |
397 | - new MenuBarHeaderBorder(), |
398 | - new BasicBorders.MarginBorder()); |
399 | - } |
400 | - return menuBarHeaderBorder; |
401 | - } |
402 | - |
403 | - /** |
404 | - * Returns a border instance for a <code>JPopupMenu</code>. |
405 | - * |
406 | - * @return the lazily created popup menu border |
407 | - */ |
408 | - static Border getPopupMenuBorder() { |
409 | - if (popupMenuBorder == null) { |
410 | - popupMenuBorder = new PopupMenuBorder(); |
411 | - } |
412 | - return popupMenuBorder; |
413 | - } |
414 | - |
415 | - /** |
416 | - * Returns a no-margin border instance for a <code>JPopupMenu</code>. |
417 | - * |
418 | - * @return the lazily created no-margin popup menu border |
419 | - */ |
420 | - static Border getNoMarginPopupMenuBorder() { |
421 | - if (noMarginPopupMenuBorder == null) { |
422 | - noMarginPopupMenuBorder = new NoMarginPopupMenuBorder(); |
423 | - } |
424 | - return noMarginPopupMenuBorder; |
425 | - } |
426 | - |
427 | - /** |
428 | - * Returns a special border for a <code>JToolBar</code> that |
429 | - * is used in a header just below a <code>JMenuBar</code>. |
430 | - */ |
431 | - static Border getToolBarHeaderBorder() { |
432 | - if (toolBarHeaderBorder == null) { |
433 | - toolBarHeaderBorder = new BorderUIResource.CompoundBorderUIResource( |
434 | - new ToolBarHeaderBorder(), |
435 | - new BasicBorders.MarginBorder()); |
436 | - } |
437 | - return toolBarHeaderBorder; |
438 | - } |
439 | - |
440 | - /** |
441 | - * Returns a border for a rollover <code>AbstractButton</code>. |
442 | - */ |
443 | - static Border getRolloverButtonBorder() { |
444 | - if (rolloverButtonBorder == null) { |
445 | - rolloverButtonBorder = new CompoundBorder( // No UIResource |
446 | - new RolloverButtonBorder(), |
447 | - new RolloverMarginBorder()); |
448 | - } |
449 | - return rolloverButtonBorder; |
450 | - } |
451 | - |
452 | - |
453 | - // Helper Classes ******************************************************************* |
454 | - |
455 | - |
456 | - // Copied from BasicBorders, has correct black color for the outer default rectangle. |
457 | - private static final class ButtonBorder extends AbstractBorder implements UIResource { |
458 | - |
459 | - private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0); |
460 | - |
461 | - private final Color shadow; |
462 | - private final Color darkShadow; |
463 | - private final Color highlight; |
464 | - private final Color lightHighlight; |
465 | - private final Color defaultColor; |
466 | - |
467 | - public ButtonBorder(Color shadow, Color darkShadow, |
468 | - Color highlight, Color lightHighlight, Color defaultColor) { |
469 | - this.shadow = shadow; |
470 | - this.darkShadow = darkShadow; |
471 | - this.highlight = highlight; |
472 | - this.lightHighlight = lightHighlight; |
473 | - this.defaultColor = defaultColor; |
474 | - } |
475 | - |
476 | - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { |
477 | - boolean isPressed = false; |
478 | - boolean isDefault = false; |
479 | - |
480 | - if (c instanceof AbstractButton) { |
481 | - AbstractButton b = (AbstractButton) c; |
482 | - ButtonModel model = b.getModel(); |
483 | - |
484 | - isPressed = model.isPressed() && model.isArmed(); |
485 | - if (c instanceof JButton) { |
486 | - isDefault = ((JButton) c).isDefaultButton(); |
487 | - } |
488 | - } |
489 | - drawBezel(g, x, y, width, height, isPressed, isDefault, shadow, |
490 | - darkShadow, highlight, lightHighlight, defaultColor); |
491 | - } |
492 | - |
493 | - public Insets getBorderInsets(Component c) { |
494 | - return getBorderInsets(c, EMPTY_INSETS); |
495 | - } |
496 | - |
497 | - public Insets getBorderInsets(Component c, Insets insets) { |
498 | - // leave room for default visual |
499 | - insets.top = 2; |
500 | - insets.left = insets.bottom = insets.right = 3; |
501 | - return insets; |
502 | - } |
503 | - |
504 | - } |
505 | - |
506 | - /** |
507 | - * An abstract superclass for borders. |
508 | - */ |
509 | - private abstract static class AbstractButtonBorder extends AbstractBorder implements UIResource { |
510 | - |
511 | - private static final Insets INSETS = new Insets(2, 2, 2, 2); |
512 | - |
513 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
514 | - AbstractButton button = (AbstractButton) c; |
515 | - ButtonModel model = button.getModel(); |
516 | - |
517 | - // |
518 | - //System.out.println("Pressed=" + model.isPressed() + "; armed=" + model.isArmed()); |
519 | - //if (!model.isArmed()) return; |
520 | - |
521 | - if (model.isPressed()) |
522 | - WindowsUtils.drawPressed3DBorder(g, x, y, w, h); |
523 | - else |
524 | - WindowsUtils.drawFlush3DBorder(g, x, y, w, h); |
525 | - } |
526 | - |
527 | - public Insets getBorderInsets(Component c) { return INSETS; } |
528 | - } |
529 | - |
530 | - |
531 | - /** |
532 | - * A border used for <code>Buttons</code> that have the rollover property enabled. |
533 | - */ |
534 | - private static final class RolloverButtonBorder extends AbstractButtonBorder { |
535 | - |
536 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
537 | - AbstractButton b = (AbstractButton) c; |
538 | - ButtonModel model = b.getModel(); |
539 | - |
540 | - if (!model.isEnabled()) |
541 | - return; |
542 | - |
543 | - if (!(c instanceof JToggleButton)) { |
544 | - if (model.isRollover()) // && !( model.isPressed() && !model.isArmed())) |
545 | - super.paintBorder(c, g, x, y, w, h); |
546 | - return; |
547 | - } |
548 | - |
549 | - if (model.isSelected()) |
550 | - WindowsUtils.drawPressed3DBorder(g, x, y, w, h); |
551 | - else if (model.isRollover()) { |
552 | - super.paintBorder(c, g, x, y, w, h); |
553 | - /* |
554 | - if (model.isPressed() && model.isArmed()) { |
555 | - ExtMetalUtils.drawPressed3DBorder(g, x, y, w, h); |
556 | - } else { |
557 | - ExtMetalUtils.drawFlush3DBorder(g, x, y, w, h); |
558 | - }*/ |
559 | - } |
560 | - } |
561 | - } |
562 | - |
563 | - |
564 | - /** |
565 | - * A border which is like a Margin border but it will only honor the margin |
566 | - * if the margin has been explicitly set by the developer. |
567 | - */ |
568 | - private static final class RolloverMarginBorder extends EmptyBorder { |
569 | - |
570 | - private RolloverMarginBorder() { |
571 | - super(1, 1, 1, 1); |
572 | - } |
573 | - |
574 | - |
575 | - public Insets getBorderInsets(Component c) { |
576 | - return getBorderInsets(c, new Insets(0, 0, 0, 0)); |
577 | - } |
578 | - |
579 | - |
580 | - public Insets getBorderInsets(Component c, Insets insets) { |
581 | - Insets margin = null; |
582 | - |
583 | - if (c instanceof AbstractButton) { |
584 | - margin = ((AbstractButton) c).getMargin(); |
585 | - } |
586 | - if (margin == null || margin instanceof UIResource) { |
587 | - // default margin so replace |
588 | - insets.left = left; |
589 | - insets.top = top; |
590 | - insets.right = right; |
591 | - insets.bottom = bottom; |
592 | - } else { |
593 | - // Margin which has been explicitly set by the user. |
594 | - insets.left = margin.left; |
595 | - insets.top = margin.top; |
596 | - insets.right = margin.right; |
597 | - insets.bottom = margin.bottom; |
598 | - } |
599 | - return insets; |
600 | - } |
601 | - } |
602 | - |
603 | - /** |
604 | - * A border that looks like a separator line; used for menu bars and tool bars. |
605 | - */ |
606 | - private static final class SeparatorBorder extends AbstractBorder implements UIResource { |
607 | - |
608 | - private static final Insets INSETS = new Insets(0, 3, 2, 1); |
609 | - |
610 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
611 | - g.translate(x, y); |
612 | - g.setColor( UIManager.getColor("Separator.foreground")); |
613 | - g.drawLine( 0, h - 2, w - 1, h - 2 ); |
614 | - |
615 | - g.setColor( UIManager.getColor("Separator.background")); |
616 | - g.drawLine( 0, h - 1, w - 1, h - 1 ); |
617 | - g.translate(-x, -y); |
618 | - } |
619 | - |
620 | - public Insets getBorderInsets(Component c) { return INSETS; } |
621 | - } |
622 | - |
623 | - |
624 | - /** |
625 | - * A thin raised border. |
626 | - */ |
627 | - static final class ThinRaisedBorder extends AbstractBorder implements UIResource { |
628 | - |
629 | - private static final Insets INSETS = new Insets(1, 1, 1, 1); |
630 | - |
631 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
632 | - WindowsUtils.drawFlush3DBorder(g, x, y, w, h); |
633 | - } |
634 | - |
635 | - public Insets getBorderInsets(Component c) { return INSETS; } |
636 | - } |
637 | - |
638 | - |
639 | - /** |
640 | - * A thin lowered border. |
641 | - */ |
642 | - static final class ThinLoweredBorder extends AbstractBorder implements UIResource { |
643 | - |
644 | - private static final Insets INSETS = new Insets(1, 1, 1, 1); |
645 | - |
646 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
647 | - WindowsUtils.drawPressed3DBorder(g, x, y, w, h); |
648 | - } |
649 | - |
650 | - public Insets getBorderInsets(Component c) { return INSETS; } |
651 | - } |
652 | - |
653 | - |
654 | - /** |
655 | - * A border used for menu bars and tool bars in <code>HeaderStyle.SINGLE</code>. |
656 | - * The bar is wrapped by an inner thin raised border, |
657 | - * which in turn is wrapped by an outer thin lowered border. |
658 | - */ |
659 | - private static final class EtchedBorder extends AbstractBorder implements UIResource { |
660 | - |
661 | - private static final Insets INSETS = new Insets(2, 2, 2, 2); |
662 | - |
663 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
664 | - WindowsUtils.drawPressed3DBorder(g, x, y, w, h); |
665 | - WindowsUtils.drawFlush3DBorder (g, x + 1, y + 1, w - 2, h - 2); |
666 | - } |
667 | - |
668 | - public Insets getBorderInsets(Component c) { return INSETS; } |
669 | - } |
670 | - |
671 | - |
672 | - /** |
673 | - * A border used for menu bars in <code>HeaderStyle.BOTH</code>. |
674 | - * The menu bar and tool bar are wrapped by a thin raised border, |
675 | - * both together are wrapped by a thin lowered border. |
676 | - */ |
677 | - private static final class MenuBarHeaderBorder extends AbstractBorder implements UIResource { |
678 | - |
679 | - private static final Insets INSETS = new Insets(2, 2, 1, 2); |
680 | - |
681 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
682 | - WindowsUtils.drawPressed3DBorder(g, x, y, w, h + 1); |
683 | - WindowsUtils.drawFlush3DBorder (g, x + 1, y + 1, w - 2, h - 1); |
684 | - } |
685 | - |
686 | - public Insets getBorderInsets(Component c) { return INSETS; } |
687 | - } |
688 | - |
689 | - |
690 | - private static final class PopupMenuBorder extends AbstractBorder implements UIResource { |
691 | - |
692 | - private static final Insets INSETS = new Insets(3, 3, 3, 3); |
693 | - |
694 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
695 | - g.translate(x, y); |
696 | - g.setColor(UIManager.getColor("controlShadow")); |
697 | - g.drawRect(0, 0, w-1, h-1); |
698 | - g.setColor(UIManager.getColor("MenuItem.background")); |
699 | - g.drawRect(1, 1, w-3, h-3); |
700 | - g.drawRect(2, 2, w-5, h-5); |
701 | - g.translate(-x, -y); |
702 | - } |
703 | - |
704 | - public Insets getBorderInsets(Component c) { return INSETS; } |
705 | - } |
706 | - |
707 | - |
708 | - private static final class NoMarginPopupMenuBorder extends AbstractBorder implements UIResource { |
709 | - |
710 | - private static final Insets INSETS = new Insets(1, 1, 1, 1); |
711 | - |
712 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
713 | - g.translate(x, y); |
714 | - g.setColor(UIManager.getColor("controlShadow")); |
715 | - g.drawRect(0, 0, w-1, h-1); |
716 | -// g.setColor(UIManager.getColor("MenuItem.background")); |
717 | -// g.drawRect(1, 1, 0, h-3); |
718 | - g.translate(-x, -y); |
719 | - } |
720 | - |
721 | - public Insets getBorderInsets(Component c) { return INSETS; } |
722 | - } |
723 | - |
724 | - /** |
725 | - * A border used for tool bars in <code>HeaderStyle.BOTH</code>. |
726 | - * The menu bar and tool bar are wrapped by a thin raised border, |
727 | - * both together are wrapped by a thin lowered border. |
728 | - */ |
729 | - private static final class ToolBarHeaderBorder extends AbstractBorder implements UIResource { |
730 | - |
731 | - private static final Insets INSETS = new Insets(1, 2, 2, 2); |
732 | - |
733 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
734 | - WindowsUtils.drawPressed3DBorder(g, x, y - 1, w, h + 1); |
735 | - WindowsUtils.drawFlush3DBorder (g, x + 1, y, w - 2, h - 1); |
736 | - } |
737 | - |
738 | - public Insets getBorderInsets(Component c) { return INSETS; } |
739 | - } |
740 | - |
741 | - |
742 | - /** |
743 | - * A border used for menus. |
744 | - */ |
745 | - private static final class MenuBorder extends AbstractBorder implements UIResource { |
746 | - |
747 | - private static final Insets INSETS = new Insets(1, 1, 1, 1); |
748 | - |
749 | - public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
750 | - AbstractButton b = (AbstractButton) c; |
751 | - ButtonModel model = b.getModel(); |
752 | - |
753 | - //System.out.println("rollover=" + model.isRollover()); |
754 | - //if ((3 < 4) || model.isRollover()) { // && !(model.isPressed() && !model.isArmed())) { |
755 | - if (model.isSelected()) |
756 | - WindowsUtils.drawPressed3DBorder(g, x, y, w, h); |
757 | - else if (model.isRollover()) |
758 | - WindowsUtils.drawFlush3DBorder(g, x, y, w, h); |
759 | - //} |
760 | - } |
761 | - |
762 | - public Insets getBorderInsets(Component c) { return INSETS; } |
763 | - |
764 | - } |
765 | - |
766 | - |
767 | - // Helper Code ********************************************************************** |
768 | - |
769 | - // Copied from BasicGraphicsUtils, has an additional color for the default rectangle. |
770 | - private static void drawBezel(Graphics g, int x, int y, int w, int h, |
771 | - boolean isPressed, boolean isDefault, |
772 | - Color shadow, Color darkShadow, |
773 | - Color highlight, Color lightHighlight, Color defaultColor) |
774 | - { |
775 | - Color oldColor = g.getColor(); // Make no net change to g |
776 | - g.translate(x, y); |
777 | - |
778 | - if (isPressed && isDefault) { |
779 | - g.setColor(darkShadow); |
780 | - g.drawRect(0, 0, w - 1, h - 1); |
781 | - g.setColor(shadow); |
782 | - g.drawRect(1, 1, w - 3, h - 3); |
783 | - } else if (isPressed) { |
784 | - BasicGraphicsUtils.drawLoweredBezel(g, x, y, w, h, |
785 | - shadow, darkShadow, highlight, lightHighlight); |
786 | - } else if (isDefault) { |
787 | - g.setColor(defaultColor); |
788 | - g.drawRect(0, 0, w-1, h-1); |
789 | - |
790 | - g.setColor(lightHighlight); |
791 | - g.drawLine(1, 1, 1, h-3); |
792 | - g.drawLine(2, 1, w-3, 1); |
793 | - |
794 | - g.setColor(highlight); |
795 | - g.drawLine(2, 2, 2, h-4); |
796 | - g.drawLine(3, 2, w-4, 2); |
797 | - |
798 | - g.setColor(shadow); |
799 | - g.drawLine(2, h-3, w-3, h-3); |
800 | - g.drawLine(w-3, 2, w-3, h-4); |
801 | - |
802 | - g.setColor(darkShadow); |
803 | - g.drawLine(1, h-2, w-2, h-2); |
804 | - g.drawLine(w-2, h-2, w-2, 1); |
805 | - } else { |
806 | - g.setColor(lightHighlight); |
807 | - g.drawLine(0, 0, 0, h-1); |
808 | - g.drawLine(1, 0, w-2, 0); |
809 | - |
810 | - g.setColor(highlight); |
811 | - g.drawLine(1, 1, 1, h-3); |
812 | - g.drawLine(2, 1, w-3, 1); |
813 | - |
814 | - g.setColor(shadow); |
815 | - g.drawLine(1, h-2, w-2, h-2); |
816 | - g.drawLine(w-2, 1, w-2, h-3); |
817 | - |
818 | - g.setColor(darkShadow); |
819 | - g.drawLine(0, h-1, w-1, h-1); |
820 | - g.drawLine(w-1, h-1, w-1, 0); |
821 | - } |
822 | - g.translate(-x, -y); |
823 | - g.setColor(oldColor); |
824 | - } |
825 | - |
826 | -} |
827 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsButtonUI.java |
828 | +++ /dev/null |
829 | @@ -1,71 +0,0 @@ |
830 | -/* |
831 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
832 | - * |
833 | - * Redistribution and use in source and binary forms, with or without |
834 | - * modification, are permitted provided that the following conditions are met: |
835 | - * |
836 | - * o Redistributions of source code must retain the above copyright notice, |
837 | - * this list of conditions and the following disclaimer. |
838 | - * |
839 | - * o Redistributions in binary form must reproduce the above copyright notice, |
840 | - * this list of conditions and the following disclaimer in the documentation |
841 | - * and/or other materials provided with the distribution. |
842 | - * |
843 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
844 | - * its contributors may be used to endorse or promote products derived |
845 | - * from this software without specific prior written permission. |
846 | - * |
847 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
848 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
849 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
850 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
851 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
852 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
853 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
854 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
855 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
856 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
857 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
858 | - */ |
859 | - |
860 | -package com.jgoodies.looks.windows; |
861 | - |
862 | -import java.awt.Dimension; |
863 | - |
864 | -import javax.swing.AbstractButton; |
865 | -import javax.swing.JComponent; |
866 | -import javax.swing.plaf.ComponentUI; |
867 | -import javax.swing.plaf.basic.BasicGraphicsUtils; |
868 | - |
869 | -/** |
870 | - * The JGoodies Windows look&feel implementation of <code>ButtonUI</code>.<p> |
871 | - * |
872 | - * Unlike its superclass it returns even and odd preferred heights. |
873 | - * |
874 | - * @author Karsten Lentzsch |
875 | - * @version $Revision: 1.3 $ |
876 | - */ |
877 | -public final class WindowsButtonUI extends com.sun.java.swing.plaf.windows.WindowsButtonUI { |
878 | - |
879 | - public static ComponentUI createUI(JComponent b) { |
880 | - return new WindowsButtonUI(); |
881 | - } |
882 | - |
883 | - public Dimension getPreferredSize(JComponent c) { |
884 | - AbstractButton b = (AbstractButton) c; |
885 | - Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, b |
886 | - .getIconTextGap()); |
887 | - |
888 | - /* Ensure that the width of the button is odd, |
889 | - * to improve the painting of the dashed focus line |
890 | - */ |
891 | - if (d != null && b.isFocusPainted()) { |
892 | - if (d.width % 2 == 0) { |
893 | - d.width += 1; |
894 | - } |
895 | - } |
896 | - return d; |
897 | - } |
898 | - |
899 | - |
900 | -} |
901 | \ No newline at end of file |
902 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsComboBoxEditor.java |
903 | +++ /dev/null |
904 | @@ -1,71 +0,0 @@ |
905 | -/* |
906 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
907 | - * |
908 | - * Redistribution and use in source and binary forms, with or without |
909 | - * modification, are permitted provided that the following conditions are met: |
910 | - * |
911 | - * o Redistributions of source code must retain the above copyright notice, |
912 | - * this list of conditions and the following disclaimer. |
913 | - * |
914 | - * o Redistributions in binary form must reproduce the above copyright notice, |
915 | - * this list of conditions and the following disclaimer in the documentation |
916 | - * and/or other materials provided with the distribution. |
917 | - * |
918 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
919 | - * its contributors may be used to endorse or promote products derived |
920 | - * from this software without specific prior written permission. |
921 | - * |
922 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
923 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
924 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
925 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
926 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
927 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
928 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
929 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
930 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
931 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
932 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
933 | - */ |
934 | - |
935 | -package com.jgoodies.looks.windows; |
936 | - |
937 | -import javax.swing.plaf.basic.BasicComboBoxEditor; |
938 | - |
939 | -import com.jgoodies.looks.common.ComboBoxEditorTextField; |
940 | - |
941 | -/** |
942 | - * The default editor for editable combo boxes in the |
943 | - * JGoodies Windows Look&Feel.<p> |
944 | - * |
945 | - * It differs from its superclass in that the border is quite the same as for |
946 | - * text fields: a compound border with an inner <code>MarginBorder</code>. |
947 | - * |
948 | - * @author Karsten Lentzsch |
949 | - * @version $Revision: 1.6 $ |
950 | - */ |
951 | -class WindowsComboBoxEditor extends BasicComboBoxEditor { |
952 | - |
953 | - WindowsComboBoxEditor(boolean isTableCellEditor) { |
954 | - editor = new ComboBoxEditorTextField(isTableCellEditor); |
955 | - } |
956 | - |
957 | - public void setItem(Object item) { |
958 | - super.setItem(item); |
959 | - editor.selectAll(); |
960 | - } |
961 | - |
962 | - /** |
963 | - * A subclass of BasicComboBoxEditor that implements UIResource. |
964 | - * BasicComboBoxEditor and WindowsComboBoxEditor don't implement UIResource |
965 | - * directly so that applications can safely override the cellRenderer |
966 | - * property with BasicListCellRenderer subclasses. |
967 | - */ |
968 | - static final class UIResource extends WindowsComboBoxEditor implements |
969 | - javax.swing.plaf.UIResource { |
970 | - |
971 | - UIResource(boolean isTableCellEditor) { |
972 | - super(isTableCellEditor); |
973 | - } |
974 | - } |
975 | -} |
976 | \ No newline at end of file |
977 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsComboBoxUI.java |
978 | +++ /dev/null |
979 | @@ -1,557 +0,0 @@ |
980 | -/* |
981 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
982 | - * |
983 | - * Redistribution and use in source and binary forms, with or without |
984 | - * modification, are permitted provided that the following conditions are met: |
985 | - * |
986 | - * o Redistributions of source code must retain the above copyright notice, |
987 | - * this list of conditions and the following disclaimer. |
988 | - * |
989 | - * o Redistributions in binary form must reproduce the above copyright notice, |
990 | - * this list of conditions and the following disclaimer in the documentation |
991 | - * and/or other materials provided with the distribution. |
992 | - * |
993 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
994 | - * its contributors may be used to endorse or promote products derived |
995 | - * from this software without specific prior written permission. |
996 | - * |
997 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
998 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
999 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
1000 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
1001 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
1002 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
1003 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
1004 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
1005 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
1006 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
1007 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1008 | - */ |
1009 | - |
1010 | -package com.jgoodies.looks.windows; |
1011 | - |
1012 | -import java.awt.*; |
1013 | -import java.beans.PropertyChangeEvent; |
1014 | -import java.beans.PropertyChangeListener; |
1015 | - |
1016 | -import javax.swing.*; |
1017 | -import javax.swing.border.Border; |
1018 | -import javax.swing.border.EmptyBorder; |
1019 | -import javax.swing.plaf.ComponentUI; |
1020 | -import javax.swing.plaf.UIResource; |
1021 | -import javax.swing.plaf.basic.BasicComboBoxRenderer; |
1022 | -import javax.swing.plaf.basic.BasicComboBoxUI; |
1023 | -import javax.swing.plaf.basic.BasicComboPopup; |
1024 | -import javax.swing.plaf.basic.ComboPopup; |
1025 | - |
1026 | -import com.jgoodies.looks.LookUtils; |
1027 | -import com.jgoodies.looks.Options; |
1028 | -import com.sun.java.swing.plaf.windows.WindowsTextFieldUI; |
1029 | - |
1030 | -/** |
1031 | - * The JGoodies Windows Look&Feel implementation of |
1032 | - * {@link javax.swing.plaf.ComboBoxUI}. |
1033 | - * Corrects the editor insets for editable combo boxes |
1034 | - * as well as the render insets for non-editable combos. And it has |
1035 | - * the same height as text fields - unless you change the renderer.<p> |
1036 | - * |
1037 | - * Also, this class offers to use the combo's popup prototype display value |
1038 | - * to compute the popup menu width. This is an optional feature of |
1039 | - * the JGoodies Windows L&f implemented via a client property key. |
1040 | - * |
1041 | - * @author Karsten Lentzsch |
1042 | - * @version $Revision: 1.19 $ |
1043 | - * |
1044 | - * @see Options#COMBO_POPUP_PROTOTYPE_DISPLAY_VALUE_KEY |
1045 | - */ |
1046 | -public class WindowsComboBoxUI extends com.sun.java.swing.plaf.windows.WindowsComboBoxUI { |
1047 | - |
1048 | - private static final String CELL_EDITOR_KEY = "JComboBox.isTableCellEditor"; |
1049 | - |
1050 | - /** |
1051 | - * Used to determine the minimum height of a text field, |
1052 | - * which in turn is used to answer the combobox's minimum height. |
1053 | - */ |
1054 | - private static final JTextField PHANTOM = new JTextField("Phantom"); |
1055 | - |
1056 | - private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0); |
1057 | - private static final Border EMPTY_BORDER = new EmptyBorder(EMPTY_INSETS); |
1058 | - |
1059 | - |
1060 | - private boolean tableCellEditor; |
1061 | - private PropertyChangeListener propertyChangeListener; |
1062 | - |
1063 | - |
1064 | - // ************************************************************************ |
1065 | - |
1066 | - public static ComponentUI createUI(JComponent b) { |
1067 | - ensurePhantomHasWindowsUI(); |
1068 | - return new WindowsComboBoxUI(); |
1069 | - } |
1070 | - |
1071 | - |
1072 | - /** |
1073 | - * Ensures that the phantom text field has a Windows text field UI. |
1074 | - */ |
1075 | - private static void ensurePhantomHasWindowsUI() { |
1076 | - if (!(PHANTOM.getUI() instanceof WindowsTextFieldUI)) { |
1077 | - PHANTOM.updateUI(); |
1078 | - } |
1079 | - } |
1080 | - |
1081 | - |
1082 | - // ************************************************************************ |
1083 | - |
1084 | - public void installUI(JComponent c) { |
1085 | - super.installUI(c); |
1086 | - tableCellEditor = isTableCellEditor(); |
1087 | - } |
1088 | - |
1089 | - protected void installListeners() { |
1090 | - super.installListeners(); |
1091 | - propertyChangeListener = new TableCellEditorPropertyChangeHandler(); |
1092 | - comboBox.addPropertyChangeListener(CELL_EDITOR_KEY, propertyChangeListener); |
1093 | - } |
1094 | - |
1095 | - protected void uninstallListeners() { |
1096 | - super.uninstallListeners(); |
1097 | - comboBox.removePropertyChangeListener(CELL_EDITOR_KEY, propertyChangeListener); |
1098 | - propertyChangeListener = null; |
1099 | - } |
1100 | - |
1101 | - |
1102 | - /** |
1103 | - * Creates the arrow button that is to be used in the combo box.<p> |
1104 | - * |
1105 | - * Overridden to paint black triangles. |
1106 | - */ |
1107 | - protected JButton createArrowButton() { |
1108 | - return LookUtils.IS_LAF_WINDOWS_XP_ENABLED |
1109 | - ? super.createArrowButton() |
1110 | - : new WindowsArrowButton(SwingConstants.SOUTH); |
1111 | - } |
1112 | - |
1113 | - |
1114 | - /** |
1115 | - * Creates the editor that is to be used in editable combo boxes. |
1116 | - * This method only gets called if a custom editor has not already |
1117 | - * been installed in the JComboBox. |
1118 | - */ |
1119 | - protected ComboBoxEditor createEditor() { |
1120 | - return new com.jgoodies.looks.windows.WindowsComboBoxEditor.UIResource(tableCellEditor); |
1121 | - } |
1122 | - |
1123 | - |
1124 | - /** |
1125 | - * Creates a layout manager for managing the components which |
1126 | - * make up the combo box.<p> |
1127 | - * |
1128 | - * Overriden to use a layout that has a fixed width arrow button. |
1129 | - * |
1130 | - * @return an instance of a layout manager |
1131 | - */ |
1132 | - protected LayoutManager createLayoutManager() { |
1133 | - return new WindowsComboBoxLayoutManager(); |
1134 | - } |
1135 | - |
1136 | - |
1137 | - protected void configureEditor() { |
1138 | - super.configureEditor(); |
1139 | - if (!comboBox.isEnabled()) { |
1140 | - editor.setBackground(UIManager.getColor("ComboBox.disabledBackground")); |
1141 | - } |
1142 | - } |
1143 | - |
1144 | - /** |
1145 | - * Creates a ComboPopup that honors the optional combo popup display value |
1146 | - * that is used to compute the popup menu width. |
1147 | - */ |
1148 | - protected ComboPopup createPopup() { |
1149 | - return new WindowsComboPopup(comboBox); |
1150 | - } |
1151 | - |
1152 | - |
1153 | - /** |
1154 | - * Creates the default renderer that will be used in a non-editiable combo |
1155 | - * box. A default renderer will used only if a renderer has not been |
1156 | - * explicitly set with <code>setRenderer</code>.<p> |
1157 | - * |
1158 | - * This method differs from the superclass implementation in that |
1159 | - * it uses an empty border with the default left and right text insets, |
1160 | - * the same as used by a combo box editor. |
1161 | - * |
1162 | - * @return a <code>ListCellRender</code> used for the combo box |
1163 | - * @see javax.swing.JComboBox#setRenderer |
1164 | - */ |
1165 | - protected ListCellRenderer createRenderer() { |
1166 | - if (tableCellEditor) { |
1167 | - return super.createRenderer(); |
1168 | - } |
1169 | - BasicComboBoxRenderer renderer = new BasicComboBoxRenderer.UIResource(); |
1170 | - renderer.setBorder(UIManager.getBorder("ComboBox.rendererBorder")); |
1171 | - return renderer; |
1172 | - } |
1173 | - |
1174 | - |
1175 | - /** |
1176 | - * The minumum size is the size of the display area plus insets plus the button. |
1177 | - */ |
1178 | - public Dimension getMinimumSize(JComponent c) { |
1179 | - if (!isMinimumSizeDirty) { |
1180 | - return new Dimension(cachedMinimumSize); |
1181 | - } |
1182 | - Dimension size = getDisplaySize(); |
1183 | - Insets insets = getInsets(); |
1184 | - size.height += insets.top + insets.bottom; |
1185 | - int buttonWidth = getEditableButtonWidth(); |
1186 | - size.width += insets.left + insets.right + buttonWidth; |
1187 | - // The combo editor benefits from extra space for the caret. |
1188 | - // To make editable and non-editable equally wide, |
1189 | - // we always add 1 pixel. |
1190 | - size.width += 1; |
1191 | - |
1192 | - // Honor corrections made in #paintCurrentValue |
1193 | - ListCellRenderer renderer = comboBox.getRenderer(); |
1194 | - if (renderer instanceof JComponent) { |
1195 | - JComponent component = (JComponent) renderer; |
1196 | - Insets rendererInsets = component.getInsets(); |
1197 | - Insets editorInsets = UIManager.getInsets("ComboBox.editorInsets"); |
1198 | - int offsetLeft = Math.max(0, editorInsets.left - rendererInsets.left); |
1199 | - int offsetRight = Math.max(0, editorInsets.right - rendererInsets.right); |
1200 | - // int offsetTop = Math.max(0, editorInsets.top - rendererInsets.top); |
1201 | - // int offsetBottom = Math.max(0, editorInsets.bottom - rendererInsets.bottom); |
1202 | - size.width += offsetLeft + offsetRight; |
1203 | - //size.height += offsetTop + offsetBottom; |
1204 | - } |
1205 | - |
1206 | - // The height is oriented on the JTextField height |
1207 | - Dimension textFieldSize = PHANTOM.getMinimumSize(); |
1208 | - size.height = (LookUtils.IS_OS_WINDOWS_VISTA && !LookUtils.IS_LAF_WINDOWS_XP_ENABLED) |
1209 | - ? textFieldSize.height |
1210 | - : Math.max(textFieldSize.height, size.height); |
1211 | - |
1212 | - cachedMinimumSize.setSize(size.width, size.height); |
1213 | - isMinimumSizeDirty = false; |
1214 | - |
1215 | - return new Dimension(size); |
1216 | - } |
1217 | - |
1218 | - /** |
1219 | - * Delegates to #getMinimumSize(Component). |
1220 | - * Overridden to return the same result in JDK 1.5 as in JDK 1.4. |
1221 | - */ |
1222 | - public Dimension getPreferredSize(JComponent c) { |
1223 | - return getMinimumSize(c); |
1224 | - } |
1225 | - |
1226 | - |
1227 | - /** |
1228 | - * Paints the currently selected item. |
1229 | - */ |
1230 | - public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) { |
1231 | - ListCellRenderer renderer = comboBox.getRenderer(); |
1232 | - Component c; |
1233 | - boolean isVistaReadOnlyCombo = isVistaXPStyleReadOnlyCombo(); |
1234 | - |
1235 | - if (hasFocus && !isPopupVisible(comboBox)) { |
1236 | - c = renderer.getListCellRendererComponent(listBox, |
1237 | - comboBox.getSelectedItem(), |
1238 | - -1, |
1239 | - true, |
1240 | - false); |
1241 | - } else { |
1242 | - c = renderer.getListCellRendererComponent(listBox, |
1243 | - comboBox.getSelectedItem(), |
1244 | - -1, |
1245 | - false, |
1246 | - false ); |
1247 | - c.setBackground(UIManager.getColor("ComboBox.background")); |
1248 | - } |
1249 | - Border oldBorder = null; |
1250 | - Rectangle originalBounds = new Rectangle(bounds); |
1251 | - if ((c instanceof JComponent) && !tableCellEditor) { |
1252 | - JComponent component = (JComponent) c; |
1253 | - if (isRendererBorderRemovable(component)) { |
1254 | - oldBorder = component.getBorder(); |
1255 | - component.setBorder(EMPTY_BORDER); //new WindowsBorders.DashedBorder(c.getForeground(), 1)); |
1256 | - } |
1257 | - Insets rendererInsets = component.getInsets(); |
1258 | - Insets editorInsets = UIManager.getInsets("ComboBox.editorInsets"); |
1259 | - int offsetLeft = Math.max(0, editorInsets.left - rendererInsets.left); |
1260 | - int offsetRight = Math.max(0, editorInsets.right - rendererInsets.right); |
1261 | - int offsetTop = Math.max(0, editorInsets.top - rendererInsets.top); |
1262 | - int offsetBottom = Math.max(0, editorInsets.bottom - rendererInsets.bottom); |
1263 | - bounds.x += offsetLeft; |
1264 | - bounds.y += offsetTop; |
1265 | - bounds.width -= offsetLeft + offsetRight - 1; |
1266 | - bounds.height -= offsetTop + offsetBottom; |
1267 | - } |
1268 | - |
1269 | - c.setFont(comboBox.getFont()); |
1270 | - if (hasFocus && !isPopupVisible(comboBox) && !isVistaReadOnlyCombo) { |
1271 | - c.setForeground(listBox.getSelectionForeground()); |
1272 | - c.setBackground(listBox.getSelectionBackground()); |
1273 | - } else { |
1274 | - if (comboBox.isEnabled()) { |
1275 | - c.setForeground(comboBox.getForeground()); |
1276 | - c.setBackground(comboBox.getBackground()); |
1277 | - } else { |
1278 | - c.setForeground(UIManager.getColor("ComboBox.disabledForeground")); |
1279 | - c.setBackground(UIManager.getColor("ComboBox.disabledBackground")); |
1280 | - } |
1281 | - } |
1282 | - |
1283 | - // Fix for 4238829: should lay out the JPanel. |
1284 | - boolean shouldValidate = c instanceof JPanel; |
1285 | - |
1286 | - Boolean oldOpaque = null; |
1287 | - if (isVistaReadOnlyCombo && (c instanceof JComponent) && !(c instanceof DefaultListCellRenderer)) { |
1288 | - oldOpaque = Boolean.valueOf(c.isOpaque()); |
1289 | - ((JComponent) c).setOpaque(false); |
1290 | - } |
1291 | - currentValuePane.paintComponent(g, c, comboBox, bounds.x, bounds.y, |
1292 | - bounds.width, bounds.height, shouldValidate); |
1293 | - if (hasFocus) { |
1294 | - Color oldColor = g.getColor(); |
1295 | - g.setColor(comboBox.getForeground()); |
1296 | - if (isVistaReadOnlyCombo) { |
1297 | - int width = originalBounds.width - 2; |
1298 | - if ((width % 2) == 0) { |
1299 | - width += 1; |
1300 | - } |
1301 | - WindowsUtils.drawRoundedDashedRect(g, |
1302 | - originalBounds.x+1, originalBounds.y+1, |
1303 | - width, originalBounds.height-2); |
1304 | - } /*else { |
1305 | - BasicGraphicsUtils.drawDashedRect(g, |
1306 | - bounds.x, bounds.y, bounds.width, bounds.height); |
1307 | - }*/ |
1308 | - g.setColor(oldColor); |
1309 | - } |
1310 | - if (oldOpaque != null) { |
1311 | - ((JComponent) c).setOpaque(oldOpaque.booleanValue()); |
1312 | - } |
1313 | - if (oldBorder != null) { |
1314 | - ((JComponent) c).setBorder(oldBorder); |
1315 | - } |
1316 | - } |
1317 | - |
1318 | - /** |
1319 | - * Checks and answer whether the border of the given renderer component |
1320 | - * can be removed temporarily, so the combo's selection background will |
1321 | - * be consistent with the default renderer and native appearance. |
1322 | - * This test is invoked from <code>#paintCurrentValue</code>.<p> |
1323 | - * |
1324 | - * It is safe to remove an EmptyBorder if the component doesn't override |
1325 | - * <code>#update</code>, <code>#paint</code> and <code>#paintBorder</code>. |
1326 | - * Since we know the default renderer, we can remove its border.<p> |
1327 | - * |
1328 | - * Custom renderers may set a hint to make their border removable. |
1329 | - * To do so, set the client property "isBorderRemovable" |
1330 | - * to <code>Boolean.TRUE</code>. If this client property is set, |
1331 | - * its value will be returned. If it is not set, <code>true</code> is returned |
1332 | - * if and only if the component's border is an EmptyBorder. |
1333 | - * |
1334 | - * @param rendererComponent the renderer component to check |
1335 | - * @return true if the component's border can be removed, false if not |
1336 | - * @see #paintCurrentValue(Graphics, Rectangle, boolean) |
1337 | - */ |
1338 | - protected boolean isRendererBorderRemovable(JComponent rendererComponent) { |
1339 | - if (rendererComponent instanceof BasicComboBoxRenderer.UIResource) |
1340 | - return true; |
1341 | - Object hint = rendererComponent.getClientProperty(Options.COMBO_RENDERER_IS_BORDER_REMOVABLE); |
1342 | - if (hint != null) |
1343 | - return Boolean.TRUE.equals(hint); |
1344 | - Border border = rendererComponent.getBorder(); |
1345 | - return border instanceof EmptyBorder; |
1346 | - } |
1347 | - |
1348 | - |
1349 | - private boolean isVistaXPStyleReadOnlyCombo() { |
1350 | - return LookUtils.IS_OS_WINDOWS_VISTA |
1351 | - && LookUtils.IS_LAF_WINDOWS_XP_ENABLED |
1352 | - && !comboBox.isEditable(); |
1353 | - } |
1354 | - |
1355 | - |
1356 | - /** |
1357 | - * Returns the area that is reserved for drawing the currently selected item. |
1358 | - */ |
1359 | - protected Rectangle rectangleForCurrentValue() { |
1360 | - int width = comboBox.getWidth(); |
1361 | - int height = comboBox.getHeight(); |
1362 | - Insets insets = getInsets(); |
1363 | - int buttonWidth = getEditableButtonWidth(); |
1364 | - if (arrowButton != null) { |
1365 | - buttonWidth = arrowButton.getWidth(); |
1366 | - } |
1367 | - if (comboBox.getComponentOrientation().isLeftToRight()) { |
1368 | - return new Rectangle( |
1369 | - insets.left, |
1370 | - insets.top, |
1371 | - width - (insets.left + insets.right + buttonWidth), |
1372 | - height - (insets.top + insets.bottom)); |
1373 | - } else { |
1374 | - return new Rectangle( |
1375 | - insets.left + buttonWidth, |
1376 | - insets.top , |
1377 | - width - (insets.left + insets.right + buttonWidth), |
1378 | - height - (insets.top + insets.bottom)); |
1379 | - } |
1380 | - } |
1381 | - |
1382 | - |
1383 | - // Helper Code ************************************************************ |
1384 | - |
1385 | - /** |
1386 | - * Computes and returns the width of the arrow button in editable state. |
1387 | - * |
1388 | - * @return the width of the arrow button in editable state |
1389 | - */ |
1390 | - private int getEditableButtonWidth() { |
1391 | - return UIManager.getInt("ScrollBar.width"); |
1392 | - } |
1393 | - |
1394 | - /** |
1395 | - * Checks and answers if this UI's combo has a client property |
1396 | - * that indicates that the combo is used as a table cell editor. |
1397 | - * |
1398 | - * @return <code>true</code> if the table cell editor client property |
1399 | - * is set to <code>Boolean.TRUE</code>, <code>false</code> otherwise |
1400 | - */ |
1401 | - private boolean isTableCellEditor() { |
1402 | - return Boolean.TRUE.equals(comboBox.getClientProperty(CELL_EDITOR_KEY)); |
1403 | - } |
1404 | - |
1405 | - |
1406 | - // Collaborator Classes *************************************************** |
1407 | - |
1408 | - /** |
1409 | - * This layout manager handles the 'standard' layout of combo boxes. |
1410 | - * It puts the arrow button to the right and the editor to the left. |
1411 | - * If there is no editor it still keeps the arrow button to the right. |
1412 | - * |
1413 | - * Overriden to use a fixed arrow button width. |
1414 | - */ |
1415 | - private final class WindowsComboBoxLayoutManager |
1416 | - extends BasicComboBoxUI.ComboBoxLayoutManager { |
1417 | - |
1418 | - public void layoutContainer(Container parent) { |
1419 | - JComboBox cb = (JComboBox) parent; |
1420 | - |
1421 | - int width = cb.getWidth(); |
1422 | - int height = cb.getHeight(); |
1423 | - |
1424 | - Insets insets = getInsets(); |
1425 | - int buttonWidth = getEditableButtonWidth(); |
1426 | - int buttonHeight = height - (insets.top + insets.bottom); |
1427 | - |
1428 | - if (arrowButton != null) { |
1429 | - if (cb.getComponentOrientation().isLeftToRight()) { |
1430 | - arrowButton.setBounds( |
1431 | - width - (insets.right + buttonWidth), |
1432 | - insets.top, |
1433 | - buttonWidth, |
1434 | - buttonHeight); |
1435 | - } else { |
1436 | - arrowButton.setBounds( |
1437 | - insets.left, |
1438 | - insets.top, |
1439 | - buttonWidth, |
1440 | - buttonHeight); |
1441 | - } |
1442 | - } |
1443 | - if (editor != null) { |
1444 | - editor.setBounds(rectangleForCurrentValue()); |
1445 | - } |
1446 | - } |
1447 | - |
1448 | - } |
1449 | - |
1450 | - |
1451 | - /** |
1452 | - * Differs from the BasicComboPopup in that it uses the standard |
1453 | - * popmenu border and honors an optional popup prototype display value. |
1454 | - */ |
1455 | - private static final class WindowsComboPopup extends BasicComboPopup { |
1456 | - |
1457 | - private WindowsComboPopup(JComboBox combo) { |
1458 | - super(combo); |
1459 | - } |
1460 | - |
1461 | - /** |
1462 | - * Calculates the placement and size of the popup portion |
1463 | - * of the combo box based on the combo box location and |
1464 | - * the enclosing screen bounds. If no transformations are required, |
1465 | - * then the returned rectangle will have the same values |
1466 | - * as the parameters.<p> |
1467 | - * |
1468 | - * In addition to the superclass behavior, this class offers |
1469 | - * to use the combo's popup prototype display value to compute |
1470 | - * the popup menu width. This is an optional feature of |
1471 | - * the JGoodies Windows L&f implemented via a client property key.<p> |
1472 | - * |
1473 | - * If a prototype is set, the popup width is the maximum of the |
1474 | - * combobox width and the prototype based popup width. |
1475 | - * For the latter the renderer is used to render the prototype. |
1476 | - * The prototype based popup width is the prototype's width |
1477 | - * plus the scrollbar width - if any. The scrollbar test checks |
1478 | - * if there are more items than the combo's maximum row count. |
1479 | - * |
1480 | - * @param px starting x location |
1481 | - * @param py starting y location |
1482 | - * @param pw starting width |
1483 | - * @param ph starting height |
1484 | - * @return a rectangle which represents the placement and size of the popup |
1485 | - * |
1486 | - * @see Options#COMBO_POPUP_PROTOTYPE_DISPLAY_VALUE_KEY |
1487 | - * @see JComboBox#getMaximumRowCount() |
1488 | - */ |
1489 | - protected Rectangle computePopupBounds(int px, int py, int pw, int ph) { |
1490 | - Rectangle defaultBounds = super.computePopupBounds(px, py, pw, ph); |
1491 | - Object popupPrototypeDisplayValue = comboBox.getClientProperty( |
1492 | - Options.COMBO_POPUP_PROTOTYPE_DISPLAY_VALUE_KEY); |
1493 | - if (popupPrototypeDisplayValue == null) { |
1494 | - return defaultBounds; |
1495 | - } |
1496 | - |
1497 | - ListCellRenderer renderer = list.getCellRenderer(); |
1498 | - Component c = renderer.getListCellRendererComponent( |
1499 | - list, popupPrototypeDisplayValue, -1, true, true); |
1500 | - pw = c.getPreferredSize().width; |
1501 | - boolean hasVerticalScrollBar = |
1502 | - comboBox.getItemCount() > comboBox.getMaximumRowCount(); |
1503 | - if (hasVerticalScrollBar) { |
1504 | - // Add the scrollbar width. |
1505 | - JScrollBar verticalBar = scroller.getVerticalScrollBar(); |
1506 | - pw += verticalBar.getPreferredSize().width; |
1507 | - } |
1508 | - Rectangle prototypeBasedBounds = super.computePopupBounds(px, py, pw, ph); |
1509 | - return prototypeBasedBounds.width > defaultBounds.width |
1510 | - ? prototypeBasedBounds |
1511 | - : defaultBounds; |
1512 | - } |
1513 | - |
1514 | - } |
1515 | - |
1516 | - |
1517 | - // Handling Combo Changes ************************************************* |
1518 | - |
1519 | - /** |
1520 | - * Listens to changes in the table cell editor client property |
1521 | - * and updates the default editor - if any - to use the correct |
1522 | - * insets for this case. |
1523 | - */ |
1524 | - private final class TableCellEditorPropertyChangeHandler implements PropertyChangeListener { |
1525 | - public void propertyChange(PropertyChangeEvent evt) { |
1526 | - tableCellEditor = isTableCellEditor(); |
1527 | - if (comboBox.getRenderer() == null || comboBox.getRenderer() instanceof UIResource) { |
1528 | - comboBox.setRenderer(createRenderer()); |
1529 | - } |
1530 | - if (comboBox.getEditor() == null || comboBox.getEditor() instanceof UIResource) { |
1531 | - comboBox.setEditor(createEditor()); |
1532 | - } |
1533 | - } |
1534 | - } |
1535 | - |
1536 | -} |
1537 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsFieldCaret.java |
1538 | +++ /dev/null |
1539 | @@ -1,347 +0,0 @@ |
1540 | -/* |
1541 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
1542 | - * |
1543 | - * Redistribution and use in source and binary forms, with or without |
1544 | - * modification, are permitted provided that the following conditions are met: |
1545 | - * |
1546 | - * o Redistributions of source code must retain the above copyright notice, |
1547 | - * this list of conditions and the following disclaimer. |
1548 | - * |
1549 | - * o Redistributions in binary form must reproduce the above copyright notice, |
1550 | - * this list of conditions and the following disclaimer in the documentation |
1551 | - * and/or other materials provided with the distribution. |
1552 | - * |
1553 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
1554 | - * its contributors may be used to endorse or promote products derived |
1555 | - * from this software without specific prior written permission. |
1556 | - * |
1557 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
1558 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
1559 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
1560 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
1561 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
1562 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
1563 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
1564 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
1565 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
1566 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
1567 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1568 | - */ |
1569 | - |
1570 | -package com.jgoodies.looks.windows; |
1571 | - |
1572 | -import java.awt.*; |
1573 | -import java.awt.event.FocusEvent; |
1574 | -import java.awt.event.MouseEvent; |
1575 | - |
1576 | -import javax.swing.BoundedRangeModel; |
1577 | -import javax.swing.JFormattedTextField; |
1578 | -import javax.swing.JTextField; |
1579 | -import javax.swing.SwingUtilities; |
1580 | -import javax.swing.plaf.TextUI; |
1581 | -import javax.swing.plaf.UIResource; |
1582 | -import javax.swing.text.*; |
1583 | - |
1584 | -/** |
1585 | - * WindowsFieldCaret has different scrolling behavior than the DefaultCaret. |
1586 | - * Also, this caret is visible in non-editable fields, |
1587 | - * and the text is selected after a keyboard focus gained event. |
1588 | - * For the latter see also issue #4337647 in Sun's bug database. |
1589 | - * |
1590 | - * @author Karsten Lentzsch |
1591 | - * @version $Revision: 1.5 $ |
1592 | - * |
1593 | - */ |
1594 | -final class WindowsFieldCaret extends DefaultCaret implements UIResource { |
1595 | - |
1596 | - private static final LayeredHighlighter.LayerPainter WindowsPainter = |
1597 | - new WindowsHighlightPainter(null); |
1598 | - |
1599 | - |
1600 | - WindowsFieldCaret() { |
1601 | - super(); |
1602 | - } |
1603 | - |
1604 | - |
1605 | - // Begin of Added Code ---------------------------------------------- |
1606 | - |
1607 | - private boolean isKeyboardFocusEvent = true; |
1608 | - |
1609 | - |
1610 | - public void focusGained(FocusEvent e) { |
1611 | - if (getComponent().isEnabled()) { |
1612 | - setVisible(true); |
1613 | - setSelectionVisible(true); |
1614 | - } |
1615 | - |
1616 | - final JTextComponent c = getComponent(); |
1617 | - if (c.isEnabled() && isKeyboardFocusEvent) { |
1618 | - if (c instanceof JFormattedTextField) { |
1619 | - EventQueue.invokeLater(new Runnable() { |
1620 | - public void run() { |
1621 | - WindowsFieldCaret.super.setDot(0); |
1622 | - WindowsFieldCaret.super.moveDot(c.getDocument().getLength()); |
1623 | - } |
1624 | - }); |
1625 | - } else { |
1626 | - super.setDot(0); |
1627 | - super.moveDot(c.getDocument().getLength()); |
1628 | - } |
1629 | - } |
1630 | - } |
1631 | - |
1632 | - |
1633 | - public void focusLost(FocusEvent e) { |
1634 | - super.focusLost(e); |
1635 | - if (!e.isTemporary()) { |
1636 | - isKeyboardFocusEvent = true; |
1637 | - } |
1638 | - } |
1639 | - |
1640 | - |
1641 | - public void mousePressed(MouseEvent e) { |
1642 | - if (SwingUtilities.isLeftMouseButton(e) || e.isPopupTrigger()) { |
1643 | - isKeyboardFocusEvent = false; |
1644 | - } |
1645 | - super.mousePressed(e); |
1646 | - |
1647 | - } |
1648 | - |
1649 | - |
1650 | - public void mouseReleased(MouseEvent e) { |
1651 | - super.mouseReleased(e); |
1652 | - // super.mousePressed() does not transfer focus on popup clicks. |
1653 | - // Windows does. |
1654 | - if (e.isPopupTrigger()) { |
1655 | - isKeyboardFocusEvent = false; |
1656 | - if ((getComponent() != null) && getComponent().isEnabled() |
1657 | - && getComponent().isRequestFocusEnabled()) { |
1658 | - getComponent().requestFocus(); |
1659 | - } |
1660 | - } |
1661 | - } |
1662 | - |
1663 | - // End of Added Code ------------------------------------------------ |
1664 | - |
1665 | - /** |
1666 | - * Adjusts the visibility of the caret according to |
1667 | - * the windows feel which seems to be to move the |
1668 | - * caret out into the field by about a quarter of |
1669 | - * a field length if not visible. |
1670 | - */ |
1671 | - protected void adjustVisibility(Rectangle r) { |
1672 | - SwingUtilities.invokeLater(new SafeScroller(r)); |
1673 | - } |
1674 | - |
1675 | - |
1676 | - /** |
1677 | - * Gets the painter for the Highlighter. |
1678 | - * |
1679 | - * @return the painter |
1680 | - */ |
1681 | - protected Highlighter.HighlightPainter getSelectionPainter() { |
1682 | - return WindowsPainter; |
1683 | - } |
1684 | - |
1685 | - |
1686 | - private final class SafeScroller implements Runnable { |
1687 | - |
1688 | - SafeScroller(Rectangle r) { |
1689 | - this.r = r; |
1690 | - } |
1691 | - |
1692 | - |
1693 | - public void run() { |
1694 | - JTextField field = (JTextField) getComponent(); |
1695 | - if (field != null) { |
1696 | - TextUI ui = field.getUI(); |
1697 | - int dot = getDot(); |
1698 | - // PENDING: We need to expose the bias in DefaultCaret. |
1699 | - Position.Bias bias = Position.Bias.Forward; |
1700 | - Rectangle startRect = null; |
1701 | - try { |
1702 | - startRect = ui.modelToView(field, dot, bias); |
1703 | - } catch (BadLocationException ble) {} |
1704 | - |
1705 | - Insets i = field.getInsets(); |
1706 | - BoundedRangeModel vis = field.getHorizontalVisibility(); |
1707 | - int x = r.x + vis.getValue() - i.left; |
1708 | - int quarterSpan = vis.getExtent() / 4; |
1709 | - if (r.x < i.left) { |
1710 | - vis.setValue(x - quarterSpan); |
1711 | - } else if (r.x + r.width > i.left + vis.getExtent()) { |
1712 | - vis.setValue(x - (3 * quarterSpan)); |
1713 | - } |
1714 | - // If we scroll, our visual location will have changed, |
1715 | - // but we won't have updated our internal location as |
1716 | - // the model hasn't changed. This checks for the change, |
1717 | - // and if necessary, resets the internal location. |
1718 | - if (startRect != null) { |
1719 | - try { |
1720 | - Rectangle endRect; |
1721 | - endRect = ui.modelToView(field, dot, bias); |
1722 | - if (endRect != null && !endRect.equals(startRect)){ |
1723 | - damage(endRect); |
1724 | - } |
1725 | - } catch (BadLocationException ble) {} |
1726 | - } |
1727 | - } |
1728 | - } |
1729 | - |
1730 | - private Rectangle r; |
1731 | - } |
1732 | - |
1733 | - // Helper Classes ********************************************************* |
1734 | - |
1735 | - private static final class WindowsHighlightPainter extends |
1736 | - DefaultHighlighter.DefaultHighlightPainter { |
1737 | - WindowsHighlightPainter(Color c) { |
1738 | - super(c); |
1739 | - } |
1740 | - |
1741 | - |
1742 | - // --- HighlightPainter methods --------------------------------------- |
1743 | - |
1744 | - /** |
1745 | - * Paints a highlight. |
1746 | - * |
1747 | - * @param g the graphics context |
1748 | - * @param offs0 the starting model offset >= 0 |
1749 | - * @param offs1 the ending model offset >= offs1 |
1750 | - * @param bounds the bounding box for the highlight |
1751 | - * @param c the editor |
1752 | - */ |
1753 | - public void paint(Graphics g, int offs0, int offs1, Shape bounds, |
1754 | - JTextComponent c) { |
1755 | - Rectangle alloc = bounds.getBounds(); |
1756 | - try { |
1757 | - // --- determine locations --- |
1758 | - TextUI mapper = c.getUI(); |
1759 | - Rectangle p0 = mapper.modelToView(c, offs0); |
1760 | - Rectangle p1 = mapper.modelToView(c, offs1); |
1761 | - |
1762 | - // --- render --- |
1763 | - Color color = getColor(); |
1764 | - |
1765 | - if (color == null) { |
1766 | - g.setColor(c.getSelectionColor()); |
1767 | - } else { |
1768 | - g.setColor(color); |
1769 | - } |
1770 | - boolean firstIsDot = false; |
1771 | - boolean secondIsDot = false; |
1772 | - if (c.isEditable()) { |
1773 | - int dot = c.getCaretPosition(); |
1774 | - firstIsDot = (offs0 == dot); |
1775 | - secondIsDot = (offs1 == dot); |
1776 | - } |
1777 | - if (p0.y == p1.y) { |
1778 | - // same line, render a rectangle |
1779 | - Rectangle r = p0.union(p1); |
1780 | - if (r.width > 0) { |
1781 | - if (firstIsDot) { |
1782 | - r.x++; |
1783 | - r.width--; |
1784 | - } else if (secondIsDot) { |
1785 | - r.width--; |
1786 | - } |
1787 | - } |
1788 | - g.fillRect(r.x, r.y, r.width, r.height); |
1789 | - } else { |
1790 | - // different lines |
1791 | - int p0ToMarginWidth = alloc.x + alloc.width - p0.x; |
1792 | - if (firstIsDot && p0ToMarginWidth > 0) { |
1793 | - p0.x++; |
1794 | - p0ToMarginWidth--; |
1795 | - } |
1796 | - g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height); |
1797 | - if ((p0.y + p0.height) != p1.y) { |
1798 | - g.fillRect(alloc.x, p0.y + p0.height, alloc.width, p1.y |
1799 | - - (p0.y + p0.height)); |
1800 | - } |
1801 | - if (secondIsDot && p1.x > alloc.x) { |
1802 | - p1.x--; |
1803 | - } |
1804 | - g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height); |
1805 | - } |
1806 | - } catch (BadLocationException e) { |
1807 | - // can't render |
1808 | - } |
1809 | - } |
1810 | - |
1811 | - |
1812 | - // --- LayerPainter methods ---------------------------- |
1813 | - /** |
1814 | - * Paints a portion of a highlight. |
1815 | - * |
1816 | - * @param g the graphics context |
1817 | - * @param offs0 the starting model offset >= 0 |
1818 | - * @param offs1 the ending model offset >= offs1 |
1819 | - * @param bounds the bounding box of the view, which is not |
1820 | - * necessarily the region to paint. |
1821 | - * @param c the editor |
1822 | - * @param view View painting for |
1823 | - * @return region drawing occured in |
1824 | - */ |
1825 | - public Shape paintLayer(Graphics g, int offs0, int offs1, Shape bounds, |
1826 | - JTextComponent c, View view) { |
1827 | - Color color = getColor(); |
1828 | - |
1829 | - if (color == null) { |
1830 | - g.setColor(c.getSelectionColor()); |
1831 | - } else { |
1832 | - g.setColor(color); |
1833 | - } |
1834 | - boolean firstIsDot = false; |
1835 | - boolean secondIsDot = false; |
1836 | - if (c.isEditable()) { |
1837 | - int dot = c.getCaretPosition(); |
1838 | - firstIsDot = (offs0 == dot); |
1839 | - secondIsDot = (offs1 == dot); |
1840 | - } |
1841 | - if (offs0 == view.getStartOffset() && offs1 == view.getEndOffset()) { |
1842 | - // Contained in view, can just use bounds. |
1843 | - Rectangle alloc; |
1844 | - if (bounds instanceof Rectangle) { |
1845 | - alloc = (Rectangle) bounds; |
1846 | - } else { |
1847 | - alloc = bounds.getBounds(); |
1848 | - } |
1849 | - if (firstIsDot && alloc.width > 0) { |
1850 | - g.fillRect(alloc.x + 1, alloc.y, alloc.width - 1, |
1851 | - alloc.height); |
1852 | - } else if (secondIsDot && alloc.width > 0) { |
1853 | - g.fillRect(alloc.x, alloc.y, alloc.width - 1, alloc.height); |
1854 | - } else { |
1855 | - g.fillRect(alloc.x, alloc.y, alloc.width, alloc.height); |
1856 | - } |
1857 | - return alloc; |
1858 | - } else { |
1859 | - // Should only render part of View. |
1860 | - try { |
1861 | - // --- determine locations --- |
1862 | - Shape shape = view.modelToView(offs0, |
1863 | - Position.Bias.Forward, offs1, |
1864 | - Position.Bias.Backward, bounds); |
1865 | - Rectangle r = (shape instanceof Rectangle) |
1866 | - ? (Rectangle) shape |
1867 | - : shape.getBounds(); |
1868 | - if (firstIsDot && r.width > 0) { |
1869 | - g.fillRect(r.x + 1, r.y, r.width - 1, r.height); |
1870 | - } else if (secondIsDot && r.width > 0) { |
1871 | - g.fillRect(r.x, r.y, r.width - 1, r.height); |
1872 | - } else { |
1873 | - g.fillRect(r.x, r.y, r.width, r.height); |
1874 | - } |
1875 | - return r; |
1876 | - } catch (BadLocationException e) { |
1877 | - // can't render |
1878 | - } |
1879 | - } |
1880 | - // Only if exception |
1881 | - return null; |
1882 | - } |
1883 | - |
1884 | - } |
1885 | - |
1886 | -} |
1887 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsFormattedTextFieldUI.java |
1888 | +++ /dev/null |
1889 | @@ -1,68 +0,0 @@ |
1890 | -/* |
1891 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
1892 | - * |
1893 | - * Redistribution and use in source and binary forms, with or without |
1894 | - * modification, are permitted provided that the following conditions are met: |
1895 | - * |
1896 | - * o Redistributions of source code must retain the above copyright notice, |
1897 | - * this list of conditions and the following disclaimer. |
1898 | - * |
1899 | - * o Redistributions in binary form must reproduce the above copyright notice, |
1900 | - * this list of conditions and the following disclaimer in the documentation |
1901 | - * and/or other materials provided with the distribution. |
1902 | - * |
1903 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
1904 | - * its contributors may be used to endorse or promote products derived |
1905 | - * from this software without specific prior written permission. |
1906 | - * |
1907 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
1908 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
1909 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
1910 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
1911 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
1912 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
1913 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
1914 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
1915 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
1916 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
1917 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1918 | - */ |
1919 | - |
1920 | -package com.jgoodies.looks.windows; |
1921 | - |
1922 | -import javax.swing.JComponent; |
1923 | -import javax.swing.plaf.ComponentUI; |
1924 | -import javax.swing.plaf.basic.BasicFormattedTextFieldUI; |
1925 | -import javax.swing.text.Caret; |
1926 | - |
1927 | -/** |
1928 | - * The JGoodies Windows L&F implementation of <code>FormattedTextFieldUI</code>. |
1929 | - * It uses a caret that selects all text if the field gains focus |
1930 | - * after a keyboard focus traversal. |
1931 | - * |
1932 | - * @author Karsten Lentzsch |
1933 | - * @version $Revision: 1.2 $ |
1934 | - */ |
1935 | -public final class WindowsFormattedTextFieldUI extends BasicFormattedTextFieldUI { |
1936 | - |
1937 | - /** |
1938 | - * Creates a UI for a JFormattedTextField. |
1939 | - * |
1940 | - * @param c the formatted text field |
1941 | - * @return the UI |
1942 | - */ |
1943 | - public static ComponentUI createUI(JComponent c) { |
1944 | - return new WindowsFormattedTextFieldUI(); |
1945 | - } |
1946 | - |
1947 | - |
1948 | - /** |
1949 | - * Creates the caret for a field. |
1950 | - * |
1951 | - * @return the caret |
1952 | - */ |
1953 | - protected Caret createCaret() { |
1954 | - return new WindowsFieldCaret(); |
1955 | - } |
1956 | - |
1957 | -} |
1958 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsIconFactory.java |
1959 | +++ /dev/null |
1960 | @@ -1,219 +0,0 @@ |
1961 | -/* |
1962 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
1963 | - * |
1964 | - * Redistribution and use in source and binary forms, with or without |
1965 | - * modification, are permitted provided that the following conditions are met: |
1966 | - * |
1967 | - * o Redistributions of source code must retain the above copyright notice, |
1968 | - * this list of conditions and the following disclaimer. |
1969 | - * |
1970 | - * o Redistributions in binary form must reproduce the above copyright notice, |
1971 | - * this list of conditions and the following disclaimer in the documentation |
1972 | - * and/or other materials provided with the distribution. |
1973 | - * |
1974 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
1975 | - * its contributors may be used to endorse or promote products derived |
1976 | - * from this software without specific prior written permission. |
1977 | - * |
1978 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
1979 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
1980 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
1981 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
1982 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
1983 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
1984 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
1985 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
1986 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
1987 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
1988 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1989 | - */ |
1990 | - |
1991 | -package com.jgoodies.looks.windows; |
1992 | - |
1993 | -import java.awt.Component; |
1994 | -import java.awt.Graphics; |
1995 | -import java.io.Serializable; |
1996 | - |
1997 | -import javax.swing.AbstractButton; |
1998 | -import javax.swing.ButtonModel; |
1999 | -import javax.swing.Icon; |
2000 | -import javax.swing.JCheckBox; |
2001 | -import javax.swing.UIManager; |
2002 | -import javax.swing.plaf.UIResource; |
2003 | - |
2004 | -/** |
2005 | - * Factory class that vends <code>Icon</code>s used in the JGoodies Windows look&feel. |
2006 | - * |
2007 | - * @author Karsten Lentzsch |
2008 | - * @version $Revision: 1.3 $ |
2009 | - */ |
2010 | -final class WindowsIconFactory { |
2011 | - |
2012 | - private WindowsIconFactory() { |
2013 | - // Overrides default constructor; prevents instantiation. |
2014 | - } |
2015 | - |
2016 | - // Accessing and Creating Icons ***************************************************** |
2017 | - |
2018 | - private static Icon checkBoxIcon; |
2019 | - private static Icon radioButtonIcon; |
2020 | - |
2021 | - |
2022 | - /** |
2023 | - * Returns an <code>Icon</code> for a <code>JCheckBox</code>. |
2024 | - */ |
2025 | - static Icon getCheckBoxIcon() { |
2026 | - if (checkBoxIcon == null) { |
2027 | - checkBoxIcon = new CheckBoxIcon(); |
2028 | - } |
2029 | - return checkBoxIcon; |
2030 | - } |
2031 | - |
2032 | - |
2033 | - /** |
2034 | - * Returns an <code>Icon</code> for a <code>JCheckBox</code>. |
2035 | - */ |
2036 | - static Icon getRadioButtonIcon() { |
2037 | - if (radioButtonIcon == null) { |
2038 | - radioButtonIcon = new RadioButtonIcon(); |
2039 | - } |
2040 | - return radioButtonIcon; |
2041 | - } |
2042 | - |
2043 | - |
2044 | - // Helper Classes ******************************************************************* |
2045 | - |
2046 | - // Paints the icon for a check box. |
2047 | - private static class CheckBoxIcon implements Icon, Serializable { |
2048 | - |
2049 | - private static final int SIZE = 13; |
2050 | - |
2051 | - public void paintIcon(Component c, Graphics g, int x, int y) { |
2052 | - JCheckBox cb = (JCheckBox) c; |
2053 | - ButtonModel model = cb.getModel(); |
2054 | - |
2055 | - // outer bevel |
2056 | - if (!cb.isBorderPaintedFlat()) { |
2057 | - // Outer top/left |
2058 | - g.setColor(UIManager.getColor("CheckBox.shadow")); |
2059 | - g.drawLine(x, y, x+11, y); |
2060 | - g.drawLine(x, y+1, x, y+11); |
2061 | - |
2062 | - // Outer bottom/right |
2063 | - g.setColor(UIManager.getColor("CheckBox.highlight")); |
2064 | - g.drawLine(x+12, y, x+12, y+12); |
2065 | - g.drawLine(x, y+12, x+11, y+12); |
2066 | - |
2067 | - // Inner top.left |
2068 | - g.setColor(UIManager.getColor("CheckBox.darkShadow")); |
2069 | - g.drawLine(x+1, y+1, x+10, y+1); |
2070 | - g.drawLine(x+1, y+2, x+1, y+10); |
2071 | - |
2072 | - // Inner bottom/right |
2073 | - g.setColor(UIManager.getColor("CheckBox.light")); |
2074 | - g.drawLine(x+1, y+11, x+11, y+11); |
2075 | - g.drawLine(x+11, y+1, x+11, y+10); |
2076 | - } else { |
2077 | - g.setColor(UIManager.getColor("CheckBox.shadow")); |
2078 | - g.drawRect(x+1, y+1, SIZE-3, SIZE-3); |
2079 | - } |
2080 | - // inside box |
2081 | - g.setColor(UIManager.getColor( |
2082 | - (model.isPressed() && model.isArmed()) || !model.isEnabled() |
2083 | - ? "CheckBox.background" |
2084 | - : "CheckBox.interiorBackground")); |
2085 | - g.fillRect(x+2, y+2, SIZE-4, SIZE-4); |
2086 | - |
2087 | - g.setColor(UIManager.getColor(model.isEnabled() |
2088 | - ? "CheckBox.checkColor" // Modified by JGoodies |
2089 | - : "CheckBox.shadow")); |
2090 | - |
2091 | - // paint check |
2092 | - if (model.isSelected()) { |
2093 | - g.drawLine(x+9, y+3, x+9, y+3); |
2094 | - g.drawLine(x+8, y+4, x+9, y+4); |
2095 | - g.drawLine(x+7, y+5, x+9, y+5); |
2096 | - g.drawLine(x+6, y+6, x+8, y+6); |
2097 | - g.drawLine(x+3, y+7, x+7, y+7); |
2098 | - g.drawLine(x+4, y+8, x+6, y+8); |
2099 | - g.drawLine(x+5, y+9, x+5, y+9); |
2100 | - g.drawLine(x+3, y+5, x+3, y+5); |
2101 | - g.drawLine(x+3, y+6, x+4, y+6); |
2102 | - } |
2103 | - } |
2104 | - |
2105 | - public int getIconWidth() { return SIZE; } |
2106 | - public int getIconHeight() { return SIZE; } |
2107 | - } |
2108 | - |
2109 | - |
2110 | - // Paints the icon for a radio button. |
2111 | - private static class RadioButtonIcon implements Icon, UIResource, Serializable { |
2112 | - |
2113 | - private static final int SIZE = 13; |
2114 | - |
2115 | - public void paintIcon(Component c, Graphics g, int x, int y) { |
2116 | - AbstractButton b = (AbstractButton) c; |
2117 | - ButtonModel model = b.getModel(); |
2118 | - |
2119 | - // fill interior |
2120 | - g.setColor(UIManager.getColor( |
2121 | - (model.isPressed() && model.isArmed()) || !model.isEnabled() |
2122 | - ? "RadioButton.background" |
2123 | - : "RadioButton.interiorBackground")); |
2124 | - g.fillRect(x+2, y+2, 8, 8); |
2125 | - |
2126 | - |
2127 | - // outter left arc |
2128 | - g.setColor(UIManager.getColor("RadioButton.shadow")); |
2129 | - g.drawLine(x+4, y+0, x+7, y+0); |
2130 | - g.drawLine(x+2, y+1, x+3, y+1); |
2131 | - g.drawLine(x+8, y+1, x+9, y+1); |
2132 | - g.drawLine(x+1, y+2, x+1, y+3); |
2133 | - g.drawLine(x+0, y+4, x+0, y+7); |
2134 | - g.drawLine(x+1, y+8, x+1, y+9); |
2135 | - |
2136 | - // outter right arc |
2137 | - g.setColor(UIManager.getColor("RadioButton.highlight")); |
2138 | - g.drawLine(x+2, y+10, x+3, y+10); |
2139 | - g.drawLine(x+4, y+11, x+7, y+11); |
2140 | - g.drawLine(x+8, y+10, x+9, y+10); |
2141 | - g.drawLine(x+10, y+9, x+10, y+8); |
2142 | - g.drawLine(x+11, y+7, x+11, y+4); |
2143 | - g.drawLine(x+10, y+3, x+10, y+2); |
2144 | - |
2145 | - |
2146 | - // inner left arc |
2147 | - g.setColor(UIManager.getColor("RadioButton.darkShadow")); |
2148 | - g.drawLine(x+4, y+1, x+7, y+1); |
2149 | - g.drawLine(x+2, y+2, x+3, y+2); |
2150 | - g.drawLine(x+8, y+2, x+9, y+2); |
2151 | - g.drawLine(x+2, y+3, x+2, y+3); |
2152 | - g.drawLine(x+1, y+4, x+1, y+7); |
2153 | - g.drawLine(x+2, y+8, x+2, y+8); |
2154 | - |
2155 | - |
2156 | - // inner right arc |
2157 | - g.setColor(UIManager.getColor("RadioButton.light")); |
2158 | - g.drawLine(x+2, y+9, x+3, y+9); |
2159 | - g.drawLine(x+4, y+10, x+7, y+10); |
2160 | - g.drawLine(x+8, y+9, x+9, y+9); |
2161 | - g.drawLine(x+9, y+8, x+9, y+8); |
2162 | - g.drawLine(x+10, y+7, x+10, y+4); |
2163 | - g.drawLine(x+9, y+3, x+9, y+3); |
2164 | - |
2165 | - |
2166 | - // indicate whether selected or not |
2167 | - if(model.isSelected()) { |
2168 | - g.setColor(UIManager.getColor("RadioButton.checkColor")); // Modified by JGoodies |
2169 | - g.fillRect(x+4, y+5, 4, 2); |
2170 | - g.fillRect(x+5, y+4, 2, 4); |
2171 | - } |
2172 | - } |
2173 | - |
2174 | - public int getIconWidth() { return SIZE; } |
2175 | - public int getIconHeight() { return SIZE; } |
2176 | - |
2177 | - } |
2178 | - |
2179 | -} |
2180 | \ No newline at end of file |
2181 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsLookAndFeel.java |
2182 | +++ /dev/null |
2183 | @@ -1,760 +0,0 @@ |
2184 | -/* |
2185 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
2186 | - * |
2187 | - * Redistribution and use in source and binary forms, with or without |
2188 | - * modification, are permitted provided that the following conditions are met: |
2189 | - * |
2190 | - * o Redistributions of source code must retain the above copyright notice, |
2191 | - * this list of conditions and the following disclaimer. |
2192 | - * |
2193 | - * o Redistributions in binary form must reproduce the above copyright notice, |
2194 | - * this list of conditions and the following disclaimer in the documentation |
2195 | - * and/or other materials provided with the distribution. |
2196 | - * |
2197 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
2198 | - * its contributors may be used to endorse or promote products derived |
2199 | - * from this software without specific prior written permission. |
2200 | - * |
2201 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
2202 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
2203 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
2204 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
2205 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
2206 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
2207 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
2208 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
2209 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
2210 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
2211 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2212 | - */ |
2213 | - |
2214 | -package com.jgoodies.looks.windows; |
2215 | - |
2216 | -import java.awt.Color; |
2217 | -import java.awt.Font; |
2218 | -import java.awt.Insets; |
2219 | -import java.lang.reflect.Method; |
2220 | - |
2221 | -import javax.swing.Icon; |
2222 | -import javax.swing.JComponent; |
2223 | -import javax.swing.UIDefaults; |
2224 | -import javax.swing.UIManager; |
2225 | -import javax.swing.border.Border; |
2226 | -import javax.swing.border.EmptyBorder; |
2227 | -import javax.swing.plaf.DimensionUIResource; |
2228 | -import javax.swing.plaf.IconUIResource; |
2229 | -import javax.swing.plaf.InsetsUIResource; |
2230 | -import javax.swing.plaf.basic.BasicBorders; |
2231 | - |
2232 | -import com.jgoodies.looks.*; |
2233 | -import com.jgoodies.looks.common.MinimumSizedIcon; |
2234 | -import com.jgoodies.looks.common.RGBGrayFilter; |
2235 | -import com.jgoodies.looks.common.ShadowPopupFactory; |
2236 | - |
2237 | -/** |
2238 | - * The main class of the JGoodies Windows Look&Feel. |
2239 | - * This look provides several corrections and extensions to Sun's Windows L&F. |
2240 | - * In addition it tries to provide a unified look for the J2SE 1.4.0x, 1.4.1x, |
2241 | - * 1.4.2, and 1.5 environments. |
2242 | - * |
2243 | - * @author Karsten Lentzsch |
2244 | - * @version $Revision: 1.36 $ |
2245 | - */ |
2246 | -public final class WindowsLookAndFeel extends com.sun.java.swing.plaf.windows.WindowsLookAndFeel { |
2247 | - |
2248 | - /** |
2249 | - * An optional client property key for JMenu and JToolBar |
2250 | - * to set a border style - shadows the header style. |
2251 | - */ |
2252 | - public static final String BORDER_STYLE_KEY = "jgoodies.windows.borderStyle"; |
2253 | - |
2254 | - |
2255 | - public String getID() { |
2256 | - return "JGoodies Windows"; |
2257 | - } |
2258 | - |
2259 | - |
2260 | - public String getName() { |
2261 | - return "JGoodies Windows"; |
2262 | - } |
2263 | - |
2264 | - |
2265 | - public String getDescription() { |
2266 | - return "The JGoodies Windows Look and Feel" |
2267 | - + " - \u00a9 2001-2007 JGoodies Karsten Lentzsch"; |
2268 | - } |
2269 | - |
2270 | - |
2271 | - // Optional Settings ****************************************************** |
2272 | - |
2273 | - /** |
2274 | - * Looks up and retrieves the FontPolicy used by |
2275 | - * the JGoodies Windows Look&Feel. |
2276 | - * If a FontPolicy has been set for this look, it'll be returned. |
2277 | - * Otherwise, this method checks if a FontPolicy or FontSet is defined |
2278 | - * in the system properties or UIDefaults. If so, it is returned. |
2279 | - * If no FontPolicy has been set for this look, in the system |
2280 | - * properties or UIDefaults, the default Windows font policy |
2281 | - * will be returned. |
2282 | - * |
2283 | - * @return the FontPolicy set for this Look&feel - if any, |
2284 | - * the FontPolicy specified in the system properties or UIDefaults |
2285 | - * - if any, or the default Windows font policy. |
2286 | - * |
2287 | - * @see #setFontPolicy |
2288 | - * @see Options#WINDOWS_FONT_POLICY_KEY |
2289 | - * @see FontPolicies |
2290 | - * @see FontPolicies#customSettingsPolicy(FontPolicy) |
2291 | - * @see FontPolicies#getDefaultWindowsPolicy() |
2292 | - */ |
2293 | - public static FontPolicy getFontPolicy() { |
2294 | - FontPolicy policy = |
2295 | - (FontPolicy) UIManager.get(Options.WINDOWS_FONT_POLICY_KEY); |
2296 | - if (policy != null) |
2297 | - return policy; |
2298 | - |
2299 | - FontPolicy defaultPolicy = FontPolicies.getDefaultWindowsPolicy(); |
2300 | - return FontPolicies.customSettingsPolicy(defaultPolicy); |
2301 | - } |
2302 | - |
2303 | - |
2304 | - /** |
2305 | - * Sets the FontPolicy to be used with the JGoodies Windows L&F. |
2306 | - * If the specified policy is <code>null</code>, the default will be reset. |
2307 | - * |
2308 | - * @param fontPolicy the FontPolicy to be used with the JGoodies Windows |
2309 | - * L&F, or <code>null</code> to reset to the default |
2310 | - * |
2311 | - * @see #getFontPolicy() |
2312 | - * @see Options#WINDOWS_FONT_POLICY_KEY |
2313 | - */ |
2314 | - public static void setFontPolicy(FontPolicy fontPolicy) { |
2315 | - UIManager.put(Options.WINDOWS_FONT_POLICY_KEY, fontPolicy); |
2316 | - } |
2317 | - |
2318 | - |
2319 | - /** |
2320 | - * Looks up and retrieves the MicroLayoutPolicy used by |
2321 | - * the JGoodies Windows Look&Feel. |
2322 | - * If a MicroLayoutPolicy has been set for this look, it'll be returned. |
2323 | - * Otherwise, the default Windows micro layout policy will be returned. |
2324 | - * |
2325 | - * @return the MicroLayoutPolicy set for this Look&feel - if any, |
2326 | - * or the default Windows MicroLayoutPolicy. |
2327 | - * |
2328 | - * @see #setMicroLayoutPolicy |
2329 | - * @see Options#WINDOWS_MICRO_LAYOUT_POLICY_KEY |
2330 | - * @see MicroLayoutPolicies |
2331 | - * @see MicroLayoutPolicies#getDefaultWindowsPolicy() |
2332 | - */ |
2333 | - public static MicroLayoutPolicy getMicroLayoutPolicy() { |
2334 | - MicroLayoutPolicy policy = |
2335 | - (MicroLayoutPolicy) UIManager.get(Options.WINDOWS_MICRO_LAYOUT_POLICY_KEY); |
2336 | - return policy != null |
2337 | - ? policy |
2338 | - : MicroLayoutPolicies.getDefaultWindowsPolicy(); |
2339 | - } |
2340 | - |
2341 | - |
2342 | - /** |
2343 | - * Sets the MicroLayoutPolicy to be used with the JGoodies Windows L&F. |
2344 | - * If the specified policy is <code>null</code>, the default will be reset. |
2345 | - * |
2346 | - * @param microLayoutPolicy the MicroLayoutPolicy to be used with |
2347 | - * the JGoodies Windows L&F, or <code>null</code> to reset |
2348 | - * to the default |
2349 | - * |
2350 | - * @see #getMicroLayoutPolicy() |
2351 | - * @see Options#WINDOWS_MICRO_LAYOUT_POLICY_KEY |
2352 | - */ |
2353 | - public static void setMicroLayoutPolicy(MicroLayout microLayoutPolicy) { |
2354 | - UIManager.put(Options.WINDOWS_MICRO_LAYOUT_POLICY_KEY, microLayoutPolicy); |
2355 | - } |
2356 | - |
2357 | - |
2358 | - // Overriding Superclass Behavior *************************************** |
2359 | - |
2360 | - /** |
2361 | - * Invoked during <code>UIManager#setLookAndFeel</code>. In addition |
2362 | - * to the superclass behavior, we install the ShadowPopupFactory. |
2363 | - * |
2364 | - * @see #uninitialize |
2365 | - */ |
2366 | - public void initialize() { |
2367 | - super.initialize(); |
2368 | - ShadowPopupFactory.install(); |
2369 | - } |
2370 | - |
2371 | - |
2372 | - /** |
2373 | - * Invoked during <code>UIManager#setLookAndFeel</code>. In addition |
2374 | - * to the superclass behavior, we uninstall the ShadowPopupFactory. |
2375 | - * |
2376 | - * @see #initialize |
2377 | - */ |
2378 | - public void uninitialize() { |
2379 | - super.uninitialize(); |
2380 | - ShadowPopupFactory.uninstall(); |
2381 | - } |
2382 | - |
2383 | - |
2384 | - /** |
2385 | - * Returns an icon with a disabled appearance. This method is used |
2386 | - * to generate a disabled icon when one has not been specified.<p> |
2387 | - * |
2388 | - * This method will be used only on JDK 5.0 and later. |
2389 | - * |
2390 | - * @param component the component that will display the icon, may be null. |
2391 | - * @param icon the icon to generate disabled icon from. |
2392 | - * @return disabled icon, or null if a suitable icon can not be generated. |
2393 | - */ |
2394 | - public Icon getDisabledIcon(JComponent component, Icon icon) { |
2395 | - Icon disabledIcon = RGBGrayFilter.getDisabledIcon(component, icon); |
2396 | - return disabledIcon != null |
2397 | - ? new IconUIResource(disabledIcon) |
2398 | - : null; |
2399 | - } |
2400 | - |
2401 | - |
2402 | - /** |
2403 | - * Initializes the class defaults, that is, overrides some UI delegates |
2404 | - * with JGoodies Windows implementations. |
2405 | - */ |
2406 | - protected void initClassDefaults(UIDefaults table) { |
2407 | - super.initClassDefaults(table); |
2408 | - final String windowsPrefix = "com.jgoodies.looks.windows.Windows"; |
2409 | - final String commonPrefix = "com.jgoodies.looks.common.ExtBasic"; |
2410 | - |
2411 | - // Overwrite some of the uiDefaults. |
2412 | - Object[] uiDefaults = { |
2413 | - // Modified size |
2414 | - "ComboBoxUI", windowsPrefix + "ComboBoxUI", |
2415 | - |
2416 | - // Modified preferred height: can be even or odd |
2417 | - "ButtonUI", windowsPrefix + "ButtonUI", |
2418 | - |
2419 | - // Can installs an optional etched border |
2420 | - "ScrollPaneUI", windowsPrefix + "ScrollPaneUI", |
2421 | - |
2422 | - // Optional style and optional special borders |
2423 | - "MenuBarUI", windowsPrefix + "MenuBarUI", |
2424 | - |
2425 | - // Provides an option for a no margin border |
2426 | - "PopupMenuUI", windowsPrefix + "PopupMenuUI", |
2427 | - |
2428 | - // Honors the screen resolution and uses a minimum button width |
2429 | - "OptionPaneUI", windowsPrefix + "OptionPaneUI", |
2430 | - |
2431 | - // 1.4.1 has ugly one touch triangles |
2432 | - "SplitPaneUI", windowsPrefix + "SplitPaneUI", |
2433 | - |
2434 | - // Work in progress: Can have a flat presentation |
2435 | - "TabbedPaneUI", windowsPrefix + "TabbedPaneUI", |
2436 | - |
2437 | - // Selects text after focus gained via keyboard |
2438 | - "TextFieldUI", windowsPrefix + "TextFieldUI", |
2439 | - "FormattedTextFieldUI", windowsPrefix + "FormattedTextFieldUI", |
2440 | - |
2441 | - // Selects text after focus gained via keyboard |
2442 | - // Renders a dot, not the star ("*") character on Java 1.4 and 5 |
2443 | - "PasswordFieldUI", windowsPrefix + "PasswordFieldUI", |
2444 | - |
2445 | - |
2446 | - // Updates the disabled and inactive background |
2447 | - "TextAreaUI", windowsPrefix + "TextAreaUI", |
2448 | - |
2449 | - // Corrected position of the tree button icon |
2450 | - "TreeUI", windowsPrefix + "TreeUI", |
2451 | - |
2452 | - // Just to use shared UI delegate |
2453 | - "SeparatorUI", windowsPrefix + "SeparatorUI"}; |
2454 | - |
2455 | - if (LookUtils.IS_JAVA_1_4_2_OR_LATER) { |
2456 | - // Modified Border |
2457 | - uiDefaults = append(uiDefaults, |
2458 | - "SpinnerUI", windowsPrefix + "SpinnerUI"); |
2459 | - } |
2460 | - |
2461 | - // Aligned menu items |
2462 | - if ( !LookUtils.IS_JAVA_6_OR_LATER |
2463 | - || !LookUtils.IS_OS_WINDOWS_VISTA |
2464 | - || !LookUtils.IS_LAF_WINDOWS_XP_ENABLED) { |
2465 | - uiDefaults = append(uiDefaults, |
2466 | - "MenuItemUI", windowsPrefix + "MenuItemUI"); |
2467 | - uiDefaults = append(uiDefaults, |
2468 | - "CheckBoxMenuItemUI", commonPrefix + "CheckBoxMenuItemUI"); |
2469 | - uiDefaults = append(uiDefaults, |
2470 | - "RadioButtonMenuItemUI", commonPrefix + "RadioButtonMenuItemUI"); |
2471 | - // Has padding above and below the separator lines |
2472 | - uiDefaults = append(uiDefaults, |
2473 | - "PopupMenuSeparatorUI", commonPrefix + "PopupMenuSeparatorUI"); |
2474 | - } |
2475 | - |
2476 | - if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED) { |
2477 | - // Aligned menu items |
2478 | - if (!LookUtils.IS_JAVA_6_OR_LATER || !LookUtils.IS_OS_WINDOWS_VISTA) { |
2479 | - uiDefaults = append(uiDefaults, |
2480 | - "MenuUI", windowsPrefix + "XPMenuUI"); |
2481 | - } |
2482 | - |
2483 | - // Optional style and optional special borders; |
2484 | - // rollover borders for compound buttons |
2485 | - uiDefaults = append(uiDefaults, |
2486 | - "ToolBarUI", windowsPrefix + "XPToolBarUI"); |
2487 | - |
2488 | - // Honors XP table header style for custom user renderers. |
2489 | - uiDefaults = append(uiDefaults, |
2490 | - "TableHeaderUI", windowsPrefix + "XPTableHeaderUI"); |
2491 | - } else { |
2492 | - // Aligned menu items |
2493 | - uiDefaults = append(uiDefaults, |
2494 | - "MenuUI", commonPrefix + "MenuUI"); |
2495 | - |
2496 | - // Optional style and optional special borders; |
2497 | - // rollover borders corrected |
2498 | - uiDefaults = append(uiDefaults, |
2499 | - "ToolBarUI", windowsPrefix + "ToolBarUI"); |
2500 | - |
2501 | - // Black arrows |
2502 | - uiDefaults = append(uiDefaults, |
2503 | - "ScrollBarUI", windowsPrefix + "ScrollBarUI"); |
2504 | - |
2505 | - if (!LookUtils.IS_JAVA_1_4_2_OR_LATER) { |
2506 | - // Uses unmodified size specified by "ToolBar.separatorSize" |
2507 | - uiDefaults = append(uiDefaults, |
2508 | - "ToolBarSeparatorUI", windowsPrefix + "ToolBarSeparatorUI"); |
2509 | - } |
2510 | - } |
2511 | - table.putDefaults(uiDefaults); |
2512 | - } |
2513 | - |
2514 | - /** |
2515 | - * Initializes the component defaults. |
2516 | - */ |
2517 | - protected void initComponentDefaults(UIDefaults table) { |
2518 | - super.initComponentDefaults(table); |
2519 | - |
2520 | - final boolean isXP = LookUtils.IS_LAF_WINDOWS_XP_ENABLED; |
2521 | - final boolean isClassic = !isXP; |
2522 | - final boolean isVista = LookUtils.IS_OS_WINDOWS_VISTA; |
2523 | - |
2524 | - initFontDefaults(table); |
2525 | - |
2526 | - if (isClassic) { |
2527 | - initComponentDefaultsClassic(table); |
2528 | - } |
2529 | - if (isXP && LookUtils.IS_JAVA_1_4) { |
2530 | - initComponentDefaultsXP14(table); |
2531 | - } |
2532 | - |
2533 | - MicroLayout microLayout = getMicroLayoutPolicy().getMicroLayout("Windows", table); |
2534 | - if (!isVista || !LookUtils.IS_JAVA_6_OR_LATER || !LookUtils.IS_LAF_WINDOWS_XP_ENABLED) { |
2535 | - initMenuItemDefaults(table, microLayout); |
2536 | - } |
2537 | - |
2538 | - Object marginBorder = new BasicBorders.MarginBorder(); |
2539 | - Object checkBoxMargin = microLayout.getCheckBoxMargin(); |
2540 | - |
2541 | - Object etchedBorder = new UIDefaults.ProxyLazyValue( |
2542 | - "javax.swing.plaf.BorderUIResource", |
2543 | - "getEtchedBorderUIResource"); |
2544 | - Object buttonBorder = new SimpleProxyLazyValue( |
2545 | - "com.jgoodies.looks.windows.WindowsLookAndFeel", |
2546 | - "getButtonBorder"); |
2547 | - |
2548 | - Object menuBorder = isXP |
2549 | - ? WindowsBorders.getXPMenuBorder() |
2550 | - : WindowsBorders.getMenuBorder(); |
2551 | - |
2552 | - Object menuBarEmptyBorder = marginBorder; |
2553 | - Object menuBarSeparatorBorder = WindowsBorders.getSeparatorBorder(); |
2554 | - Object menuBarEtchedBorder = WindowsBorders.getEtchedBorder(); |
2555 | - Object menuBarHeaderBorder = WindowsBorders.getMenuBarHeaderBorder(); |
2556 | - |
2557 | - Object toolBarEmptyBorder = marginBorder; |
2558 | - Object toolBarSeparatorBorder = WindowsBorders.getSeparatorBorder(); |
2559 | - Object toolBarEtchedBorder = WindowsBorders.getEtchedBorder(); |
2560 | - Object toolBarHeaderBorder = WindowsBorders.getToolBarHeaderBorder(); |
2561 | - |
2562 | - Object buttonMargin = microLayout.getButtonMargin(); |
2563 | - |
2564 | - Object toolBarSeparatorSize = LookUtils.IS_JAVA_1_4_2_OR_LATER |
2565 | - ? null |
2566 | - : new DimensionUIResource(6, Options.getDefaultIconSize().height); |
2567 | - |
2568 | - Object textInsets = microLayout.getTextInsets(); |
2569 | - Object wrappedTextInsets = microLayout.getWrappedTextInsets(); |
2570 | - Insets comboEditorInsets = microLayout.getComboBoxEditorInsets(); |
2571 | - |
2572 | - int comboBorderSize = microLayout.getComboBorderSize(); |
2573 | - int comboPopupBorderSize = microLayout.getComboPopupBorderSize(); |
2574 | - int comboRendererGap = comboEditorInsets.left + comboBorderSize - comboPopupBorderSize; |
2575 | - Object comboRendererBorder = new EmptyBorder(1, comboRendererGap, 1, comboRendererGap); |
2576 | - Object comboTableEditorInsets = new Insets(0, 0, 0, 0); |
2577 | - |
2578 | - Object popupMenuSeparatorMargin = microLayout.getPopupMenuSeparatorMargin(); |
2579 | - |
2580 | - // Should be active. |
2581 | - int treeFontSize = table.getFont("Tree.font").getSize(); |
2582 | - Integer rowHeight = new Integer(treeFontSize + 6); |
2583 | - |
2584 | - Class superclass = getClass().getSuperclass(); |
2585 | - Color controlColor = table.getColor("control"); |
2586 | - Object disabledTextBackground = table.getColor("TextField.disabledBackground"); |
2587 | - Object inactiveTextBackground = table.getColor("TextField.inactiveBackground"); |
2588 | - |
2589 | - Object comboBoxDisabledBackground = (isVista && isXP) |
2590 | - ? table.getColor("ComboBox.background") |
2591 | - : disabledTextBackground; |
2592 | - |
2593 | - Object menuBarBackground = isXP |
2594 | - ? table.get("control") |
2595 | - : table.get("menu"); |
2596 | - Object menuSelectionBackground = isXP |
2597 | - ? table.get("MenuItem.selectionBackground") |
2598 | - : table.get("Menu.background"); |
2599 | - Object menuSelectionForeground = isXP |
2600 | - ? table.get("MenuItem.selectionForeground") |
2601 | - : table.get("Menu.foreground"); |
2602 | - |
2603 | - Character passwordEchoChar = new Character(isXP ? '\u25CF' : '*'); |
2604 | - |
2605 | - Object[] defaults = { |
2606 | - "Button.border", buttonBorder, |
2607 | - "Button.margin", buttonMargin, // Sun's 14px margin is too wide |
2608 | - |
2609 | - // 1.4.2 uses a 2 pixel non-standard border that leads to bad |
2610 | - // alignment in the typical case that the border is not painted |
2611 | - "CheckBox.border", marginBorder, |
2612 | - "CheckBox.margin", checkBoxMargin, |
2613 | - |
2614 | - "ComboBox.disabledBackground", comboBoxDisabledBackground, |
2615 | - "ComboBox.editorBorder", marginBorder, |
2616 | - "ComboBox.editorColumns", new Integer(5), |
2617 | - "ComboBox.editorInsets", comboEditorInsets, // Added by JGoodies |
2618 | - "ComboBox.tableEditorInsets", comboTableEditorInsets, |
2619 | - "ComboBox.rendererBorder", comboRendererBorder, // Added by JGoodies |
2620 | - |
2621 | - "EditorPane.margin", wrappedTextInsets, |
2622 | - |
2623 | - // Begin 1.3 und 1.4.0 |
2624 | - "Menu.border", menuBorder, // Fixed in 1.4.1 |
2625 | - "Menu.borderPainted", Boolean.TRUE, |
2626 | - "Menu.background", menuBarBackground, |
2627 | - "Menu.selectionForeground", menuSelectionForeground, |
2628 | - "Menu.selectionBackground", menuSelectionBackground, |
2629 | - // End 1.3 und 1.4.0 |
2630 | - |
2631 | - "MenuBar.background", menuBarBackground, |
2632 | - "MenuBar.border", menuBarSeparatorBorder, // 1.4.1 Separator wrong |
2633 | - "MenuBar.emptyBorder", menuBarEmptyBorder, // Added by JGoodies |
2634 | - "MenuBar.separatorBorder", menuBarSeparatorBorder, // Added by JGoodies |
2635 | - "MenuBar.etchedBorder", menuBarEtchedBorder, // Added by JGoodies |
2636 | - "MenuBar.headerBorder", menuBarHeaderBorder, // Added by JGoodies |
2637 | - |
2638 | - "FormattedTextField.disabledBackground", disabledTextBackground, // for readonly |
2639 | - "FormattedTextField.inactiveBackground", inactiveTextBackground, // for readonly |
2640 | - "FormattedTextField.margin", textInsets, // Poor in 1.6 |
2641 | - |
2642 | - "PasswordField.margin", textInsets, // Poor in 1.6 |
2643 | - "PasswordField.echoChar", passwordEchoChar, |
2644 | - |
2645 | - "PopupMenu.border", WindowsBorders.getPopupMenuBorder(), |
2646 | - "PopupMenu.noMarginBorder", WindowsBorders.getNoMarginPopupMenuBorder(), |
2647 | - "PopupMenuSeparator.margin", popupMenuSeparatorMargin, |
2648 | - |
2649 | - "ScrollPane.etchedBorder", etchedBorder, // Added by JGoodies |
2650 | - |
2651 | - "Spinner.defaultEditorInsets", textInsets, // Added by JGoodies |
2652 | - |
2653 | - // 1.4.1 uses a 2 pixel non-standard border, that leads to bad |
2654 | - // alignment in the typical case that the border is not painted |
2655 | - "RadioButton.border", marginBorder, |
2656 | - "RadioButton.margin", checkBoxMargin, |
2657 | - |
2658 | - "Table.gridColor", controlColor, // 1.4.1 Bug; active |
2659 | - "TextArea.margin", wrappedTextInsets, // 1.4.1 Bug |
2660 | - "TextArea.disabledBackground", disabledTextBackground, |
2661 | - "TextArea.inactiveBackground", inactiveTextBackground, |
2662 | - "TextField.margin", textInsets, // 1.4.1 Bug |
2663 | - "ToggleButton.margin", buttonMargin, // Sun's 14px margin is too wide |
2664 | - |
2665 | - "ToolBar.emptyBorder", toolBarEmptyBorder, // Added by JGoodies |
2666 | - "ToolBar.separatorBorder", toolBarSeparatorBorder, // Added by JGoodies |
2667 | - "ToolBar.etchedBorder", toolBarEtchedBorder, // Added by JGoodies |
2668 | - "ToolBar.headerBorder", toolBarHeaderBorder, // Added by JGoodies |
2669 | - "ToolBar.separatorSize", toolBarSeparatorSize, |
2670 | - "ToolBar.margin", new InsetsUIResource(0, 10, 0, 0), |
2671 | - |
2672 | - "Tree.selectionBorderColor", controlColor, // 1.4.1 Bug; active |
2673 | - "Tree.rowHeight", rowHeight, // 1.4.1 Bug |
2674 | - }; |
2675 | - if (LookUtils.IS_JAVA_1_4) { |
2676 | - defaults = append(defaults, new Object[] { |
2677 | - "InternalFrame.icon", makeIcon(superclass, "icons/JavaCup.gif"), |
2678 | - "OptionPane.errorIcon", isXP ? makeIcon(getClass(), "icons/xp/Error.png") |
2679 | - : makeIcon(superclass, "icons/Error.gif"), |
2680 | - "OptionPane.informationIcon", isXP ? makeIcon(getClass(), "icons/xp/Inform.png") |
2681 | - : makeIcon(superclass, "icons/Inform.gif"), |
2682 | - "OptionPane.warningIcon", isXP ? makeIcon(getClass(), "icons/xp/Warn.png") |
2683 | - : makeIcon(superclass, "icons/Warn.gif"), |
2684 | - "OptionPane.questionIcon", isXP ? makeIcon(getClass(), "icons/xp/Inform.png") |
2685 | - : makeIcon(superclass, "icons/Question.gif") |
2686 | - }); |
2687 | - } |
2688 | - if (LookUtils.IS_JAVA_1_4 || LookUtils.IS_JAVA_5) { |
2689 | - defaults = append(defaults, new Object[] { |
2690 | - "Tree.openIcon", isXP ? makeIcon(getClass(), "icons/xp/TreeOpen.png") |
2691 | - : makeIcon(getClass(), "icons/TreeOpen.gif"), |
2692 | - "Tree.closedIcon", isXP ? makeIcon(getClass(), "icons/xp/TreeClosed.png") |
2693 | - : makeIcon(getClass(), "icons/TreeClosed.gif") |
2694 | - }); |
2695 | - } |
2696 | - if (LookUtils.IS_JAVA_6_OR_LATER) { |
2697 | - defaults = append(defaults, new Object[] { |
2698 | - "Spinner.border", table.get("TextField.border") |
2699 | - }); |
2700 | - } |
2701 | - table.putDefaults(defaults); |
2702 | - } |
2703 | - |
2704 | - /** |
2705 | - * Initializes component defaults required in classic mode only. |
2706 | - */ |
2707 | - private void initComponentDefaultsClassic(UIDefaults table) { |
2708 | - Object checkBoxIcon = new SimpleProxyLazyValue( |
2709 | - "com.jgoodies.looks.windows.WindowsLookAndFeel", |
2710 | - "getCheckBoxIcon"); |
2711 | - |
2712 | - Object radioButtonIcon = new SimpleProxyLazyValue( |
2713 | - "com.jgoodies.looks.windows.WindowsLookAndFeel", |
2714 | - "getRadioButtonIcon"); |
2715 | - |
2716 | - Border winInsetBorder = new BasicBorders.FieldBorder(table |
2717 | - .getColor("controlShadow"), table |
2718 | - .getColor("controlDkShadow"), |
2719 | - table.getColor("controlHighlight"), table |
2720 | - .getColor("controlLtHighlight")); |
2721 | - |
2722 | - Object[] defaults = { |
2723 | - "CheckBox.checkColor", table.get("controlText"), // kind-of black |
2724 | - "CheckBox.icon", checkBoxIcon, |
2725 | - "RadioButton.checkColor", table.get("controlText"), // kind-of black |
2726 | - "RadioButton.icon", radioButtonIcon, |
2727 | - "Table.scrollPaneBorder", winInsetBorder, // 1.4.1 Bug |
2728 | - |
2729 | - }; |
2730 | - table.putDefaults(defaults); |
2731 | - } |
2732 | - |
2733 | - /** |
2734 | - * Initializes component defaults required in XP mode on Java 1.4.2 only. |
2735 | - */ |
2736 | - private void initComponentDefaultsXP14(UIDefaults table) { |
2737 | - Object[] defaults = { |
2738 | - "TitledBorder.titleColor", table.getColor("activeCaption") |
2739 | - }; |
2740 | - table.putDefaults(defaults); |
2741 | - } |
2742 | - |
2743 | - /** |
2744 | - * Looks up the correct control font and sets it for all controls. |
2745 | - */ |
2746 | - private void initFontDefaults(UIDefaults table) { |
2747 | - FontPolicy fontChoicePolicy = getFontPolicy(); |
2748 | - FontSet fontSet = fontChoicePolicy.getFontSet("Windows", table); |
2749 | - initFontDefaults(table, fontSet); |
2750 | - } |
2751 | - |
2752 | - |
2753 | - private void initMenuItemDefaults(UIDefaults table, MicroLayout microLayout) { |
2754 | - Object menuMargin = microLayout.getMenuMargin(); |
2755 | - Object menuItemMargin = microLayout.getMenuItemMargin(); |
2756 | - Icon menuItemCheckIcon = new MinimumSizedIcon(); |
2757 | - Object[] defaults = { |
2758 | - |
2759 | - "Menu.margin", menuMargin, // 1.4.1 Bug |
2760 | - |
2761 | - "MenuItem.borderPainted", Boolean.TRUE, |
2762 | - "MenuItem.checkIcon", menuItemCheckIcon, // Aligns menu items |
2763 | - "MenuItem.margin", menuItemMargin, // 1.4.1 Bug |
2764 | - "CheckBoxMenuItem.margin", menuItemMargin, // 1.4.1 Bug |
2765 | - "RadioButtonMenuItem.margin", menuItemMargin, // 1.4.1 Bug |
2766 | - }; |
2767 | - table.putDefaults(defaults); |
2768 | - } |
2769 | - |
2770 | - |
2771 | - /** |
2772 | - * Sets Fonts in the given FontSet as defaults for all known |
2773 | - * component types in the given UIDefaults table. |
2774 | - * |
2775 | - * @param table the UIDefaults table used to set fonts |
2776 | - * @param fontSet describes the set of Fonts to be installed |
2777 | - */ |
2778 | - private static void initFontDefaults(UIDefaults table, FontSet fontSet) { |
2779 | - Font controlFont = fontSet.getControlFont(); |
2780 | - Font menuFont = fontSet.getMenuFont(); |
2781 | - Font messageFont = fontSet.getMessageFont(); |
2782 | - Font toolTipFont = fontSet.getSmallFont(); |
2783 | - Font titleFont = fontSet.getTitleFont(); |
2784 | - Font windowFont = fontSet.getWindowTitleFont(); |
2785 | - |
2786 | - Object[] defaults = { |
2787 | - "Button.font", controlFont, |
2788 | - "CheckBox.font", controlFont, |
2789 | - "ColorChooser.font", controlFont, |
2790 | - "ComboBox.font", controlFont, |
2791 | - "EditorPane.font", controlFont, |
2792 | - "FormattedTextField.font", controlFont, |
2793 | - "Label.font", controlFont, |
2794 | - "List.font", controlFont, |
2795 | - "Panel.font", controlFont, |
2796 | - "PasswordField.font", controlFont, |
2797 | - "ProgressBar.font", controlFont, |
2798 | - "RadioButton.font", controlFont, |
2799 | - "ScrollPane.font", controlFont, |
2800 | - "Spinner.font", controlFont, |
2801 | - "TabbedPane.font", controlFont, |
2802 | - "Table.font", controlFont, |
2803 | - "TableHeader.font", controlFont, |
2804 | - "TextArea.font", controlFont, |
2805 | - "TextField.font", controlFont, |
2806 | - "TextPane.font", controlFont, |
2807 | - "ToolBar.font", controlFont, |
2808 | - "ToggleButton.font", controlFont, |
2809 | - "Tree.font", controlFont, |
2810 | - "Viewport.font", controlFont, |
2811 | - |
2812 | - "InternalFrame.titleFont", windowFont, // controlBold |
2813 | - "OptionPane.font", messageFont, |
2814 | - "OptionPane.messageFont", messageFont, |
2815 | - "OptionPane.buttonFont", messageFont, |
2816 | - "TitledBorder.font", titleFont, |
2817 | - "ToolTip.font", toolTipFont, |
2818 | - |
2819 | - "CheckBoxMenuItem.font", menuFont, |
2820 | - "CheckBoxMenuItem.acceleratorFont", menuFont, // 1.3 only ? |
2821 | - "Menu.font", menuFont, |
2822 | - "Menu.acceleratorFont", menuFont, |
2823 | - "MenuBar.font", menuFont, |
2824 | - "MenuItem.font", menuFont, |
2825 | - "MenuItem.acceleratorFont", menuFont, |
2826 | - "PopupMenu.font", menuFont, |
2827 | - "RadioButtonMenuItem.font", menuFont, |
2828 | - "RadioButtonMenuItem.acceleratorFont", menuFont, // 1.3 only ? |
2829 | - }; |
2830 | - table.putDefaults(defaults); |
2831 | - } |
2832 | - |
2833 | - |
2834 | - // Getters for Proxy Access (Referred classes can stay package visible) *** |
2835 | - |
2836 | - public static Border getButtonBorder() { |
2837 | - return WindowsBorders.getButtonBorder(); |
2838 | - } |
2839 | - |
2840 | - public static Icon getCheckBoxIcon() { |
2841 | - return WindowsIconFactory.getCheckBoxIcon(); |
2842 | - } |
2843 | - |
2844 | - public static Icon getRadioButtonIcon() { |
2845 | - return WindowsIconFactory.getRadioButtonIcon(); |
2846 | - } |
2847 | - |
2848 | - |
2849 | - // Helper Code ************************************************************ |
2850 | - |
2851 | - /** |
2852 | - * Appends the key and value to the given source array and returns |
2853 | - * a copy that has the two new elements at its end. |
2854 | - * |
2855 | - * @return an array with the key and value appended |
2856 | - */ |
2857 | - private static Object[] append(Object[] source, String key, Object value) { |
2858 | - int length = source.length; |
2859 | - Object[] destination = new Object[length + 2]; |
2860 | - System.arraycopy(source, 0, destination, 0, length); |
2861 | - destination[length] = key; |
2862 | - destination[length + 1] = value; |
2863 | - return destination; |
2864 | - } |
2865 | - |
2866 | - |
2867 | - /** |
2868 | - * Appends the key and value to the given source array and returns |
2869 | - * a copy that has the two new elements at its end. |
2870 | - * |
2871 | - * @return an array with the key and value appended |
2872 | - */ |
2873 | - private static Object[] append(Object[] source, Object[] keysAndValues) { |
2874 | - int length = source.length; |
2875 | - Object[] destination = new Object[length + keysAndValues.length]; |
2876 | - System.arraycopy(source, 0, destination, 0, length); |
2877 | - for (int i = 0; i < keysAndValues.length; i++) { |
2878 | - destination[length + i] = keysAndValues[i]; |
2879 | - } |
2880 | - return destination; |
2881 | - } |
2882 | - |
2883 | - // Helper Class *********************************************************** |
2884 | - |
2885 | - /** |
2886 | - * This class provides an implementation of <code>LazyValue</code> that |
2887 | - * can be used to delay loading of the Class for the instance to be created. |
2888 | - * It also avoids creation of an anonymous inner class for the |
2889 | - * <code>LazyValue</code> |
2890 | - * subclass. Both of these improve performance at the time that a |
2891 | - * a Look and Feel is loaded, at the cost of a slight performance |
2892 | - * reduction the first time <code>createValue</code> is called |
2893 | - * (since Reflection APIs are used). |
2894 | - */ |
2895 | - private static class SimpleProxyLazyValue implements UIDefaults.LazyValue { |
2896 | - |
2897 | - private final String className; |
2898 | - private final String methodName; |
2899 | - |
2900 | - /** |
2901 | - * Creates a <code>LazyValue</code> which will construct an instance |
2902 | - * when asked. |
2903 | - * |
2904 | - * @param c a <code>String</code> specifying the classname of the class |
2905 | - * containing a static method to be called for instance creation |
2906 | - * @param m a <code>String</code> specifying the static |
2907 | - * method to be called on class c |
2908 | - */ |
2909 | - public SimpleProxyLazyValue(String c, String m) { |
2910 | - className = c; |
2911 | - methodName = m; |
2912 | - } |
2913 | - |
2914 | - /** |
2915 | - * Creates the value retrieved from the <code>UIDefaults</code> table. |
2916 | - * The object is created each time it is accessed. |
2917 | - * |
2918 | - * @param table a <code>UIDefaults</code> table |
2919 | - * @return the created <code>Object</code> |
2920 | - */ |
2921 | - public Object createValue(UIDefaults table) { |
2922 | - Object instance = null; |
2923 | - try { |
2924 | - Class c; |
2925 | - // We use a separate ClassLoader |
2926 | - ClassLoader classLoader = table != null |
2927 | - ? (ClassLoader) table.get("ClassLoader") |
2928 | - : Thread.currentThread().getContextClassLoader(); |
2929 | - if (classLoader == null) { |
2930 | - classLoader = getClass().getClassLoader(); |
2931 | - } |
2932 | - c = Class.forName(className, true, classLoader); |
2933 | - Method m = c.getMethod(methodName, null); |
2934 | - instance = m.invoke(c, null); |
2935 | - } catch (Throwable t) { |
2936 | - LookUtils.log("Problem creating " + className + " with method " |
2937 | - + methodName + t); |
2938 | - } |
2939 | - return instance; |
2940 | - } |
2941 | - } |
2942 | - |
2943 | -} |
2944 | \ No newline at end of file |
2945 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsMenuBarUI.java |
2946 | +++ /dev/null |
2947 | @@ -1,126 +0,0 @@ |
2948 | -/* |
2949 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
2950 | - * |
2951 | - * Redistribution and use in source and binary forms, with or without |
2952 | - * modification, are permitted provided that the following conditions are met: |
2953 | - * |
2954 | - * o Redistributions of source code must retain the above copyright notice, |
2955 | - * this list of conditions and the following disclaimer. |
2956 | - * |
2957 | - * o Redistributions in binary form must reproduce the above copyright notice, |
2958 | - * this list of conditions and the following disclaimer in the documentation |
2959 | - * and/or other materials provided with the distribution. |
2960 | - * |
2961 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
2962 | - * its contributors may be used to endorse or promote products derived |
2963 | - * from this software without specific prior written permission. |
2964 | - * |
2965 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
2966 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
2967 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
2968 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
2969 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
2970 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
2971 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
2972 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
2973 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
2974 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
2975 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2976 | - */ |
2977 | - |
2978 | -package com.jgoodies.looks.windows; |
2979 | - |
2980 | -import java.beans.PropertyChangeEvent; |
2981 | -import java.beans.PropertyChangeListener; |
2982 | - |
2983 | -import javax.swing.JComponent; |
2984 | -import javax.swing.LookAndFeel; |
2985 | -import javax.swing.plaf.ComponentUI; |
2986 | - |
2987 | -import com.jgoodies.looks.BorderStyle; |
2988 | -import com.jgoodies.looks.HeaderStyle; |
2989 | -import com.jgoodies.looks.Options; |
2990 | - |
2991 | -/** |
2992 | - * The JGoodies Windows look and feel implemenation of <code>MenuBarUI</code>.<p> |
2993 | - * |
2994 | - * Can handle optional <code>Border</code> types as specified by the |
2995 | - * <code>BorderStyle</code> or <code>HeaderStyle</code> client properties. |
2996 | - * |
2997 | - * @author Karsten Lentzsch |
2998 | - * @version $Revision: 1.3 $ |
2999 | - */ |
3000 | -public final class WindowsMenuBarUI extends com.sun.java.swing.plaf.windows.WindowsMenuBarUI { |
3001 | - |
3002 | - private PropertyChangeListener listener; |
3003 | - |
3004 | - |
3005 | - public static ComponentUI createUI(JComponent b) { |
3006 | - return new WindowsMenuBarUI(); |
3007 | - } |
3008 | - |
3009 | - |
3010 | - // Handling Special Borders ********************************************************* |
3011 | - |
3012 | - protected void installDefaults() { |
3013 | - super.installDefaults(); |
3014 | - installSpecialBorder(); |
3015 | - } |
3016 | - |
3017 | - |
3018 | - protected void installListeners() { |
3019 | - super.installListeners(); |
3020 | - listener = createBorderStyleListener(); |
3021 | - menuBar.addPropertyChangeListener(listener); |
3022 | - } |
3023 | - |
3024 | - |
3025 | - protected void uninstallListeners() { |
3026 | - menuBar.removePropertyChangeListener(listener); |
3027 | - super.uninstallListeners(); |
3028 | - } |
3029 | - |
3030 | - |
3031 | - private PropertyChangeListener createBorderStyleListener() { |
3032 | - return new PropertyChangeListener() { |
3033 | - |
3034 | - public void propertyChange(PropertyChangeEvent e) { |
3035 | - String prop = e.getPropertyName(); |
3036 | - if (prop.equals(Options.HEADER_STYLE_KEY) || |
3037 | - prop.equals(WindowsLookAndFeel.BORDER_STYLE_KEY)) { |
3038 | - WindowsMenuBarUI.this.installSpecialBorder(); |
3039 | - } |
3040 | - } |
3041 | - |
3042 | - }; |
3043 | - } |
3044 | - |
3045 | - |
3046 | - /** |
3047 | - * Installs a special border, if either a look-dependent |
3048 | - * <code>BorderStyle</code> or a look-independent |
3049 | - * <code>HeaderStyle</code> has been specified. |
3050 | - * A look specific BorderStyle shadows |
3051 | - * a HeaderStyle.<p> |
3052 | - * |
3053 | - * Specifying a HeaderStyle is recommend. |
3054 | - */ |
3055 | - private void installSpecialBorder() { |
3056 | - String suffix; |
3057 | - BorderStyle borderStyle = BorderStyle.from(menuBar, |
3058 | - WindowsLookAndFeel.BORDER_STYLE_KEY); |
3059 | - if (borderStyle == BorderStyle.EMPTY) |
3060 | - suffix = "emptyBorder"; |
3061 | - else if (borderStyle == BorderStyle.ETCHED) |
3062 | - suffix = "etchedBorder"; |
3063 | - else if (borderStyle == BorderStyle.SEPARATOR) |
3064 | - suffix = "separatorBorder"; |
3065 | - else if (HeaderStyle.from(menuBar) == HeaderStyle.BOTH) |
3066 | - suffix = "headerBorder"; |
3067 | - else |
3068 | - return; |
3069 | - |
3070 | - LookAndFeel.installBorder(menuBar, "MenuBar." + suffix); |
3071 | - } |
3072 | - |
3073 | -} |
3074 | \ No newline at end of file |
3075 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsMenuItemRenderer.java |
3076 | +++ /dev/null |
3077 | @@ -1,77 +0,0 @@ |
3078 | -/* |
3079 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3080 | - * |
3081 | - * Redistribution and use in source and binary forms, with or without |
3082 | - * modification, are permitted provided that the following conditions are met: |
3083 | - * |
3084 | - * o Redistributions of source code must retain the above copyright notice, |
3085 | - * this list of conditions and the following disclaimer. |
3086 | - * |
3087 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3088 | - * this list of conditions and the following disclaimer in the documentation |
3089 | - * and/or other materials provided with the distribution. |
3090 | - * |
3091 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3092 | - * its contributors may be used to endorse or promote products derived |
3093 | - * from this software without specific prior written permission. |
3094 | - * |
3095 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3096 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3097 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3098 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3099 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3100 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3101 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3102 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3103 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3104 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3105 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3106 | - */ |
3107 | - |
3108 | -package com.jgoodies.looks.windows; |
3109 | - |
3110 | -import java.awt.Color; |
3111 | -import java.awt.Font; |
3112 | - |
3113 | -import javax.swing.JMenuItem; |
3114 | -import javax.swing.UIManager; |
3115 | - |
3116 | -import com.jgoodies.looks.LookUtils; |
3117 | -import com.jgoodies.looks.common.MenuItemRenderer; |
3118 | - |
3119 | -/** |
3120 | - * Renders and lays out Windows menu items. |
3121 | - * It overrides superclass behavior for the mnemonic check |
3122 | - * and the text shadow feature. |
3123 | - * |
3124 | - * @author Karsten Lentzsch |
3125 | - * @version $Revision: 1.2 $ |
3126 | - */ |
3127 | -final class WindowsMenuItemRenderer extends MenuItemRenderer { |
3128 | - |
3129 | - /** |
3130 | - * Constructs a WindowsMenuItemRenderer for the specified menu item and settings. |
3131 | - */ |
3132 | - public WindowsMenuItemRenderer(JMenuItem menuItem, boolean iconBorderEnabled, |
3133 | - Font acceleratorFont, |
3134 | - Color selectionForeground, |
3135 | - Color disabledForeground, |
3136 | - Color acceleratorForeground, |
3137 | - Color acceleratorSelectionForeground) { |
3138 | - super(menuItem, iconBorderEnabled, acceleratorFont, selectionForeground, disabledForeground, |
3139 | - acceleratorForeground, acceleratorSelectionForeground); |
3140 | - } |
3141 | - |
3142 | - |
3143 | - protected boolean isMnemonicHidden() { |
3144 | - return WindowsLookAndFeel.isMnemonicHidden(); |
3145 | - } |
3146 | - |
3147 | - |
3148 | - protected boolean disabledTextHasShadow() { |
3149 | - return (!LookUtils.IS_LAF_WINDOWS_XP_ENABLED) |
3150 | - || (UIManager.getColor("MenuItem.disabledForeground") == null); |
3151 | - } |
3152 | - |
3153 | - |
3154 | -} |
3155 | \ No newline at end of file |
3156 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsMenuItemUI.java |
3157 | +++ /dev/null |
3158 | @@ -1,80 +0,0 @@ |
3159 | -/* |
3160 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3161 | - * |
3162 | - * Redistribution and use in source and binary forms, with or without |
3163 | - * modification, are permitted provided that the following conditions are met: |
3164 | - * |
3165 | - * o Redistributions of source code must retain the above copyright notice, |
3166 | - * this list of conditions and the following disclaimer. |
3167 | - * |
3168 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3169 | - * this list of conditions and the following disclaimer in the documentation |
3170 | - * and/or other materials provided with the distribution. |
3171 | - * |
3172 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3173 | - * its contributors may be used to endorse or promote products derived |
3174 | - * from this software without specific prior written permission. |
3175 | - * |
3176 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3177 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3178 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3179 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3180 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3181 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3182 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3183 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3184 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3185 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3186 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3187 | - */ |
3188 | - |
3189 | -package com.jgoodies.looks.windows; |
3190 | - |
3191 | -import java.awt.Color; |
3192 | -import java.awt.Font; |
3193 | - |
3194 | -import javax.swing.JComponent; |
3195 | -import javax.swing.JMenuItem; |
3196 | -import javax.swing.plaf.ComponentUI; |
3197 | - |
3198 | -import com.jgoodies.looks.common.ExtBasicMenuItemUI; |
3199 | -import com.jgoodies.looks.common.MenuItemRenderer; |
3200 | - |
3201 | -/** |
3202 | - * The JGoodies Windows look&feel implementation of <code>MenuItemUI</code>.<p> |
3203 | - * |
3204 | - * It differs from the superclass in that it uses a Windows specific |
3205 | - * menu item renderer that checks if mnemonics shall be shown or hidden |
3206 | - * and may paint disabled text with a shadow. |
3207 | - * |
3208 | - * @author Karsten Lentzsch |
3209 | - * @version $Revision: 1.2 $ |
3210 | - */ |
3211 | -public final class WindowsMenuItemUI extends ExtBasicMenuItemUI { |
3212 | - |
3213 | - |
3214 | - public static ComponentUI createUI(JComponent b) { |
3215 | - return new WindowsMenuItemUI(); |
3216 | - } |
3217 | - |
3218 | - |
3219 | - protected MenuItemRenderer createRenderer( |
3220 | - JMenuItem menuItem, |
3221 | - boolean iconBorderEnabled, |
3222 | - Font acceleratorFont, |
3223 | - Color selectionForeground, |
3224 | - Color disabledForeground, |
3225 | - Color acceleratorForeground, |
3226 | - Color acceleratorSelectionForeground) { |
3227 | - return new WindowsMenuItemRenderer( |
3228 | - menuItem, |
3229 | - iconBorderEnabled(), |
3230 | - acceleratorFont, |
3231 | - selectionForeground, |
3232 | - disabledForeground, |
3233 | - acceleratorForeground, |
3234 | - acceleratorSelectionForeground); |
3235 | - } |
3236 | - |
3237 | - |
3238 | -} |
3239 | \ No newline at end of file |
3240 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsOptionPaneUI.java |
3241 | +++ /dev/null |
3242 | @@ -1,68 +0,0 @@ |
3243 | -/* |
3244 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3245 | - * |
3246 | - * Redistribution and use in source and binary forms, with or without |
3247 | - * modification, are permitted provided that the following conditions are met: |
3248 | - * |
3249 | - * o Redistributions of source code must retain the above copyright notice, |
3250 | - * this list of conditions and the following disclaimer. |
3251 | - * |
3252 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3253 | - * this list of conditions and the following disclaimer in the documentation |
3254 | - * and/or other materials provided with the distribution. |
3255 | - * |
3256 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3257 | - * its contributors may be used to endorse or promote products derived |
3258 | - * from this software without specific prior written permission. |
3259 | - * |
3260 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3261 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3262 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3263 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3264 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3265 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3266 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3267 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3268 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3269 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3270 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3271 | - */ |
3272 | - |
3273 | -package com.jgoodies.looks.windows; |
3274 | - |
3275 | -import java.awt.Container; |
3276 | - |
3277 | -import javax.swing.JComponent; |
3278 | -import javax.swing.JPanel; |
3279 | -import javax.swing.UIManager; |
3280 | -import javax.swing.plaf.ComponentUI; |
3281 | -import javax.swing.plaf.basic.BasicOptionPaneUI; |
3282 | - |
3283 | -import com.jgoodies.looks.common.ExtButtonAreaLayout; |
3284 | - |
3285 | -/** |
3286 | - * The JGoodies Windows Look&Feel implementation of |
3287 | - * <code>OptionPaneUI</code>. Honors the screen resolution and uses a |
3288 | - * minimum button with that complies better with the Windows UI style guide. |
3289 | - * |
3290 | - * @author Karsten Lentzsch |
3291 | - * @version $Revision: 1.3 $ |
3292 | - */ |
3293 | -public final class WindowsOptionPaneUI extends BasicOptionPaneUI { |
3294 | - |
3295 | - public static ComponentUI createUI(JComponent b) { |
3296 | - return new WindowsOptionPaneUI(); |
3297 | - } |
3298 | - |
3299 | - /** |
3300 | - * Creates and returns a Container containin the buttons. The buttons |
3301 | - * are created by calling <code>getButtons</code>. |
3302 | - */ |
3303 | - protected Container createButtonArea() { |
3304 | - JPanel bottom = new JPanel(new ExtButtonAreaLayout(true, 6)); |
3305 | - bottom.setBorder(UIManager.getBorder("OptionPane.buttonAreaBorder")); |
3306 | - addButtonComponents(bottom, getButtons(), getInitialValueIndex()); |
3307 | - return bottom; |
3308 | - } |
3309 | - |
3310 | -} |
3311 | \ No newline at end of file |
3312 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsPasswordFieldUI.java |
3313 | +++ /dev/null |
3314 | @@ -1,102 +0,0 @@ |
3315 | -/* |
3316 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3317 | - * |
3318 | - * Redistribution and use in source and binary forms, with or without |
3319 | - * modification, are permitted provided that the following conditions are met: |
3320 | - * |
3321 | - * o Redistributions of source code must retain the above copyright notice, |
3322 | - * this list of conditions and the following disclaimer. |
3323 | - * |
3324 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3325 | - * this list of conditions and the following disclaimer in the documentation |
3326 | - * and/or other materials provided with the distribution. |
3327 | - * |
3328 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3329 | - * its contributors may be used to endorse or promote products derived |
3330 | - * from this software without specific prior written permission. |
3331 | - * |
3332 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3333 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3334 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3335 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3336 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3337 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3338 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3339 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3340 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3341 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3342 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3343 | - */ |
3344 | - |
3345 | -package com.jgoodies.looks.windows; |
3346 | - |
3347 | - |
3348 | -import javax.swing.JComponent; |
3349 | -import javax.swing.JPasswordField; |
3350 | -import javax.swing.plaf.ComponentUI; |
3351 | -import javax.swing.text.Caret; |
3352 | -import javax.swing.text.Element; |
3353 | -import javax.swing.text.View; |
3354 | - |
3355 | -import com.jgoodies.looks.LookUtils; |
3356 | -import com.jgoodies.looks.common.ExtPasswordView; |
3357 | - |
3358 | -/** |
3359 | - * The JGoodies Windows Look&Feel implementation of a password field UI |
3360 | - * delegate. It differs from its superclass in that it utilizes a password |
3361 | - * view that renders a customizable echo char, not a star ("*"). |
3362 | - * |
3363 | - * Used for Java 1.4 and Java 5. |
3364 | - * |
3365 | - * @author Karsten Lentzsch |
3366 | - * @version $Revision: 1.3 $ |
3367 | - */ |
3368 | -public final class WindowsPasswordFieldUI extends com.sun.java.swing.plaf.windows.WindowsPasswordFieldUI { |
3369 | - |
3370 | - /** |
3371 | - * Creates a UI for a {@link JPasswordField}. |
3372 | - * |
3373 | - * @param c the password field component |
3374 | - * @return the UI |
3375 | - */ |
3376 | - public static ComponentUI createUI(JComponent c) { |
3377 | - return new WindowsPasswordFieldUI(); |
3378 | - } |
3379 | - |
3380 | - /* |
3381 | - * We'd like to just set the dot as echo character. |
3382 | - * But the JPasswordField (in Java 1.4 and Java 5) |
3383 | - * installs the UI in a superclass and then sets the echo character. |
3384 | - * The latter would override our call to #setEchoChar. |
3385 | - */ |
3386 | -// protected void installDefaults() { |
3387 | -// super.installDefaults(); |
3388 | -// JPasswordField field = (JPasswordField) getComponent(); |
3389 | -// field.setEchoChar('\u25CF'); |
3390 | -// } |
3391 | - |
3392 | - |
3393 | - /** |
3394 | - * Creates and returns a view (an <code>ExtPasswordView</code>) for an element. |
3395 | - * |
3396 | - * @param elem the element |
3397 | - * @return the view |
3398 | - */ |
3399 | - public View create(Element elem) { |
3400 | - return (LookUtils.IS_JAVA_1_4_OR_5) |
3401 | - ? new ExtPasswordView(elem) |
3402 | - : super.create(elem); |
3403 | - } |
3404 | - |
3405 | - |
3406 | - /** |
3407 | - * Creates the caret for a field. |
3408 | - * |
3409 | - * @return the caret |
3410 | - */ |
3411 | - protected Caret createCaret() { |
3412 | - return new WindowsFieldCaret(); |
3413 | - } |
3414 | - |
3415 | - |
3416 | -} |
3417 | \ No newline at end of file |
3418 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsPopupMenuUI.java |
3419 | +++ /dev/null |
3420 | @@ -1,110 +0,0 @@ |
3421 | -/* |
3422 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3423 | - * |
3424 | - * Redistribution and use in source and binary forms, with or without |
3425 | - * modification, are permitted provided that the following conditions are met: |
3426 | - * |
3427 | - * o Redistributions of source code must retain the above copyright notice, |
3428 | - * this list of conditions and the following disclaimer. |
3429 | - * |
3430 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3431 | - * this list of conditions and the following disclaimer in the documentation |
3432 | - * and/or other materials provided with the distribution. |
3433 | - * |
3434 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3435 | - * its contributors may be used to endorse or promote products derived |
3436 | - * from this software without specific prior written permission. |
3437 | - * |
3438 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3439 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3440 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3441 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3442 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3443 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3444 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3445 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3446 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3447 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3448 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3449 | - */ |
3450 | - |
3451 | -package com.jgoodies.looks.windows; |
3452 | - |
3453 | -import java.beans.PropertyChangeEvent; |
3454 | -import java.beans.PropertyChangeListener; |
3455 | - |
3456 | -import javax.swing.BoxLayout; |
3457 | -import javax.swing.JComponent; |
3458 | -import javax.swing.LookAndFeel; |
3459 | -import javax.swing.plaf.ComponentUI; |
3460 | -import javax.swing.plaf.UIResource; |
3461 | - |
3462 | -import com.jgoodies.looks.Options; |
3463 | -import com.jgoodies.looks.common.PopupMenuLayout; |
3464 | - |
3465 | -/** |
3466 | - * The JGoodies Windows look&feel implementation of <code>PopMenuUI</code>. |
3467 | - * It differs from the superclass in that it provides an option to get a |
3468 | - * narrow border. You can set a client property |
3469 | - * {@link Options#NO_MARGIN_KEY} to indicate that this popup menu |
3470 | - * has a border without margin. That is useful in the special case |
3471 | - * where the popup contains only a single component, for example |
3472 | - * a JScrollPane. |
3473 | - * |
3474 | - * @author Karsten Lentzsch |
3475 | - * @version $Revision: 1.4 $ |
3476 | - * |
3477 | - * @see com.jgoodies.looks.Options#NO_MARGIN_KEY |
3478 | - */ |
3479 | -public final class WindowsPopupMenuUI extends com.sun.java.swing.plaf.windows.WindowsPopupMenuUI { |
3480 | - |
3481 | - private PropertyChangeListener borderListener; |
3482 | - |
3483 | - public static ComponentUI createUI(JComponent b) { |
3484 | - return new WindowsPopupMenuUI(); |
3485 | - } |
3486 | - |
3487 | - |
3488 | - public void installDefaults() { |
3489 | - super.installDefaults(); |
3490 | - installBorder(); |
3491 | - if ( (popupMenu.getLayout() == null) |
3492 | - || (popupMenu.getLayout() instanceof UIResource)) { |
3493 | - popupMenu.setLayout(new PopupMenuLayout(popupMenu, BoxLayout.Y_AXIS)); |
3494 | - } |
3495 | - } |
3496 | - |
3497 | - public void installListeners() { |
3498 | - super.installListeners(); |
3499 | - borderListener = new BorderStyleChangeHandler(); |
3500 | - popupMenu.addPropertyChangeListener(Options.NO_MARGIN_KEY, borderListener); |
3501 | - } |
3502 | - |
3503 | - protected void uninstallListeners() { |
3504 | - popupMenu.removePropertyChangeListener(Options.NO_MARGIN_KEY, borderListener); |
3505 | - super.uninstallListeners(); |
3506 | - } |
3507 | - |
3508 | - // Narrow Border ********************************************************** |
3509 | - |
3510 | - private final class BorderStyleChangeHandler implements PropertyChangeListener { |
3511 | - |
3512 | - public void propertyChange(PropertyChangeEvent e) { |
3513 | - installBorder(); |
3514 | - } |
3515 | - |
3516 | - } |
3517 | - |
3518 | - /** |
3519 | - * Installs a border without margin, iff the client property |
3520 | - * <code>Options.NO_MARGIN_KEY</code> is set to <code>Boolean.TRUE</code>. |
3521 | - */ |
3522 | - private void installBorder() { |
3523 | - boolean useNarrowBorder = Boolean.TRUE.equals( |
3524 | - popupMenu.getClientProperty(Options.NO_MARGIN_KEY)); |
3525 | - String suffix = useNarrowBorder ? "noMarginBorder" : "border"; |
3526 | - LookAndFeel.installBorder(popupMenu, "PopupMenu." + suffix); |
3527 | - } |
3528 | - |
3529 | - |
3530 | -} |
3531 | \ No newline at end of file |
3532 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsScrollBarUI.java |
3533 | +++ /dev/null |
3534 | @@ -1,63 +0,0 @@ |
3535 | -/* |
3536 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3537 | - * |
3538 | - * Redistribution and use in source and binary forms, with or without |
3539 | - * modification, are permitted provided that the following conditions are met: |
3540 | - * |
3541 | - * o Redistributions of source code must retain the above copyright notice, |
3542 | - * this list of conditions and the following disclaimer. |
3543 | - * |
3544 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3545 | - * this list of conditions and the following disclaimer in the documentation |
3546 | - * and/or other materials provided with the distribution. |
3547 | - * |
3548 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3549 | - * its contributors may be used to endorse or promote products derived |
3550 | - * from this software without specific prior written permission. |
3551 | - * |
3552 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3553 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3554 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3555 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3556 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3557 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3558 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3559 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3560 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3561 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3562 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3563 | - */ |
3564 | - |
3565 | -package com.jgoodies.looks.windows; |
3566 | - |
3567 | -import javax.swing.JButton; |
3568 | -import javax.swing.JComponent; |
3569 | -import javax.swing.plaf.ComponentUI; |
3570 | - |
3571 | -/** |
3572 | - * The JGoodies Windows L&F implementation of* <code>ScrollBarUI</code>. |
3573 | - * It differs from Sun's Windows Look in that it paints black button triangles |
3574 | - * and that it honors the <code>ScrollBar.width</code> property to determine |
3575 | - * the preferred size. |
3576 | - * |
3577 | - * @author Karsten Lentzsch |
3578 | - * @version $Revision: 1.3 $ |
3579 | - */ |
3580 | -public final class WindowsScrollBarUI extends com.sun.java.swing.plaf.windows.WindowsScrollBarUI { |
3581 | - |
3582 | - public static ComponentUI createUI(JComponent b) { |
3583 | - return new WindowsScrollBarUI(); |
3584 | - } |
3585 | - |
3586 | - |
3587 | - protected JButton createDecreaseButton(int orientation) { |
3588 | - return new WindowsArrowButton(orientation); |
3589 | - } |
3590 | - |
3591 | - |
3592 | - protected JButton createIncreaseButton(int orientation) { |
3593 | - return createDecreaseButton(orientation); |
3594 | - } |
3595 | - |
3596 | - |
3597 | -} |
3598 | \ No newline at end of file |
3599 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsScrollPaneUI.java |
3600 | +++ /dev/null |
3601 | @@ -1,99 +0,0 @@ |
3602 | -/* |
3603 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3604 | - * |
3605 | - * Redistribution and use in source and binary forms, with or without |
3606 | - * modification, are permitted provided that the following conditions are met: |
3607 | - * |
3608 | - * o Redistributions of source code must retain the above copyright notice, |
3609 | - * this list of conditions and the following disclaimer. |
3610 | - * |
3611 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3612 | - * this list of conditions and the following disclaimer in the documentation |
3613 | - * and/or other materials provided with the distribution. |
3614 | - * |
3615 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3616 | - * its contributors may be used to endorse or promote products derived |
3617 | - * from this software without specific prior written permission. |
3618 | - * |
3619 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3620 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3621 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3622 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3623 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3624 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3625 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3626 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3627 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3628 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3629 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3630 | - */ |
3631 | - |
3632 | -package com.jgoodies.looks.windows; |
3633 | - |
3634 | -import java.beans.PropertyChangeEvent; |
3635 | -import java.beans.PropertyChangeListener; |
3636 | - |
3637 | -import javax.swing.JComponent; |
3638 | -import javax.swing.JScrollPane; |
3639 | -import javax.swing.LookAndFeel; |
3640 | -import javax.swing.plaf.ComponentUI; |
3641 | - |
3642 | -import com.jgoodies.looks.Options; |
3643 | - |
3644 | -/** |
3645 | - * The JGoodies Windows L&F implementation of <code>ScrollPaneUI</code>. |
3646 | - * Installs an etched border if the client property |
3647 | - * <code>Options.IS_ETCHED_KEY</code> is set. |
3648 | - * |
3649 | - * @author Karsten Lentzsch |
3650 | - * @version $Revision: 1.3 $ |
3651 | - * |
3652 | - * @see com.jgoodies.looks.Options#IS_ETCHED_KEY |
3653 | - */ |
3654 | -public final class WindowsScrollPaneUI extends com.sun.java.swing.plaf.windows.WindowsScrollPaneUI { |
3655 | - |
3656 | - private PropertyChangeListener borderStyleChangeHandler; |
3657 | - |
3658 | - public static ComponentUI createUI(JComponent b) { |
3659 | - return new WindowsScrollPaneUI(); |
3660 | - } |
3661 | - |
3662 | - protected void installDefaults(JScrollPane scrollPane) { |
3663 | - super.installDefaults(scrollPane); |
3664 | - installEtchedBorder(scrollPane); |
3665 | - } |
3666 | - |
3667 | - protected void installEtchedBorder(JScrollPane scrollPane) { |
3668 | - Object value = scrollPane.getClientProperty(Options.IS_ETCHED_KEY); |
3669 | - boolean hasEtchedBorder = Boolean.TRUE.equals(value); |
3670 | - LookAndFeel.installBorder(scrollPane, |
3671 | - hasEtchedBorder |
3672 | - ? "ScrollPane.etchedBorder" |
3673 | - : "ScrollPane.border"); |
3674 | - } |
3675 | - |
3676 | - |
3677 | - // Managing the Etched Property ******************************************* |
3678 | - |
3679 | - public void installListeners(JScrollPane scrollPane) { |
3680 | - super.installListeners(scrollPane); |
3681 | - borderStyleChangeHandler = new BorderStyleChangeHandler(); |
3682 | - scrollPane.addPropertyChangeListener(Options.IS_ETCHED_KEY, borderStyleChangeHandler); |
3683 | - } |
3684 | - |
3685 | - protected void uninstallListeners(JComponent c) { |
3686 | - ((JScrollPane) c).removePropertyChangeListener(Options.IS_ETCHED_KEY, |
3687 | - borderStyleChangeHandler); |
3688 | - super.uninstallListeners(c); |
3689 | - } |
3690 | - |
3691 | - private class BorderStyleChangeHandler implements PropertyChangeListener { |
3692 | - |
3693 | - public void propertyChange(PropertyChangeEvent evt) { |
3694 | - JScrollPane scrollPane = (JScrollPane) evt.getSource(); |
3695 | - installEtchedBorder(scrollPane); |
3696 | - } |
3697 | - |
3698 | - } |
3699 | - |
3700 | -} |
3701 | \ No newline at end of file |
3702 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsSeparatorUI.java |
3703 | +++ /dev/null |
3704 | @@ -1,57 +0,0 @@ |
3705 | -/* |
3706 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3707 | - * |
3708 | - * Redistribution and use in source and binary forms, with or without |
3709 | - * modification, are permitted provided that the following conditions are met: |
3710 | - * |
3711 | - * o Redistributions of source code must retain the above copyright notice, |
3712 | - * this list of conditions and the following disclaimer. |
3713 | - * |
3714 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3715 | - * this list of conditions and the following disclaimer in the documentation |
3716 | - * and/or other materials provided with the distribution. |
3717 | - * |
3718 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3719 | - * its contributors may be used to endorse or promote products derived |
3720 | - * from this software without specific prior written permission. |
3721 | - * |
3722 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3723 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3724 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3725 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3726 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3727 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3728 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3729 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3730 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3731 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3732 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3733 | - */ |
3734 | - |
3735 | -package com.jgoodies.looks.windows; |
3736 | - |
3737 | -import javax.swing.JComponent; |
3738 | -import javax.swing.plaf.ComponentUI; |
3739 | -import javax.swing.plaf.basic.BasicSeparatorUI; |
3740 | - |
3741 | - |
3742 | -/** |
3743 | - * The JGoodies Windows L&F implementation of <code>SeparatorUI</code>. |
3744 | - * It differs from its superclass in that it uses a shared UI delegate. |
3745 | - * |
3746 | - * @author Andrej Golovnin |
3747 | - * @version $Revision: 1.3 $ |
3748 | - */ |
3749 | -public final class WindowsSeparatorUI extends BasicSeparatorUI { |
3750 | - |
3751 | - /** Shared UI object. */ |
3752 | - private static ComponentUI separatorUI; |
3753 | - |
3754 | - public static ComponentUI createUI(JComponent c) { |
3755 | - if (separatorUI == null) { |
3756 | - separatorUI = new WindowsSeparatorUI(); |
3757 | - } |
3758 | - return separatorUI; |
3759 | - } |
3760 | - |
3761 | -} |
3762 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsSpinnerUI.java |
3763 | +++ /dev/null |
3764 | @@ -1,209 +0,0 @@ |
3765 | -/* |
3766 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3767 | - * |
3768 | - * Redistribution and use in source and binary forms, with or without |
3769 | - * modification, are permitted provided that the following conditions are met: |
3770 | - * |
3771 | - * o Redistributions of source code must retain the above copyright notice, |
3772 | - * this list of conditions and the following disclaimer. |
3773 | - * |
3774 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3775 | - * this list of conditions and the following disclaimer in the documentation |
3776 | - * and/or other materials provided with the distribution. |
3777 | - * |
3778 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3779 | - * its contributors may be used to endorse or promote products derived |
3780 | - * from this software without specific prior written permission. |
3781 | - * |
3782 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3783 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3784 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3785 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3786 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3787 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
3788 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
3789 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
3790 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
3791 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
3792 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3793 | - */ |
3794 | - |
3795 | -package com.jgoodies.looks.windows; |
3796 | - |
3797 | -import java.awt.Component; |
3798 | -import java.awt.Insets; |
3799 | -import java.awt.LayoutManager; |
3800 | - |
3801 | -import javax.swing.*; |
3802 | -import javax.swing.border.EmptyBorder; |
3803 | -import javax.swing.plaf.ComponentUI; |
3804 | - |
3805 | -import com.jgoodies.looks.LookUtils; |
3806 | -import com.jgoodies.looks.common.ExtBasicArrowButtonHandler; |
3807 | -import com.jgoodies.looks.common.ExtBasicSpinnerLayout; |
3808 | - |
3809 | -/** |
3810 | - * The JGoodies Windows L&F implementation of <code>SpinnerUI</code>. |
3811 | - * Configures the default editor to adjust font baselines and component |
3812 | - * bounds, by setting an empty border with the default text insets. |
3813 | - * |
3814 | - * @author Karsten Lentzsch |
3815 | - * @version $Revision: 1.4 $ |
3816 | - */ |
3817 | -public final class WindowsSpinnerUI extends com.sun.java.swing.plaf.windows.WindowsSpinnerUI { |
3818 | - |
3819 | - |
3820 | - public static ComponentUI createUI(JComponent b) { |
3821 | - return new WindowsSpinnerUI(); |
3822 | - } |
3823 | - |
3824 | - /** |
3825 | - * The mouse/action listeners that are added to the spinner's arrow |
3826 | - * buttons. These listeners are shared by all spinner arrow buttons. |
3827 | - * |
3828 | - * @see #createNextButton |
3829 | - * @see #createPreviousButton |
3830 | - */ |
3831 | - private static final ExtBasicArrowButtonHandler NEXT_BUTTON_HANDLER = |
3832 | - new ExtBasicArrowButtonHandler("increment", true); |
3833 | - private static final ExtBasicArrowButtonHandler PREVIOUS_BUTTON_HANDLER = |
3834 | - new ExtBasicArrowButtonHandler("decrement", false); |
3835 | - |
3836 | - |
3837 | - /** |
3838 | - * Create a component that will replace the spinner models value with the |
3839 | - * object returned by <code>spinner.getPreviousValue</code>. By default |
3840 | - * the <code>previousButton</code> is a JButton who's <code>ActionListener</code> |
3841 | - * updates it's <code>JSpinner</code> ancestors model. If a |
3842 | - * previousButton isn't needed (in a subclass) then override this method to |
3843 | - * return null. |
3844 | - * |
3845 | - * @return a component that will replace the spinners model with the next |
3846 | - * value in the sequence, or null |
3847 | - * @see #installUI |
3848 | - * @see #createNextButton |
3849 | - */ |
3850 | - protected Component createPreviousButton() { |
3851 | - if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED) |
3852 | - return super.createPreviousButton(); |
3853 | - |
3854 | - JButton b = new WindowsArrowButton(SwingConstants.SOUTH); |
3855 | - b.addActionListener(PREVIOUS_BUTTON_HANDLER); |
3856 | - b.addMouseListener(PREVIOUS_BUTTON_HANDLER); |
3857 | - return b; |
3858 | - } |
3859 | - |
3860 | - |
3861 | - /** |
3862 | - * Create a component that will replace the spinner models value with the |
3863 | - * object returned by <code>spinner.getNextValue</code>. By default the |
3864 | - * <code>nextButton</code> is a JButton who's <code>ActionListener</code> |
3865 | - * updates it's <code>JSpinner</code> ancestors model. If a nextButton |
3866 | - * isn't needed (in a subclass) then override this method to return null. |
3867 | - * |
3868 | - * @return a component that will replace the spinners model with the next |
3869 | - * value in the sequence, or null |
3870 | - * @see #installUI |
3871 | - * @see #createPreviousButton |
3872 | - */ |
3873 | - protected Component createNextButton() { |
3874 | - if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED) |
3875 | - return super.createNextButton(); |
3876 | - |
3877 | - JButton b = new WindowsArrowButton(SwingConstants.NORTH); |
3878 | - b.addActionListener(NEXT_BUTTON_HANDLER); |
3879 | - b.addMouseListener(NEXT_BUTTON_HANDLER); |
3880 | - return b; |
3881 | - } |
3882 | - |
3883 | - |
3884 | - /** |
3885 | - * This method is called by installUI to get the editor component of the |
3886 | - * <code>JSpinner</code>. By default it just returns <code>JSpinner.getEditor()</code>. |
3887 | - * Subclasses can override <code>createEditor</code> to return a |
3888 | - * component that contains the spinner's editor or null, if they're going |
3889 | - * to handle adding the editor to the <code>JSpinner</code> in an <code>installUI</code> |
3890 | - * override. |
3891 | - * <p> |
3892 | - * Typically this method would be overridden to wrap the editor with a |
3893 | - * container with a custom border, since one can't assume that the editors |
3894 | - * border can be set directly. |
3895 | - * <p> |
3896 | - * The <code>replaceEditor</code> method is called when the spinners |
3897 | - * editor is changed with <code>JSpinner.setEditor</code>. If you've |
3898 | - * overriden this method, then you'll probably want to override <code>replaceEditor</code> |
3899 | - * as well. |
3900 | - * |
3901 | - * @return the JSpinners editor JComponent, spinner.getEditor() by default |
3902 | - * @see #installUI |
3903 | - * @see #replaceEditor |
3904 | - * @see JSpinner#getEditor |
3905 | - */ |
3906 | - protected JComponent createEditor() { |
3907 | - JComponent editor = spinner.getEditor(); |
3908 | - configureEditorBorder(editor); |
3909 | - return editor; |
3910 | - } |
3911 | - |
3912 | - |
3913 | - /** |
3914 | - * Create a <code>LayoutManager</code> that manages the <code>editor</code>, |
3915 | - * <code>nextButton</code>, and <code>previousButton</code> children |
3916 | - * of the JSpinner. These three children must be added with a constraint |
3917 | - * that identifies their role: "Editor", "Next", and "Previous". The |
3918 | - * default layout manager can handle the absence of any of these children. |
3919 | - * |
3920 | - * @return a LayoutManager for the editor, next button, and previous |
3921 | - * button. |
3922 | - * @see #createNextButton |
3923 | - * @see #createPreviousButton |
3924 | - * @see #createEditor |
3925 | - */ |
3926 | - protected LayoutManager createLayout() { |
3927 | - return new ExtBasicSpinnerLayout(); |
3928 | - } |
3929 | - |
3930 | - |
3931 | - /** |
3932 | - * Called by the <code>PropertyChangeListener</code> when the <code>JSpinner</code> |
3933 | - * editor property changes. It's the responsibility of this method to |
3934 | - * remove the old editor and add the new one. By default this operation is |
3935 | - * just: |
3936 | - * |
3937 | - * <pre> |
3938 | - * spinner.remove(oldEditor); spinner.add(newEditor, "Editor"); |
3939 | - * </pre> |
3940 | - * |
3941 | - * |
3942 | - * The implementation of <code>replaceEditor</code> should be coordinated |
3943 | - * with the <code>createEditor</code> method. |
3944 | - * |
3945 | - * @see #createEditor |
3946 | - * @see #createPropertyChangeListener |
3947 | - */ |
3948 | - protected void replaceEditor(JComponent oldEditor, JComponent newEditor) { |
3949 | - spinner.remove(oldEditor); |
3950 | - configureEditorBorder(newEditor); |
3951 | - spinner.add(newEditor, "Editor"); |
3952 | - } |
3953 | - |
3954 | - |
3955 | - /** |
3956 | - * Sets an empty border with consistent insets. |
3957 | - */ |
3958 | - private void configureEditorBorder(JComponent editor) { |
3959 | - if ((editor instanceof JSpinner.DefaultEditor)) { |
3960 | - JSpinner.DefaultEditor defaultEditor = (JSpinner.DefaultEditor) editor; |
3961 | - JTextField editorField = defaultEditor.getTextField(); |
3962 | - Insets insets = UIManager.getInsets("Spinner.defaultEditorInsets"); |
3963 | - editorField.setBorder(new EmptyBorder(insets)); |
3964 | - } else if ( (editor instanceof JPanel) |
3965 | - && (editor.getBorder() == null) |
3966 | - && (editor.getComponentCount() > 0)) { |
3967 | - JComponent editorField = (JComponent) editor.getComponent(0); |
3968 | - Insets insets = UIManager.getInsets("Spinner.defaultEditorInsets"); |
3969 | - editorField.setBorder(new EmptyBorder(insets)); |
3970 | - } |
3971 | - } |
3972 | - |
3973 | -} |
3974 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsSplitPaneDivider.java |
3975 | +++ /dev/null |
3976 | @@ -1,352 +0,0 @@ |
3977 | -/* |
3978 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
3979 | - * |
3980 | - * Redistribution and use in source and binary forms, with or without |
3981 | - * modification, are permitted provided that the following conditions are met: |
3982 | - * |
3983 | - * o Redistributions of source code must retain the above copyright notice, |
3984 | - * this list of conditions and the following disclaimer. |
3985 | - * |
3986 | - * o Redistributions in binary form must reproduce the above copyright notice, |
3987 | - * this list of conditions and the following disclaimer in the documentation |
3988 | - * and/or other materials provided with the distribution. |
3989 | - * |
3990 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
3991 | - * its contributors may be used to endorse or promote products derived |
3992 | - * from this software without specific prior written permission. |
3993 | - * |
3994 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
3995 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
3996 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
3997 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
3998 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3999 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
4000 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
4001 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
4002 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
4003 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
4004 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
4005 | - */ |
4006 | - |
4007 | -package com.jgoodies.looks.windows; |
4008 | - |
4009 | -import java.awt.Color; |
4010 | -import java.awt.Component; |
4011 | -import java.awt.Container; |
4012 | -import java.awt.Dimension; |
4013 | -import java.awt.Graphics; |
4014 | -import java.awt.LayoutManager; |
4015 | - |
4016 | -import javax.swing.JButton; |
4017 | -import javax.swing.JSplitPane; |
4018 | -import javax.swing.UIManager; |
4019 | -import javax.swing.border.Border; |
4020 | -import javax.swing.plaf.basic.BasicSplitPaneDivider; |
4021 | -import javax.swing.plaf.basic.BasicSplitPaneUI; |
4022 | - |
4023 | -/** |
4024 | - * Paints nicely rendered one touch triangles. |
4025 | - * |
4026 | - * @author Karsten Lentzsch |
4027 | - * @version $Revision: 1.4 $ |
4028 | - * |
4029 | - * @see WindowsSplitPaneUI |
4030 | - */ |
4031 | -final class WindowsSplitPaneDivider extends BasicSplitPaneDivider { |
4032 | - |
4033 | - private static final int EXT_ONE_TOUCH_SIZE = 5; |
4034 | - private static final int EXT_ONE_TOUCH_OFFSET = 2; |
4035 | - private static final int EXT_BLOCKSIZE = 6; |
4036 | - |
4037 | - /** |
4038 | - * Used to lay out a WindowsSplitPaneDivider. Layout for the divider |
4039 | - * involves appropriately moving the left/right buttons around. |
4040 | - * <p> |
4041 | - * This inner class is marked "public" due to a compiler bug. |
4042 | - * This class should be treated as a "protected" inner class. |
4043 | - * Instantiate it only within subclasses of MetalSplitPaneDivider. |
4044 | - */ |
4045 | - public final class ExtWindowsDividerLayout implements LayoutManager { |
4046 | - public void layoutContainer(Container c) { |
4047 | - JButton theLeftButton = getLeftButtonFromSuper(); |
4048 | - JButton theRightButton = getRightButtonFromSuper(); |
4049 | - JSplitPane theSplitPane = getSplitPaneFromSuper(); |
4050 | - int theOrientation = getOrientationFromSuper(); |
4051 | - int oneTouchSize = getOneTouchSize(); |
4052 | - int oneTouchOffset = getOneTouchOffset(); |
4053 | - int blockSize = 5; |
4054 | - //getBlockSize(); //Math.min(getDividerSize(), oneTouchSize); |
4055 | - |
4056 | - // This layout differs from the one used in BasicSplitPaneDivider. |
4057 | - // It does not center justify the oneTouchExpadable buttons. |
4058 | - // This was necessary in order to meet the spec of the Metal |
4059 | - // splitpane divider. |
4060 | - if (theLeftButton != null |
4061 | - && theRightButton != null |
4062 | - && c == WindowsSplitPaneDivider.this) { |
4063 | - if (theSplitPane.isOneTouchExpandable()) { |
4064 | - if (theOrientation == JSplitPane.VERTICAL_SPLIT) { |
4065 | - theLeftButton.setBounds( |
4066 | - oneTouchOffset, |
4067 | - 0, |
4068 | - blockSize * 2, |
4069 | - blockSize); |
4070 | - theRightButton.setBounds( |
4071 | - oneTouchOffset + oneTouchSize * 2, |
4072 | - 0, |
4073 | - blockSize * 2, |
4074 | - blockSize); |
4075 | - } else { |
4076 | - theLeftButton.setBounds( |
4077 | - 0, |
4078 | - oneTouchOffset, |
4079 | - blockSize, |
4080 | - blockSize * 2); |
4081 | - theRightButton.setBounds( |
4082 | - 0, |
4083 | - oneTouchOffset + oneTouchSize * 2, |
4084 | - blockSize, |
4085 | - blockSize * 2); |
4086 | - } |
4087 | - } else { |
4088 | - theLeftButton.setBounds(-5, -5, 1, 1); |
4089 | - theRightButton.setBounds(-5, -5, 1, 1); |
4090 | - } |
4091 | - } |
4092 | - } |
4093 | - |
4094 | - public Dimension minimumLayoutSize(Container c) { |
4095 | - return new Dimension(0, 0); |
4096 | - } |
4097 | - public Dimension preferredLayoutSize(Container c) { |
4098 | - return new Dimension(0, 0); |
4099 | - } |
4100 | - public void removeLayoutComponent(Component c) { |
4101 | - // Unused method; implements LayoutManager. |
4102 | - } |
4103 | - public void addLayoutComponent(String string, Component c) { |
4104 | - // Unused method; implements LayoutManager. |
4105 | - } |
4106 | - } |
4107 | - |
4108 | - public WindowsSplitPaneDivider(BasicSplitPaneUI ui) { |
4109 | - super(ui); |
4110 | - setLayout(new ExtWindowsDividerLayout()); |
4111 | - } |
4112 | - |
4113 | - /** |
4114 | - * Creates and return an instance of JButton that can be used to |
4115 | - * collapse the left component in the metal split pane. |
4116 | - */ |
4117 | - protected JButton createLeftOneTouchButton() { |
4118 | - JButton b = new JButton() { |
4119 | - // Sprite buffer for the arrow image of the left button |
4120 | - int[][] buffer = { { 0, 0, 0, 2, 2, 0, 0, 0, 0 }, { |
4121 | - 0, 0, 2, 1, 1, 1, 0, 0, 0 }, { |
4122 | - 0, 2, 1, 1, 1, 1, 1, 0, 0 }, { |
4123 | - 2, 1, 1, 1, 1, 1, 1, 1, 0 }, { |
4124 | - 0, 3, 3, 3, 3, 3, 3, 3, 3 } |
4125 | - }; |
4126 | - |
4127 | - public void setBorder(Border border) { |
4128 | - // Ignore borders |
4129 | - } |
4130 | - |
4131 | - public void paint(Graphics g) { |
4132 | - JSplitPane theSplitPane = getSplitPaneFromSuper(); |
4133 | - if (theSplitPane != null) { |
4134 | - int theOrientation = getOrientationFromSuper(); |
4135 | - int blockSize = buffer.length + 1; |
4136 | - //Math.min(getDividerSize(), oneTouchSize); |
4137 | - |
4138 | - // Initialize the color array |
4139 | - Color[] colors = |
4140 | - { |
4141 | - this.getBackground(), |
4142 | - UIManager.getColor("controlDkShadow"), |
4143 | - Color.black, |
4144 | - //UIManager.getColor(), |
4145 | - UIManager.getColor("controlLtHighlight")}; |
4146 | - |
4147 | - // Fill the background first ... |
4148 | - g.setColor(this.getBackground()); |
4149 | - g.fillRect(0, 0, this.getWidth(), this.getHeight()); |
4150 | - |
4151 | - // ... then draw the arrow. |
4152 | - if (getModel().isPressed()) { |
4153 | - // Adjust color mapping for pressed button state |
4154 | - colors[1] = colors[2]; |
4155 | - } |
4156 | - if (theOrientation == JSplitPane.VERTICAL_SPLIT) { |
4157 | - // Draw the image for a vertical split |
4158 | - for (int i = 1; i <= buffer[0].length; i++) { |
4159 | - for (int j = 1; j < blockSize; j++) { |
4160 | - if (buffer[j - 1][i - 1] == 0) { |
4161 | - continue; |
4162 | - } |
4163 | - g.setColor(colors[buffer[j - 1][i - 1]]); |
4164 | - g.drawLine(i - 1, j, i - 1, j); |
4165 | - } |
4166 | - } |
4167 | - } else { |
4168 | - // Draw the image for a horizontal split |
4169 | - // by simply swaping the i and j axis. |
4170 | - // Except the drawLine() call this code is |
4171 | - // identical to the code block above. This was done |
4172 | - // in order to remove the additional orientation |
4173 | - // check for each pixel. |
4174 | - for (int i = 1; i <= buffer[0].length; i++) { |
4175 | - for (int j = 1; j < blockSize; j++) { |
4176 | - if (buffer[j - 1][i - 1] == 0) { |
4177 | - // Nothing needs |
4178 | - // to be drawn |
4179 | - continue; |
4180 | - } |
4181 | - // Set the color from the |
4182 | - // color map |
4183 | - g.setColor(colors[buffer[j - 1][i - 1]]); |
4184 | - // Draw a pixel |
4185 | - g.drawLine(j - 1, i, j - 1, i); |
4186 | - } |
4187 | - } |
4188 | - } |
4189 | - } |
4190 | - } |
4191 | - |
4192 | - }; |
4193 | - b.setFocusPainted(false); |
4194 | - b.setBorderPainted(false); |
4195 | - b.setFocusable(false); |
4196 | - b.setOpaque(false); |
4197 | - return b; |
4198 | - } |
4199 | - |
4200 | - /** |
4201 | - * Creates and return an instance of JButton that can be used to |
4202 | - * collapse the right component in the metal split pane. |
4203 | - */ |
4204 | - protected JButton createRightOneTouchButton() { |
4205 | - JButton b = new JButton() { |
4206 | - // Sprite buffer for the arrow image of the right button |
4207 | - int[][] buffer = { { 2, 2, 2, 2, 2, 2, 2, 2 }, { |
4208 | - 0, 1, 1, 1, 1, 1, 1, 3 }, { |
4209 | - 0, 0, 1, 1, 1, 1, 3, 0 }, { |
4210 | - 0, 0, 0, 1, 1, 3, 0, 0 }, { |
4211 | - 0, 0, 0, 0, 3, 0, 0, 0 } |
4212 | - }; |
4213 | - |
4214 | - public void setBorder(Border border) { |
4215 | - // Ignore borders |
4216 | - } |
4217 | - |
4218 | - public void paint(Graphics g) { |
4219 | - JSplitPane theSplitPane = getSplitPaneFromSuper(); |
4220 | - if (theSplitPane != null) { |
4221 | - int theOrientation = getOrientationFromSuper(); |
4222 | - int blockSize = buffer.length + 1; |
4223 | - //Math.min(getDividerSize(), oneTouchSize); |
4224 | - |
4225 | - // Initialize the color array |
4226 | - Color[] colors = |
4227 | - { |
4228 | - this.getBackground(), |
4229 | - UIManager.getColor("controlDkShadow"), |
4230 | - Color.black, |
4231 | - //UIManager.getColor("controlDkShadow"), |
4232 | - UIManager.getColor("controlLtHighlight")}; |
4233 | - |
4234 | - // Fill the background first ... |
4235 | - g.setColor(this.getBackground()); |
4236 | - g.fillRect(0, 0, this.getWidth(), this.getHeight()); |
4237 | - |
4238 | - // ... then draw the arrow. |
4239 | - if (getModel().isPressed()) { |
4240 | - // Adjust color mapping for pressed button state |
4241 | - colors[1] = colors[2]; |
4242 | - } |
4243 | - if (theOrientation == JSplitPane.VERTICAL_SPLIT) { |
4244 | - // Draw the image for a vertical split |
4245 | - for (int i = 1; i <= buffer[0].length; i++) { |
4246 | - for (int j = 1; j < blockSize; j++) { |
4247 | - if (buffer[j - 1][i - 1] == 0) { |
4248 | - continue; |
4249 | - } |
4250 | - g.setColor(colors[buffer[j - 1][i - 1]]); |
4251 | - g.drawLine(i, j, i, j); |
4252 | - } |
4253 | - } |
4254 | - } else { |
4255 | - // Draw the image for a horizontal split |
4256 | - // by simply swaping the i and j axis. |
4257 | - // Except the drawLine() call this code is |
4258 | - // identical to the code block above. This was done |
4259 | - // in order to remove the additional orientation |
4260 | - // check for each pixel. |
4261 | - for (int i = 1; i <= buffer[0].length; i++) { |
4262 | - for (int j = 1; j < blockSize; j++) { |
4263 | - if (buffer[j - 1][i - 1] == 0) { |
4264 | - // Nothing needs |
4265 | - // to be drawn |
4266 | - continue; |
4267 | - } |
4268 | - // Set the color from the |
4269 | - // color map |
4270 | - g.setColor(colors[buffer[j - 1][i - 1]]); |
4271 | - // Draw a pixel |
4272 | - g.drawLine(j - 1, i, j - 1, i); |
4273 | - } |
4274 | - } |
4275 | - } |
4276 | - } |
4277 | - } |
4278 | - }; |
4279 | - b.setFocusPainted(false); |
4280 | - b.setBorderPainted(false); |
4281 | - b.setFocusable(false); |
4282 | - b.setOpaque(false); |
4283 | - return b; |
4284 | - } |
4285 | - |
4286 | - int getBlockSize() { |
4287 | - return EXT_BLOCKSIZE; |
4288 | - } |
4289 | - |
4290 | - int getOneTouchOffset() { |
4291 | - return EXT_ONE_TOUCH_OFFSET; |
4292 | - } |
4293 | - |
4294 | - int getOneTouchSize() { |
4295 | - return EXT_ONE_TOUCH_SIZE; |
4296 | - } |
4297 | - |
4298 | - int getOrientationFromSuper() { |
4299 | - return super.orientation; |
4300 | - } |
4301 | - |
4302 | - JButton getLeftButtonFromSuper() { |
4303 | - return super.leftButton; |
4304 | - } |
4305 | - |
4306 | - JButton getRightButtonFromSuper() { |
4307 | - return super.rightButton; |
4308 | - } |
4309 | - |
4310 | - JSplitPane getSplitPaneFromSuper() { |
4311 | - return super.splitPane; |
4312 | - } |
4313 | - |
4314 | - public void paint(Graphics g) { |
4315 | - if (splitPane.isOpaque()) { |
4316 | - Color bgColor = splitPane.hasFocus() |
4317 | - ? UIManager.getColor("SplitPane.shadow") |
4318 | - : getBackground(); |
4319 | - |
4320 | - if (bgColor != null) { |
4321 | - g.setColor(bgColor); |
4322 | - g.fillRect(0, 0, getWidth(), getHeight()); |
4323 | - } |
4324 | - } |
4325 | - super.paint(g); |
4326 | - } |
4327 | - |
4328 | -} |
4329 | \ No newline at end of file |
4330 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsSplitPaneUI.java |
4331 | +++ /dev/null |
4332 | @@ -1,66 +0,0 @@ |
4333 | -/* |
4334 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
4335 | - * |
4336 | - * Redistribution and use in source and binary forms, with or without |
4337 | - * modification, are permitted provided that the following conditions are met: |
4338 | - * |
4339 | - * o Redistributions of source code must retain the above copyright notice, |
4340 | - * this list of conditions and the following disclaimer. |
4341 | - * |
4342 | - * o Redistributions in binary form must reproduce the above copyright notice, |
4343 | - * this list of conditions and the following disclaimer in the documentation |
4344 | - * and/or other materials provided with the distribution. |
4345 | - * |
4346 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
4347 | - * its contributors may be used to endorse or promote products derived |
4348 | - * from this software without specific prior written permission. |
4349 | - * |
4350 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
4351 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
4352 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
4353 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
4354 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
4355 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
4356 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
4357 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
4358 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
4359 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
4360 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
4361 | - */ |
4362 | - |
4363 | -package com.jgoodies.looks.windows; |
4364 | - |
4365 | -import javax.swing.JComponent; |
4366 | -import javax.swing.plaf.ComponentUI; |
4367 | -import javax.swing.plaf.basic.BasicSplitPaneDivider; |
4368 | - |
4369 | - |
4370 | -/** |
4371 | - * The JGoodies Windows L&F implementation of <code>SplitPaneUI</code>. |
4372 | - * Uses a special divider that paints modified one-touch buttons. |
4373 | - * |
4374 | - * @author Karsten Lentzsch |
4375 | - * @version $Revision: 1.3 $ |
4376 | - * |
4377 | - * @see com.jgoodies.looks.windows.WindowsSplitPaneDivider |
4378 | - */ |
4379 | -public final class WindowsSplitPaneUI extends com.sun.java.swing.plaf.windows.WindowsSplitPaneUI { |
4380 | - |
4381 | - |
4382 | - /** |
4383 | - * Creates and returns a <code>WindowsSplitPaneUI</code> instance. |
4384 | - */ |
4385 | - public static ComponentUI createUI(JComponent x) { |
4386 | - return new WindowsSplitPaneUI(); |
4387 | - } |
4388 | - |
4389 | - |
4390 | - /** |
4391 | - * Creates and returns the modified default divider. |
4392 | - */ |
4393 | - public BasicSplitPaneDivider createDefaultDivider() { |
4394 | - return new WindowsSplitPaneDivider(this); |
4395 | - } |
4396 | - |
4397 | - |
4398 | -} |
4399 | \ No newline at end of file |
4400 | --- libjgoodies-looks-java.orig/src/core/com/jgoodies/looks/windows/WindowsTabbedPaneUI.java |
4401 | +++ /dev/null |
4402 | @@ -1,583 +0,0 @@ |
4403 | -/* |
4404 | - * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved. |
4405 | - * |
4406 | - * Redistribution and use in source and binary forms, with or without |
4407 | - * modification, are permitted provided that the following conditions are met: |
4408 | - * |
4409 | - * o Redistributions of source code must retain the above copyright notice, |
4410 | - * this list of conditions and the following disclaimer. |
4411 | - * |
4412 | - * o Redistributions in binary form must reproduce the above copyright notice, |
4413 | - * this list of conditions and the following disclaimer in the documentation |
4414 | - * and/or other materials provided with the distribution. |
4415 | - * |
4416 | - * o Neither the name of JGoodies Karsten Lentzsch nor the names of |
4417 | - * its contributors may be used to endorse or promote products derived |
4418 | - * from this software without specific prior written permission. |
4419 | - * |
4420 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
4421 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
4422 | - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
4423 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
4424 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
4425 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
4426 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
4427 | - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
4428 | - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
4429 | - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
4430 | - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
4431 | - */ |
4432 | - |
4433 | -package com.jgoodies.looks.windows; |
4434 | - |
4435 | -import java.awt.FontMetrics; |
4436 | -import java.awt.Graphics; |
4437 | -import java.awt.Insets; |
4438 | -import java.awt.Rectangle; |
4439 | -import java.beans.PropertyChangeEvent; |
4440 | -import java.beans.PropertyChangeListener; |
4441 | - |
4442 | -import javax.swing.Icon; |
4443 | -import javax.swing.JComponent; |
4444 | -import javax.swing.SwingConstants; |
4445 | -import javax.swing.SwingUtilities; |
4446 | -import javax.swing.plaf.ComponentUI; |
4447 | -import javax.swing.plaf.basic.BasicGraphicsUtils; |
4448 | -import javax.swing.plaf.basic.BasicTabbedPaneUI; |
4449 | -import javax.swing.text.View; |
4450 | - |
4451 | -import com.jgoodies.looks.LookUtils; |
4452 | -import com.jgoodies.looks.Options; |
4453 | - |
4454 | -/** |
4455 | - * The JGoodies Windows L&F implementation of <code>TabbedPaneUI</code>.<p> |
4456 | - * |
4457 | - * The flat appearance is work in progress; currently it works only |
4458 | - * for a single line of tabs and paints distored tabs for multiple lines. |
4459 | - * |
4460 | - * @author Karsten Lentzsch |
4461 | - * @version $Revision: 1.5 $ |
4462 | - */ |
4463 | -public final class WindowsTabbedPaneUI extends com.sun.java.swing.plaf.windows.WindowsTabbedPaneUI { |
4464 | - |
4465 | - private static final boolean IS_XP_LAF_5_OR_LATER = |
4466 | - LookUtils.IS_JAVA_5_OR_LATER && LookUtils.IS_LAF_WINDOWS_XP_ENABLED; |
4467 | - |
4468 | - /** Insets used for the embedded style content border. */ |
4469 | - private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0); |
4470 | - |
4471 | - /** Insets used if we paint no content border. */ |
4472 | - private static final int INSET = IS_XP_LAF_5_OR_LATER ? -1 : 1; |
4473 | - private static final Insets NO_CONTENT_BORDER_NORTH_INSETS = new Insets(INSET, 0, 0, 0); |
4474 | - private static final Insets NO_CONTENT_BORDER_WEST_INSETS = new Insets(0, INSET, 0, 0); |
4475 | - private static final Insets NO_CONTENT_BORDER_SOUTH_INSETS = new Insets(0, 0, INSET, 0); |
4476 | - private static final Insets NO_CONTENT_BORDER_EAST_INSETS = new Insets(0, 0, 0, INSET); |
4477 | - |
4478 | - /** Insets used if we paint content border. */ |
4479 | - private static final Insets CONTENT_BORDER_NORTH_INSETS = new Insets(0, 2, 4, 4); |
4480 | - private static final Insets CONTENT_BORDER_WEST_INSETS = new Insets(2, 0, 4, 4); |
4481 | - private static final Insets CONTENT_BORDER_SOUTH_INSETS = new Insets(4, 2, 0, 4); |
4482 | - private static final Insets CONTENT_BORDER_EAST_INSETS = new Insets(2, 4, 4, 0); |
4483 | - |
4484 | - |
4485 | - /** |
4486 | - * Describes if tabs are painted with or without icons. |
4487 | - */ |
4488 | - private static boolean isTabIconsEnabled = Options.isTabIconsEnabled(); |
4489 | - |
4490 | - /** |
4491 | - * Describes if we paint no content border or not; this is false by default. |
4492 | - * You can disable the content border by setting the client property |
4493 | - * Options.NO_CONTENT_BORDER_KEY to Boolean.TRUE; |
4494 | - */ |
4495 | - private Boolean noContentBorder; |
4496 | - |
4497 | - /** |
4498 | - * Describes if we paint tabs in an embedded style that is with |
4499 | - * less decoration; this is false by default. |
4500 | - * You can enable the embedded tabs style by setting the client property |
4501 | - * Options.EMBEDDED_TABS_KEY to Boolean.TRUE. |
4502 | - */ |
4503 | - private Boolean embeddedTabs; |
4504 | - |
4505 | - /** |
4506 | - * Creates and answers the <code>WindowsTabbedPaneUI</code>. |
4507 | - * |
4508 | - * @see javax.swing.plaf.ComponentUI#createUI(JComponent) |
4509 | - */ |
4510 | - public static ComponentUI createUI(JComponent x) { |
4511 | - return new WindowsTabbedPaneUI(); |
4512 | - } |
4513 | - |
4514 | - |
4515 | - /** |
4516 | - * Installs the UI. |
4517 | - * |
4518 | - * @see javax.swing.plaf.ComponentUI#installUI(JComponent) |
4519 | - */ |
4520 | - public void installUI(JComponent c) { |
4521 | - super.installUI(c); |
4522 | - embeddedTabs = (Boolean) c.getClientProperty(Options.EMBEDDED_TABS_KEY); |
4523 | - noContentBorder = (Boolean) c.getClientProperty(Options.NO_CONTENT_BORDER_KEY); |
4524 | - } |
4525 | - |
4526 | - |
4527 | - /** |
4528 | - * Checks and answers if content border will be painted. |
4529 | - * This is controlled by the component's client property |
4530 | - * Options.NO_CONTENT_BORDER or Options.EMBEDDED. |
4531 | - */ |
4532 | - private boolean hasNoContentBorder() { |
4533 | - return hasEmbeddedTabs() || Boolean.TRUE.equals(noContentBorder); |
4534 | - } |
4535 | - |
4536 | - /** |
4537 | - * Checks and answers if tabs are painted with minimal decoration. |
4538 | - */ |
4539 | - private boolean hasEmbeddedTabs() { |
4540 | - return embeddedTabs == null |
4541 | - ? false |
4542 | - : embeddedTabs.booleanValue(); |
4543 | - } |
4544 | - |
4545 | - /** |
4546 | - * Creates and answer a handler that listens to property changes. |
4547 | - * Unlike the superclass BasicTabbedPane, the PlasticTabbedPaneUI |
4548 | - * uses an extended Handler. |
4549 | - */ |
4550 | - protected PropertyChangeListener createPropertyChangeListener() { |
4551 | - return new MyPropertyChangeHandler(); |
4552 | - } |
4553 | - |
4554 | - private void doLayout() { |
4555 | - tabPane.revalidate(); |
4556 | - tabPane.repaint(); |
4557 | - } |
4558 | - |
4559 | - /** |
4560 | - * Updates the embedded tabs property. This message is sent by |
4561 | - * my PropertyChangeHandler whenever the embedded tabs property changes. |
4562 | - */ |
4563 | - private void embeddedTabsPropertyChanged(Boolean newValue) { |
4564 | - embeddedTabs = newValue; |
4565 | - doLayout(); |
4566 | - } |
4567 | - |
4568 | - /** |
4569 | - * Updates the no content border property. This message is sent |
4570 | - * by my PropertyChangeHandler whenever the noContentBorder |
4571 | - * property changes. |
4572 | - */ |
4573 | - private void noContentBorderPropertyChanged(Boolean newValue) { |
4574 | - noContentBorder = newValue; |
4575 | - doLayout(); |
4576 | - } |
4577 | - |
4578 | - |
4579 | - |
4580 | - /** |
4581 | - * Answers the icon for the tab with the specified index. |
4582 | - * In case, we have globally switched of the use tab icons, |
4583 | - * we answer <code>null</code> if and only if we have a title. |
4584 | - */ |
4585 | - protected Icon getIconForTab(int tabIndex) { |
4586 | - String title = tabPane.getTitleAt(tabIndex); |
4587 | - boolean hasTitle = (title != null) && (title.length() > 0); |
4588 | - return !isTabIconsEnabled && hasTitle |
4589 | - ? null |
4590 | - : super.getIconForTab(tabIndex); |
4591 | - } |
4592 | - |
4593 | - protected Insets getContentBorderInsets(int tabPlacement) { |
4594 | - if (!hasNoContentBorder()) { |
4595 | - if (IS_XP_LAF_5_OR_LATER) { |
4596 | - switch (tabPlacement) { |
4597 | - case RIGHT : |
4598 | - return CONTENT_BORDER_EAST_INSETS; |
4599 | - case LEFT : |
4600 | - return CONTENT_BORDER_WEST_INSETS; |
4601 | - case TOP : |
4602 | - return CONTENT_BORDER_NORTH_INSETS; |
4603 | - case BOTTOM : |
4604 | - default : |
4605 | - return CONTENT_BORDER_SOUTH_INSETS; |
4606 | - } |
4607 | - } |
4608 | - return contentBorderInsets; |
4609 | - } else if (hasEmbeddedTabs()) { |
4610 | - return EMPTY_INSETS; |
4611 | - } else { |
4612 | - switch (tabPlacement) { |
4613 | - case RIGHT : |
4614 | - return NO_CONTENT_BORDER_EAST_INSETS; |
4615 | - case LEFT : |
4616 | - return NO_CONTENT_BORDER_WEST_INSETS; |
4617 | - case TOP : |
4618 | - return NO_CONTENT_BORDER_NORTH_INSETS; |
4619 | - case BOTTOM : |
4620 | - default : |
4621 | - return NO_CONTENT_BORDER_SOUTH_INSETS; |
4622 | - } |
4623 | - } |
4624 | - } |
4625 | - |
4626 | - protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) { |
4627 | - switch (tabPlacement) { |
4628 | - case RIGHT : |
4629 | - return isSelected ? 2 : 0; |
4630 | - case LEFT : |
4631 | - return isSelected ? -2 : 0; |
4632 | - case TOP : |
4633 | - case BOTTOM : |
4634 | - default : |
4635 | - return 0; |
4636 | - } |
4637 | - } |
4638 | - |
4639 | - protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) { |
4640 | - return 0; |
4641 | - } |
4642 | - |
4643 | - protected Insets getSelectedTabPadInsets(int tabPlacement) { |
4644 | - if (hasEmbeddedTabs()) { |
4645 | - return EMPTY_INSETS; |
4646 | - } else if (hasNoContentBorder()) { |
4647 | - int inset = IS_XP_LAF_5_OR_LATER ? 1 : 0; |
4648 | - switch (tabPlacement) { |
4649 | - case LEFT: return new Insets(1, 2, 1, inset); |
4650 | - case RIGHT: return new Insets(1, inset, 1, 2); |
4651 | - case TOP: return new Insets(2, 2, inset, 2); |
4652 | - case BOTTOM: return new Insets(inset, 2, 2, 2); |
4653 | - default: return EMPTY_INSETS; |
4654 | - } |
4655 | - } else { |
4656 | - Insets superInsets = super.getSelectedTabPadInsets(tabPlacement); |
4657 | - int equalized = superInsets.left + superInsets.right / 2; |
4658 | - superInsets.left = superInsets.right = equalized; |
4659 | - return superInsets; |
4660 | - } |
4661 | - } |
4662 | - |
4663 | - |
4664 | - protected Insets getTabAreaInsets(int tabPlacement) { |
4665 | - return hasEmbeddedTabs() |
4666 | - ? /*new Insets(1,1,1,1)*/EMPTY_INSETS |
4667 | - : super.getTabAreaInsets(tabPlacement); |
4668 | - } |
4669 | - |
4670 | - /** |
4671 | - * Paints the top edge of the pane's content border. |
4672 | - */ |
4673 | - protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, |
4674 | - int selectedIndex, |
4675 | - int x, int y, int w, int h) { |
4676 | - if (hasNoContentBorder() && tabPlacement != TOP) { |
4677 | - return; |
4678 | - } |
4679 | - Rectangle selRect = selectedIndex < 0 |
4680 | - ? null |
4681 | - : getTabBounds(selectedIndex, calcRect); |
4682 | - if (tabPlacement != TOP || selectedIndex < 0 || |
4683 | - (selRect.y + selRect.height + 1 < y) || |
4684 | - (selRect.x < x || selRect.x > x + w)) { |
4685 | - // no special case, do the super thing |
4686 | - super.paintContentBorderTopEdge(g, tabPlacement, selectedIndex, x, y, w, h); |
4687 | - } else { |
4688 | - g.setColor(lightHighlight); |
4689 | - g.fillRect(x, y, selRect.x + 1-x, 1); |
4690 | - g.fillRect(selRect.x + selRect.width, y, |
4691 | - x+w-2 -selRect.x-selRect.width, 1); |
4692 | - } |
4693 | - } |
4694 | - |
4695 | - /** |
4696 | - * Paints the bottom edge of the pane's content border. |
4697 | - */ |
4698 | - protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, |
4699 | - int selectedIndex, |
4700 | - int x, int y, int w, int h) { |
4701 | - if (!hasNoContentBorder()) { |
4702 | - Rectangle selRect = selectedIndex < 0 ? null : |
4703 | - getTabBounds(selectedIndex, calcRect); |
4704 | - if (tabPlacement != BOTTOM || selectedIndex < 0 || |
4705 | - (selRect.y - 1 > h + y) || |
4706 | - (selRect.x < x || selRect.x > x + w)) { |
4707 | - // no special case, do the super thing |
4708 | - super.paintContentBorderBottomEdge(g, tabPlacement, selectedIndex, x, y, w, h); |
4709 | - } else { |
4710 | - g.setColor(lightHighlight); |
4711 | - g.fillRect(x,y+h-1,1,1); |
4712 | - g.setColor(shadow); |
4713 | - g.fillRect(x+1, y+h-2, selRect.x - 1-x, 1); |
4714 | - g.fillRect(selRect.x + selRect.width, y+h-2, x+w-2-selRect.x-selRect.width, 1); |
4715 | - g.setColor(darkShadow); |
4716 | - g.fillRect(x, y+h-1, selRect.x - x, 1); |
4717 | - g.fillRect(selRect.x + selRect.width -1, y+h-1, x+w-selRect.x-selRect.width, 1); |
4718 | - } |
4719 | - } else if (!(tabPlacement == BOTTOM)) { |
4720 | - // no content border really means only one content border: |
4721 | - // the one edge that touches the tabs |
4722 | - } else { |
4723 | - g.setColor(shadow); |
4724 | - g.fillRect(x,y+h,w,1); |
4725 | - } |
4726 | - } |
4727 | - |
4728 | - /** |
4729 | - * Paints the left Edge of the pane's content border. |
4730 | - */ |
4731 | - protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, |
4732 | - int selectedIndex, |
4733 | - int x, int y, int w, int h) { |
4734 | - if (!hasNoContentBorder()) { |
4735 | - Rectangle selRect = selectedIndex < 0 ? null : |
4736 | - getTabBounds(selectedIndex, calcRect); |
4737 | - if (tabPlacement != LEFT || selectedIndex < 0 || |
4738 | - (selRect.x + selRect.width + 1 < x) || |
4739 | - (selRect.y < y || selRect.y > y + h)) { |
4740 | - // no special case, do the super thing |
4741 | - super.paintContentBorderLeftEdge(g, tabPlacement, selectedIndex, x, y, w, h); |
4742 | - } else { |
4743 | - g.setColor(lightHighlight); |
4744 | - g.fillRect(x, y, 1, selRect.y + 1 - y); |
4745 | - g.fillRect(x, selRect.y + selRect.height, |
4746 | - 1, y+h-1-selRect.y-selRect.height); |
4747 | - |
4748 | - } |
4749 | - } else if (!(tabPlacement == LEFT)) { |
4750 | - // no content border really means only one content border: |
4751 | - // the one edge that touches the tabs |
4752 | - } else { |
4753 | - g.setColor(shadow); |
4754 | - g.fillRect(x,y,1,h); |
4755 | - } |
4756 | - } |
4757 | - |
4758 | - /** |
4759 | - * Paints the right Edge of the pane's content border. |
4760 | - */ |
4761 | - protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, |
4762 | - int selectedIndex, |
4763 | - int x, int y, int w, int h) { |
4764 | - if (!hasNoContentBorder()) { |
4765 | - Rectangle selRect = selectedIndex < 0 ? null : |
4766 | - getTabBounds(selectedIndex, calcRect); |
4767 | - if (tabPlacement != RIGHT || selectedIndex < 0 || |
4768 | - (selRect.x - 1 > x+w) || |
4769 | - (selRect.y < y || selRect.y > y + h)) { |
4770 | - // no special case, do the super thing |
4771 | - super.paintContentBorderRightEdge(g, tabPlacement, selectedIndex, x, y, w, h); |
4772 | - } else { |
4773 | - g.setColor(lightHighlight); |
4774 | - g.fillRect(x+w-1, y,1,1); |
4775 | - g.setColor(shadow); |
4776 | - g.fillRect(x+w-2, y+1, 1, selRect.y - 1-y); |
4777 | - g.fillRect(x+w-2, selRect.y + selRect.height, |
4778 | - 1, y+h-1-selRect.y- selRect.height); |
4779 | - g.setColor(darkShadow); |
4780 |