/[debian]/libjgoodies-looks-java/trunk/debian/patches/02_windows.dpatch
ViewVC logotype

Contents of /libjgoodies-looks-java/trunk/debian/patches/02_windows.dpatch

Parent Directory Parent Directory | Revision Log Revision Log


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