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