44 |
import java.io.Serializable; |
import java.io.Serializable; |
45 |
|
|
46 |
import javax.swing.Icon; |
import javax.swing.Icon; |
47 |
|
import javax.swing.JCheckBox; |
48 |
|
import javax.swing.JCheckBoxMenuItem; |
49 |
|
import javax.swing.JInternalFrame; |
50 |
import javax.swing.JRadioButton; |
import javax.swing.JRadioButton; |
51 |
|
import javax.swing.JRadioButtonMenuItem; |
52 |
import javax.swing.JSlider; |
import javax.swing.JSlider; |
53 |
import javax.swing.plaf.UIResource; |
import javax.swing.plaf.UIResource; |
54 |
|
|
55 |
|
|
56 |
/** |
/** |
57 |
* Creates icons for the {@link MetalLookAndFeel}. |
* Creates icons for the {@link MetalLookAndFeel}. |
58 |
*/ |
*/ |
66 |
public static final boolean LIGHT = true; |
public static final boolean LIGHT = true; |
67 |
|
|
68 |
/** |
/** |
69 |
|
* An icon displayed for {@link JCheckBoxMenuItem} components. |
70 |
|
*/ |
71 |
|
private static class CheckBoxMenuItemIcon implements Icon, Serializable |
72 |
|
{ |
73 |
|
/** |
74 |
|
* Creates a new icon instance. |
75 |
|
*/ |
76 |
|
public CheckBoxMenuItemIcon() |
77 |
|
{ |
78 |
|
} |
79 |
|
|
80 |
|
/** |
81 |
|
* Returns the width of the icon, in pixels. |
82 |
|
* |
83 |
|
* @return The width of the icon (10 pixels). |
84 |
|
*/ |
85 |
|
public int getIconWidth() |
86 |
|
{ |
87 |
|
return 10; |
88 |
|
} |
89 |
|
|
90 |
|
/** |
91 |
|
* Returns the height of the icon, in pixels. |
92 |
|
* |
93 |
|
* @return The height of the icon (10 pixels). |
94 |
|
*/ |
95 |
|
public int getIconHeight() |
96 |
|
{ |
97 |
|
return 10; |
98 |
|
} |
99 |
|
|
100 |
|
/** |
101 |
|
* Paints the icon. |
102 |
|
* |
103 |
|
* @param c the component. |
104 |
|
* @param g the graphics device. |
105 |
|
* @param x the x-coordinate. |
106 |
|
* @param y the y-coordinate. |
107 |
|
*/ |
108 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
109 |
|
{ |
110 |
|
JCheckBoxMenuItem item = (JCheckBoxMenuItem) c; |
111 |
|
|
112 |
|
if (item.isArmed()) |
113 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
114 |
|
else |
115 |
|
g.setColor(MetalLookAndFeel.getControlDarkShadow()); |
116 |
|
g.drawLine(x, y, x + 8, y); |
117 |
|
g.drawLine(x, y + 1, x, y + 8); |
118 |
|
g.drawLine(x + 2, y + 8, x + 8, y + 8); |
119 |
|
g.drawLine(x + 8, y + 2, x + 8, y + 7); |
120 |
|
|
121 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
122 |
|
g.drawLine(x + 1, y + 1, x + 7, y + 1); |
123 |
|
g.drawLine(x + 1, y + 2, x + 1, y + 7); |
124 |
|
g.drawLine(x + 1, y + 9, x + 9, y + 9); |
125 |
|
g.drawLine(x + 9, y + 1, x + 9, y + 8); |
126 |
|
|
127 |
|
// if the item is selected, we should draw a tick |
128 |
|
if (item.isSelected()) |
129 |
|
{ |
130 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
131 |
|
g.fillRect(x + 2, y + 2, 2, 5); |
132 |
|
for (int i = 0; i < 6; i++) |
133 |
|
g.drawLine(x + 8 - i, y + i, x + 9 - i, y + i); |
134 |
|
} |
135 |
|
|
136 |
|
} |
137 |
|
} |
138 |
|
|
139 |
|
/** |
140 |
* An icon representing a file (drawn as a piece of paper with the top-right |
* An icon representing a file (drawn as a piece of paper with the top-right |
141 |
* corner turned down). |
* corner turned down). |
142 |
*/ |
*/ |
295 |
static class RadioButtonIcon |
static class RadioButtonIcon |
296 |
implements Icon, UIResource, Serializable |
implements Icon, UIResource, Serializable |
297 |
{ |
{ |
|
/** |
|
|
* Draws the check in the RadioButton. |
|
|
* |
|
|
* @param c the component to draw on |
|
|
* @param g the Graphics context to draw with |
|
|
*/ |
|
|
protected void drawCheck(Component c, Graphics g) |
|
|
{ |
|
|
g.setColor(MetalLookAndFeel.getBlack()); |
|
|
g.fillRect(4, 3, 4, 6); |
|
|
g.drawLine(3, 4, 3, 7); |
|
|
g.drawLine(8, 4, 8, 7); |
|
|
} |
|
298 |
|
|
299 |
/** |
/** |
300 |
* Returns the width of the icon in pixels. |
* Returns the width of the icon in pixels. |
317 |
} |
} |
318 |
|
|
319 |
/** |
/** |
320 |
* Paints the icon. This first paints the border of the RadioButton and |
* Paints the icon, taking into account whether or not the component is |
321 |
* if the CheckBox is selected it calls {@link #drawCheck} to draw |
* enabled, selected and/or armed. |
|
* the check. |
|
322 |
* |
* |
323 |
* @param c the Component to draw on (gets casted to JCheckBox) |
* @param c the Component to draw on (must be an instance of |
324 |
|
* {@link JRadioButton}) |
325 |
* @param g the Graphics context to draw with |
* @param g the Graphics context to draw with |
326 |
* @param x the X position |
* @param x the X position |
327 |
* @param y the Y position |
* @param y the Y position |
328 |
*/ |
*/ |
329 |
public void paintIcon(Component c, Graphics g, int x, int y) |
public void paintIcon(Component c, Graphics g, int x, int y) |
330 |
{ |
{ |
331 |
Color dark = MetalLookAndFeel.getControlDarkShadow(); |
Color savedColor = g.getColor(); |
332 |
Color light = MetalLookAndFeel.getWhite(); |
JRadioButton b = (JRadioButton) c; |
333 |
g.translate(x, y); |
|
334 |
|
// draw outer circle |
335 |
// The light 'circle' |
if (b.isEnabled()) |
336 |
g.setColor(light); |
g.setColor(MetalLookAndFeel.getControlDarkShadow()); |
337 |
g.drawLine(4, 1, 10, 1); |
else |
338 |
g.drawLine(2, 2, 3, 2); |
g.setColor(MetalLookAndFeel.getControlDisabled()); |
339 |
g.drawLine(8, 2, 11, 2); |
g.drawLine(x + 2, y + 1, x + 3, y + 1); |
340 |
g.drawLine(2, 3, 2, 3); |
g.drawLine(x + 4, y, x + 7, y); |
341 |
g.drawLine(11, 2, 11, 9); |
g.drawLine(x + 8, y + 1, x + 9, y + 1); |
342 |
g.drawLine(1, 4, 1, 7); |
g.drawLine(x + 10, y + 2, x + 10, y + 3); |
343 |
g.drawLine(12, 4, 12, 7); |
g.drawLine(x + 11, y + 4, x + 11, y + 7); |
344 |
g.drawLine(2, 8, 2, 11); |
g.drawLine(x + 10, y + 8, x + 10, y + 9); |
345 |
g.drawLine(11, 8, 11, 9); |
g.drawLine(x + 8, y + 10, x + 9, y + 10); |
346 |
g.drawLine(10, 10, 10, 10); |
g.drawLine(x + 4, y + 11, x + 7, y + 11); |
347 |
g.drawLine(2, 11, 9, 11); |
g.drawLine(x + 2, y + 10, x + 3, y + 10); |
348 |
g.drawLine(4, 12, 7, 12); |
g.drawLine(x + 1, y + 9, x + 1, y + 8); |
349 |
|
g.drawLine(x, y + 7, x, y + 4); |
350 |
// The dark 'circle' |
g.drawLine(x + 1, y + 2, x + 1, y + 3); |
351 |
g.setColor(dark); |
|
352 |
g.drawLine(4, 0, 7, 0); |
if (b.getModel().isArmed()) |
353 |
g.drawLine(2, 1, 3, 1); |
{ |
354 |
g.drawLine(8, 1, 9, 1); |
g.setColor(MetalLookAndFeel.getControlShadow()); |
355 |
g.drawLine(1, 2, 1, 3); |
g.drawLine(x + 4, y + 1, x + 7, y + 1); |
356 |
g.drawLine(10, 2, 10, 3); |
g.drawLine(x + 4, y + 10, x + 7, y + 10); |
357 |
g.drawLine(0, 4, 0, 7); |
g.drawLine(x + 1, y + 4, x + 1, y + 7); |
358 |
g.drawLine(11, 4, 11, 7); |
g.drawLine(x + 10, y + 4, x + 10, y + 7); |
359 |
g.drawLine(1, 8, 1, 9); |
g.fillRect(x + 2, y + 2, 8, 8); |
360 |
g.drawLine(10, 8, 10, 9); |
} |
361 |
g.drawLine(2, 10, 3, 10); |
else |
362 |
g.drawLine(8, 10, 9, 10); |
{ |
363 |
g.drawLine(4, 11, 7, 11); |
// only draw inner highlight if not filled |
364 |
|
if (b.isEnabled()) |
365 |
JRadioButton rb = (JRadioButton) c; |
{ |
366 |
if (rb.isSelected()) |
g.setColor(MetalLookAndFeel.getWhite()); |
367 |
drawCheck(c, g); |
|
368 |
|
g.drawLine(x + 2, y + 8, x + 2, y + 9); |
369 |
|
g.drawLine(x + 1, y + 4, x + 1, y + 7); |
370 |
|
g.drawLine(x + 2, y + 2, x + 2, y + 3); |
371 |
|
g.drawLine(x + 3, y + 2, x + 3, y + 2); |
372 |
|
g.drawLine(x + 4, y + 1, x + 7, y + 1); |
373 |
|
g.drawLine(x + 8, y + 2, x + 9, y + 2); |
374 |
|
} |
375 |
|
} |
376 |
|
|
377 |
|
// draw outer highlight |
378 |
|
if (b.isEnabled()) |
379 |
|
{ |
380 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
381 |
|
|
382 |
|
// outer |
383 |
|
g.drawLine(x + 10, y + 1, x + 10, y + 1); |
384 |
|
g.drawLine(x + 11, y + 2, x + 11, y + 3); |
385 |
|
g.drawLine(x + 12, y + 4, x + 12, y + 7); |
386 |
|
g.drawLine(x + 11, y + 8, x + 11, y + 9); |
387 |
|
g.drawLine(x + 10, y + 10, x + 10, y + 10); |
388 |
|
g.drawLine(x + 8, y + 11, x + 9, y + 11); |
389 |
|
g.drawLine(x + 4, y + 12, x + 7, y + 12); |
390 |
|
g.drawLine(x + 2, y + 11, x + 3, y + 11); |
391 |
|
} |
392 |
|
|
393 |
|
if (b.isSelected()) |
394 |
|
{ |
395 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
396 |
|
g.drawLine(x + 4, y + 3, x + 7, y + 3); |
397 |
|
g.fillRect(x + 3, y + 4, 6, 4); |
398 |
|
g.drawLine(x + 4, y + 8, x + 7, y + 8); |
399 |
|
} |
400 |
|
g.setColor(savedColor); |
401 |
|
} |
402 |
|
} |
403 |
|
|
404 |
g.translate(-x, -y); |
/** |
405 |
|
* An icon displayed for {@link JRadioButtonMenuItem} components. |
406 |
|
*/ |
407 |
|
private static class RadioButtonMenuItemIcon |
408 |
|
implements Icon, Serializable |
409 |
|
{ |
410 |
|
/** |
411 |
|
* Creates a new icon instance. |
412 |
|
*/ |
413 |
|
public RadioButtonMenuItemIcon() |
414 |
|
{ |
415 |
|
} |
416 |
|
|
417 |
|
/** |
418 |
|
* Returns the width of the icon, in pixels. |
419 |
|
* |
420 |
|
* @return The width of the icon. |
421 |
|
*/ |
422 |
|
public int getIconWidth() |
423 |
|
{ |
424 |
|
return 10; |
425 |
|
} |
426 |
|
|
427 |
|
/** |
428 |
|
* Returns the height of the icon, in pixels. |
429 |
|
* |
430 |
|
* @return The height of the icon. |
431 |
|
*/ |
432 |
|
public int getIconHeight() |
433 |
|
{ |
434 |
|
return 10; |
435 |
} |
} |
|
} |
|
436 |
|
|
437 |
/** |
/** |
438 |
|
* Paints the icon. |
439 |
|
* |
440 |
|
* @param c the component. |
441 |
|
* @param g the graphics device. |
442 |
|
* @param x the x-coordinate. |
443 |
|
* @param y the y-coordinate. |
444 |
|
*/ |
445 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
446 |
|
{ |
447 |
|
Color savedColor = g.getColor(); |
448 |
|
JRadioButtonMenuItem item = (JRadioButtonMenuItem) c; |
449 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
450 |
|
g.drawLine(x + 2, y, x + 6, y); |
451 |
|
g.drawLine(x + 7, y + 1, x + 7, y + 1); |
452 |
|
g.drawLine(x + 8, y + 2, x + 8, y + 6); |
453 |
|
g.drawLine(x + 7, y + 7, x + 7, y + 7); |
454 |
|
g.drawLine(x + 2, y + 8, x + 6, y + 8); |
455 |
|
g.drawLine(x + 1, y + 7, x + 1, y + 7); |
456 |
|
g.drawLine(x, y + 2, x, y + 6); |
457 |
|
g.drawLine(x + 1, y + 1, x + 1, y + 1); |
458 |
|
|
459 |
|
if (item.isSelected()) |
460 |
|
{ |
461 |
|
g.drawLine(x + 3, y + 2, x + 5, y + 2); |
462 |
|
g.fillRect(x + 2, y + 3, 5, 3); |
463 |
|
g.drawLine(x + 3, y + 6, x + 5, y + 6); |
464 |
|
} |
465 |
|
|
466 |
|
// highlight |
467 |
|
g.setColor(MetalLookAndFeel.getControlHighlight()); |
468 |
|
g.drawLine(x + 3, y + 1, x + 6, y + 1); |
469 |
|
g.drawLine(x + 8, y + 1, x + 8, y + 1); |
470 |
|
g.drawLine(x + 9, y + 2, x + 9, y + 7); |
471 |
|
g.drawLine(x + 8, y + 8, x + 8, y + 8); |
472 |
|
g.drawLine(x + 2, y + 9, x + 7, y + 9); |
473 |
|
g.drawLine(x + 1, y + 8, x + 1, y + 8); |
474 |
|
g.drawLine(x + 1, y + 3, x + 1, y + 6); |
475 |
|
g.drawLine(x + 2, y + 2, x + 2, y + 2); |
476 |
|
g.setColor(savedColor); |
477 |
|
} |
478 |
|
} |
479 |
|
|
480 |
|
/** |
481 |
* The icon used to display the thumb control on a horizontally oriented |
* The icon used to display the thumb control on a horizontally oriented |
482 |
* {@link JSlider} component. |
* {@link JSlider} component. |
483 |
*/ |
*/ |
523 |
*/ |
*/ |
524 |
public void paintIcon(Component c, Graphics g, int x, int y) |
public void paintIcon(Component c, Graphics g, int x, int y) |
525 |
{ |
{ |
526 |
|
boolean enabled = false; |
527 |
boolean focus = false; |
boolean focus = false; |
528 |
if (c != null) |
if (c != null) |
529 |
focus = c.hasFocus(); |
{ |
530 |
// TODO: pick up the colors from the look and feel |
enabled = c.isEnabled(); |
531 |
|
focus = c.hasFocus(); |
532 |
|
} |
533 |
|
|
534 |
// draw the outline |
// draw the outline |
535 |
g.setColor(Color.black); |
if (enabled) |
536 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
537 |
|
else |
538 |
|
g.setColor(MetalLookAndFeel.getControlDarkShadow()); |
539 |
g.drawLine(x + 1, y, x + 13, y); |
g.drawLine(x + 1, y, x + 13, y); |
540 |
g.drawLine(x + 14, y + 1, x + 14, y + 7); |
g.drawLine(x + 14, y + 1, x + 14, y + 7); |
541 |
g.drawLine(x + 14, y + 8, x + 7, y + 15); |
g.drawLine(x + 14, y + 8, x + 7, y + 15); |
543 |
g.drawLine(x, y + 7, x, y + 1); |
g.drawLine(x, y + 7, x, y + 1); |
544 |
|
|
545 |
// fill the icon |
// fill the icon |
546 |
g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium |
if (focus) |
547 |
g.fillRect(x + 2, y + 2, 12, 7); |
g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); |
548 |
|
else |
549 |
|
g.setColor(MetalLookAndFeel.getControl()); |
550 |
|
g.fillRect(x + 1, y + 2, 13, 7); |
551 |
g.drawLine(x + 2, y + 9, x + 12, y + 9); |
g.drawLine(x + 2, y + 9, x + 12, y + 9); |
552 |
g.drawLine(x + 3, y + 10, x + 11, y + 10); |
g.drawLine(x + 3, y + 10, x + 11, y + 10); |
553 |
g.drawLine(x + 4, y + 11, x + 10, y + 11); |
g.drawLine(x + 4, y + 11, x + 10, y + 11); |
555 |
g.drawLine(x + 6, y + 13, x + 8, y + 13); |
g.drawLine(x + 6, y + 13, x + 8, y + 13); |
556 |
g.drawLine(x + 7, y + 14, x + 7, y + 14); |
g.drawLine(x + 7, y + 14, x + 7, y + 14); |
557 |
|
|
558 |
// draw highlights |
// if the slider is enabled, draw dots and highlights |
559 |
g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light |
if (c.isEnabled()) |
560 |
g.drawLine(x + 1, y + 1, x + 13, y + 1); |
{ |
561 |
g.drawLine(x + 1, y + 2, x + 1, y + 8); |
if (focus) |
562 |
g.drawLine(x + 2, y + 2, x + 2, y + 2); |
g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); |
563 |
g.drawLine(x + 6, y + 2, x + 6, y + 2); |
else |
564 |
g.drawLine(x + 10, y + 2, x + 10, y + 2); |
g.setColor(MetalLookAndFeel.getBlack()); |
565 |
|
g.drawLine(x + 3, y + 3, x + 3, y + 3); |
566 |
g.drawLine(x + 4, y + 4, x + 4, y + 4); |
g.drawLine(x + 7, y + 3, x + 7, y + 3); |
567 |
g.drawLine(x + 8, y + 4, x + 8, y + 4); |
g.drawLine(x + 11, y + 3, x + 11, y + 3); |
568 |
|
|
569 |
|
g.drawLine(x + 5, y + 5, x + 5, y + 5); |
570 |
|
g.drawLine(x + 9, y + 5, x + 9, y + 5); |
571 |
|
|
572 |
|
g.drawLine(x + 3, y + 7, x + 3, y + 7); |
573 |
|
g.drawLine(x + 7, y + 7, x + 7, y + 7); |
574 |
|
g.drawLine(x + 11, y + 7, x + 11, y + 7); |
575 |
|
|
576 |
|
// draw highlights |
577 |
|
if (focus) |
578 |
|
g.setColor(MetalLookAndFeel.getPrimaryControl()); |
579 |
|
else |
580 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
581 |
|
g.drawLine(x + 1, y + 1, x + 13, y + 1); |
582 |
|
g.drawLine(x + 1, y + 2, x + 1, y + 8); |
583 |
|
g.drawLine(x + 2, y + 2, x + 2, y + 2); |
584 |
|
g.drawLine(x + 6, y + 2, x + 6, y + 2); |
585 |
|
g.drawLine(x + 10, y + 2, x + 10, y + 2); |
586 |
|
|
587 |
|
g.drawLine(x + 4, y + 4, x + 4, y + 4); |
588 |
|
g.drawLine(x + 8, y + 4, x + 8, y + 4); |
589 |
|
|
590 |
|
g.drawLine(x + 2, y + 6, x + 2, y + 6); |
591 |
|
g.drawLine(x + 6, y + 6, x + 6, y + 6); |
592 |
|
g.drawLine(x + 10, y + 6, x + 10, y + 6); |
593 |
|
} |
594 |
|
|
595 |
g.drawLine(x + 2, y + 6, x + 2, y + 6); |
} |
596 |
g.drawLine(x + 6, y + 6, x + 6, y + 6); |
} |
597 |
g.drawLine(x + 10, y + 6, x + 10, y + 6); |
|
598 |
|
/** |
599 |
|
* An icon used for the 'close' button in the title frame of a |
600 |
|
* {@link JInternalFrame}. |
601 |
|
*/ |
602 |
|
private static class InternalFrameCloseIcon implements Icon, Serializable |
603 |
|
{ |
604 |
|
/** The icon size in pixels. */ |
605 |
|
private int size; |
606 |
|
|
607 |
|
/** |
608 |
|
* Creates a new icon. |
609 |
|
* |
610 |
|
* @param size the icon size (width and height) in pixels. |
611 |
|
*/ |
612 |
|
public InternalFrameCloseIcon(int size) |
613 |
|
{ |
614 |
|
this.size = size; |
615 |
|
} |
616 |
|
|
617 |
|
/** |
618 |
|
* Returns the width of the icon, in pixels. |
619 |
|
* |
620 |
|
* @return The width of the icon. |
621 |
|
*/ |
622 |
|
public int getIconWidth() |
623 |
|
{ |
624 |
|
return size; |
625 |
|
} |
626 |
|
|
627 |
|
/** |
628 |
|
* Returns the height of the icon, in pixels. |
629 |
|
* |
630 |
|
* @return The height of the icon. |
631 |
|
*/ |
632 |
|
public int getIconHeight() |
633 |
|
{ |
634 |
|
return size; |
635 |
|
} |
636 |
|
|
637 |
|
/** |
638 |
|
* Paints the icon. |
639 |
|
* |
640 |
|
* @param c the component. |
641 |
|
* @param g the graphics device. |
642 |
|
* @param x the x-coordinate. |
643 |
|
* @param y the y-coordinate. |
644 |
|
*/ |
645 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
646 |
|
{ |
647 |
|
// draw the gray areas first |
648 |
|
g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); |
649 |
|
g.drawLine(x + 1, y + 1, x + 13, y + 1); |
650 |
|
g.drawLine(x + 1, y + 2, x + 1, y + 12); |
651 |
|
g.drawLine(x + 1, y + 13, x + 13, y + 13); |
652 |
|
g.drawLine(x + 13, y + 2, x + 13, y + 12); |
653 |
|
|
654 |
|
g.fillRect(x + 4, y + 4, 2, 2); |
655 |
|
g.fillRect(x + 4, y + 9, 2, 2); |
656 |
|
g.fillRect(x + 9, y + 4, 2, 2); |
657 |
|
g.fillRect(x + 9, y + 9, 2, 2); |
658 |
|
g.fillRect(x + 5, y + 5, 5, 5); |
659 |
|
|
660 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
661 |
|
g.drawLine(x, y, x + 13, y); |
662 |
|
g.drawLine(x, y + 1, x, y + 13); |
663 |
|
g.drawLine(x + 3, y + 4, x + 4, y + 3); |
664 |
|
g.drawLine(x + 3, y + 9, x + 5, y + 7); |
665 |
|
g.drawLine(x + 7, y + 5, x + 9, y + 3); |
666 |
|
|
667 |
|
g.drawLine(x + 12, y + 3, x + 12, y + 11); |
668 |
|
g.drawLine(x + 3, y + 12, x + 12, y + 12); |
669 |
|
|
670 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
671 |
|
g.drawLine(x + 1, y + 14, x + 14, y + 14); |
672 |
|
g.drawLine(x + 14, y + 1, x + 14, y + 14); |
673 |
|
|
674 |
|
g.drawLine(x + 5, y + 10, x + 5, y + 10); |
675 |
|
g.drawLine(x + 6, y + 9, x + 7, y + 9); |
676 |
|
g.drawLine(x + 10, y + 5, x + 10, y + 5); |
677 |
|
g.drawLine(x + 9, y + 6, x + 9, y + 7); |
678 |
|
g.drawLine(x + 10, y + 10, x + 11, y + 10); |
679 |
|
g.drawLine(x + 10, y + 11, x + 10, y + 11); |
680 |
|
} |
681 |
|
} |
682 |
|
|
683 |
// draw dots |
/** |
684 |
g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark |
* The icon displayed at the top-left corner of a {@link JInternalFrame}. |
685 |
|
*/ |
686 |
|
private static class InternalFrameDefaultMenuIcon |
687 |
|
implements Icon, Serializable |
688 |
|
{ |
689 |
|
|
690 |
|
/** |
691 |
|
* Creates a new instance. |
692 |
|
*/ |
693 |
|
public InternalFrameDefaultMenuIcon() |
694 |
|
{ |
695 |
|
} |
696 |
|
|
697 |
|
/** |
698 |
|
* Returns the width of the icon, in pixels. |
699 |
|
* |
700 |
|
* @return The width of the icon. |
701 |
|
*/ |
702 |
|
public int getIconWidth() |
703 |
|
{ |
704 |
|
return 16; |
705 |
|
} |
706 |
|
|
707 |
|
/** |
708 |
|
* Returns the height of the icon, in pixels. |
709 |
|
* |
710 |
|
* @return The height of the icon. |
711 |
|
*/ |
712 |
|
public int getIconHeight() |
713 |
|
{ |
714 |
|
return 16; |
715 |
|
} |
716 |
|
|
717 |
|
/** |
718 |
|
* Paints the icon at the specified location. |
719 |
|
* |
720 |
|
* @param c the component. |
721 |
|
* @param g the graphics device. |
722 |
|
* @param x the x coordinate. |
723 |
|
* @param y the y coordinate. |
724 |
|
*/ |
725 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
726 |
|
{ |
727 |
|
g.setColor(new Color(102, 102, 153)); |
728 |
|
g.fillRect(x + 1, y, 14, 2); |
729 |
|
g.fillRect(x, y + 1, 2, 14); |
730 |
|
g.fillRect(x + 1, y + 14, 14, 2); |
731 |
|
g.fillRect(x + 14, y + 1, 2, 14); |
732 |
|
g.drawLine(x + 2, y + 5, x + 14, y + 5); |
733 |
|
|
734 |
|
g.setColor(new Color(204, 204, 255)); |
735 |
|
g.fillRect(x + 2, y + 2, 12, 3); |
736 |
|
|
737 |
|
g.setColor(new Color(102, 102, 153)); |
738 |
g.drawLine(x + 3, y + 3, x + 3, y + 3); |
g.drawLine(x + 3, y + 3, x + 3, y + 3); |
739 |
g.drawLine(x + 7, y + 3, x + 7, y + 3); |
g.drawLine(x + 6, y + 3, x + 6, y + 3); |
740 |
g.drawLine(x + 11, y + 3, x + 11, y + 3); |
g.drawLine(x + 9, y + 3, x + 9, y + 3); |
741 |
|
g.drawLine(x + 12, y + 3, x + 12, y + 3); |
|
g.drawLine(x + 5, y + 5, x + 5, y + 5); |
|
|
g.drawLine(x + 9, y + 5, x + 9, y + 5); |
|
742 |
|
|
743 |
g.drawLine(x + 3, y + 7, x + 3, y + 7); |
g.setColor(Color.white); |
744 |
g.drawLine(x + 7, y + 7, x + 7, y + 7); |
g.fillRect(x + 2, y + 6, 12, 8); |
745 |
g.drawLine(x + 11, y + 7, x + 11, y + 7); |
g.drawLine(x + 2, y + 2, x + 2, y + 2); |
746 |
|
g.drawLine(x + 5, y + 2, x + 5, y + 2); |
747 |
|
g.drawLine(x + 8, y + 2, x + 8, y + 2); |
748 |
|
g.drawLine(x + 11, y + 2, x + 11, y + 2); |
749 |
|
} |
750 |
|
} |
751 |
|
|
752 |
|
/** |
753 |
|
* An icon used in the title frame of a {@link JInternalFrame}. When you |
754 |
|
* maximise an internal frame, this icon will replace the 'maximise' icon to |
755 |
|
* provide a 'restore' option. |
756 |
|
*/ |
757 |
|
private static class InternalFrameAltMaximizeIcon |
758 |
|
implements Icon, Serializable |
759 |
|
{ |
760 |
|
/** The icon size in pixels. */ |
761 |
|
private int size; |
762 |
|
|
763 |
|
/** |
764 |
|
* Creates a new icon. |
765 |
|
* |
766 |
|
* @param size the icon size in pixels. |
767 |
|
*/ |
768 |
|
public InternalFrameAltMaximizeIcon(int size) |
769 |
|
{ |
770 |
|
this.size = size; |
771 |
|
} |
772 |
|
|
773 |
|
/** |
774 |
|
* Returns the width of the icon, in pixels. |
775 |
|
* |
776 |
|
* @return The width of the icon. |
777 |
|
*/ |
778 |
|
public int getIconWidth() |
779 |
|
{ |
780 |
|
return size; |
781 |
|
} |
782 |
|
|
783 |
|
/** |
784 |
|
* Returns the height of the icon, in pixels. |
785 |
|
* |
786 |
|
* @return The height of the icon. |
787 |
|
*/ |
788 |
|
public int getIconHeight() |
789 |
|
{ |
790 |
|
return size; |
791 |
|
} |
792 |
|
|
793 |
|
/** |
794 |
|
* Paints the icon at the specified location. |
795 |
|
* |
796 |
|
* @param c the component. |
797 |
|
* @param g the graphics device. |
798 |
|
* @param x the x coordinate. |
799 |
|
* @param y the y coordinate. |
800 |
|
*/ |
801 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
802 |
|
{ |
803 |
|
Color color = MetalLookAndFeel.getControlDarkShadow(); |
804 |
|
if (c instanceof JInternalFrame) |
805 |
|
{ |
806 |
|
JInternalFrame f = (JInternalFrame) c; |
807 |
|
if (f.isSelected()) |
808 |
|
color = MetalLookAndFeel.getPrimaryControlShadow(); |
809 |
|
} |
810 |
|
g.setColor(color); |
811 |
|
g.drawLine(x + 12, y + 1, x + 13, y + 1); |
812 |
|
g.drawLine(x + 11, y + 2, x + 12, y + 2); |
813 |
|
g.drawLine(x + 10, y + 3, x + 11, y + 3); |
814 |
|
g.drawLine(x + 8, y + 2, x + 8, y + 3); |
815 |
|
g.fillRect(x + 8, y + 4, 3, 3); |
816 |
|
g.drawLine(x + 11, y + 6, x + 12, y + 6); |
817 |
|
|
818 |
|
g.drawLine(x + 1, y + 5, x + 5, y + 5); |
819 |
|
g.drawLine(x + 1, y + 6, x + 1, y + 12); |
820 |
|
g.drawLine(x + 9, y + 9, x + 9, y + 12); |
821 |
|
g.drawLine(x + 1, y + 13, x + 9, y + 13); |
822 |
|
|
823 |
|
g.drawLine(x + 2, y + 12, x + 2, y + 12); |
824 |
|
|
825 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
826 |
|
g.drawLine(x + 12, y, x + 9, y + 3); |
827 |
|
g.drawLine(x + 7, y + 1, x + 8, y + 1); |
828 |
|
g.drawLine(x + 7, y + 2, x + 7, y + 6); |
829 |
|
g.drawLine(x + 11, y + 5, x + 12, y + 5); |
830 |
|
g.drawLine(x, y + 4, x + 5, y + 4); |
831 |
|
g.drawLine(x, y + 5, x, y + 13); |
832 |
|
g.drawLine(x + 3, y + 12, x + 8, y + 12); |
833 |
|
g.drawLine(x + 8, y + 8, x + 8, y + 11); |
834 |
|
g.drawLine(x + 9, y + 8, x + 9, y + 8); |
835 |
|
|
836 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
837 |
|
g.drawLine(x + 9, y + 2, x + 9, y + 2); |
838 |
|
g.drawLine(x + 11, y + 4, x + 13, y + 2); |
839 |
|
g.drawLine(x + 13, y + 6, x + 13, y + 6); |
840 |
|
g.drawLine(x + 8, y + 7, x + 13, y + 7); |
841 |
|
g.drawLine(x + 6, y + 5, x + 6, y + 5); |
842 |
|
g.drawLine(x + 2, y + 6, x + 6, y + 6); |
843 |
|
g.drawLine(x + 2, y + 6, x + 2, y + 11); |
844 |
|
g.drawLine(x + 10, y + 8, x + 10, y + 13); |
845 |
|
g.drawLine(x + 1, y + 14, x + 10, y + 14); |
846 |
} |
} |
847 |
} |
} |
848 |
|
|
849 |
/** |
/** |
850 |
|
* An icon used for the 'maximize' button in the title frame of a |
851 |
|
* {@link JInternalFrame}. |
852 |
|
*/ |
853 |
|
private static class InternalFrameMaximizeIcon |
854 |
|
implements Icon, Serializable |
855 |
|
{ |
856 |
|
|
857 |
|
/** |
858 |
|
* Creates a new instance. |
859 |
|
*/ |
860 |
|
public InternalFrameMaximizeIcon() |
861 |
|
{ |
862 |
|
} |
863 |
|
|
864 |
|
/** |
865 |
|
* Returns the width of the icon, in pixels. |
866 |
|
* |
867 |
|
* @return The width of the icon. |
868 |
|
*/ |
869 |
|
public int getIconWidth() |
870 |
|
{ |
871 |
|
return 16; |
872 |
|
} |
873 |
|
|
874 |
|
/** |
875 |
|
* Returns the height of the icon, in pixels. |
876 |
|
* |
877 |
|
* @return The height of the icon. |
878 |
|
*/ |
879 |
|
public int getIconHeight() |
880 |
|
{ |
881 |
|
return 16; |
882 |
|
} |
883 |
|
|
884 |
|
/** |
885 |
|
* Paints the icon at the specified location. |
886 |
|
* |
887 |
|
* @param c the component. |
888 |
|
* @param g the graphics device. |
889 |
|
* @param x the x coordinate. |
890 |
|
* @param y the y coordinate. |
891 |
|
*/ |
892 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
893 |
|
{ |
894 |
|
Color color = MetalLookAndFeel.getControlDarkShadow(); |
895 |
|
if (c instanceof JInternalFrame) |
896 |
|
{ |
897 |
|
JInternalFrame f = (JInternalFrame) c; |
898 |
|
if (f.isSelected()) |
899 |
|
color = MetalLookAndFeel.getPrimaryControlShadow(); |
900 |
|
} |
901 |
|
g.setColor(color); |
902 |
|
g.drawLine(x + 9, y + 1, x + 10, y + 1); |
903 |
|
g.fillRect(x + 11, y + 1, 3, 3); |
904 |
|
g.fillRect(x + 12, y + 4, 2, 2); |
905 |
|
g.drawLine(x + 10, y + 3, x + 10, y + 3); |
906 |
|
g.drawLine(x + 9, y + 4, x + 10, y + 4); |
907 |
|
g.drawLine(x + 1, y + 5, x + 9, y + 5); |
908 |
|
g.drawLine(x + 1, y + 6, x + 1, y + 12); |
909 |
|
g.drawLine(x + 9, y + 6, x + 9, y + 12); |
910 |
|
g.drawLine(x + 1, y + 13, x + 9, y + 13); |
911 |
|
|
912 |
|
// fill |
913 |
|
g.drawLine(x + 7, y + 6, x + 8, y + 6); |
914 |
|
g.drawLine(x + 6, y + 7, x + 8, y + 7); |
915 |
|
g.drawLine(x + 5, y + 8, x + 6, y + 8); |
916 |
|
g.drawLine(x + 4, y + 9, x + 5, y + 9); |
917 |
|
g.drawLine(x + 3, y + 10, x + 4, y + 10); |
918 |
|
g.drawLine(x + 2, y + 11, x + 3, y + 11); |
919 |
|
g.drawLine(x + 2, y + 12, x + 4, y + 12); |
920 |
|
g.drawLine(x + 8, y + 8, x + 8, y + 8); |
921 |
|
|
922 |
|
// draw black |
923 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
924 |
|
g.drawLine(x + 8, y, x + 13, y); |
925 |
|
g.drawLine(x + 8, y + 1, x + 8, y + 1); |
926 |
|
g.drawLine(x + 10, y + 2, x + 9, y + 3); |
927 |
|
g.drawLine(x, y + 4, x + 8, y + 4); |
928 |
|
g.drawLine(x, y + 5, x, y + 13); |
929 |
|
|
930 |
|
g.drawLine(x + 2, y + 10, x + 6, y + 6); |
931 |
|
g.drawLine(x + 8, y + 9, x + 8, y + 11); |
932 |
|
g.drawLine(x + 5, y + 12, x + 8, y + 12); |
933 |
|
|
934 |
|
// draw white |
935 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
936 |
|
g.drawLine(x + 2, y + 6, x + 5, y + 6); |
937 |
|
g.drawLine(x + 2, y + 7, x + 2, y + 9); |
938 |
|
g.drawLine(x + 4, y + 11, x + 7, y + 8); |
939 |
|
|
940 |
|
g.drawLine(x + 1, y + 14, x + 10, y + 14); |
941 |
|
g.drawLine(x + 10, y + 5, x + 10, y + 13); |
942 |
|
|
943 |
|
g.drawLine(x + 9, y + 2, x + 9, y + 2); |
944 |
|
g.drawLine(x + 11, y + 4, x + 11, y + 5); |
945 |
|
g.drawLine(x + 13, y + 6, x + 14, y + 6); |
946 |
|
g.drawLine(x + 14, y + 1, x + 14, y + 5); |
947 |
|
} |
948 |
|
} |
949 |
|
|
950 |
|
/** |
951 |
|
* An icon used in the title frame of a {@link JInternalFrame}. |
952 |
|
*/ |
953 |
|
private static class InternalFrameMinimizeIcon |
954 |
|
implements Icon, Serializable |
955 |
|
{ |
956 |
|
|
957 |
|
/** |
958 |
|
* Creates a new instance. |
959 |
|
*/ |
960 |
|
public InternalFrameMinimizeIcon() |
961 |
|
{ |
962 |
|
} |
963 |
|
|
964 |
|
/** |
965 |
|
* Returns the width of the icon, in pixels. |
966 |
|
* |
967 |
|
* @return The width of the icon. |
968 |
|
*/ |
969 |
|
public int getIconWidth() |
970 |
|
{ |
971 |
|
return 16; |
972 |
|
} |
973 |
|
|
974 |
|
/** |
975 |
|
* Returns the height of the icon, in pixels. |
976 |
|
* |
977 |
|
* @return The height of the icon. |
978 |
|
*/ |
979 |
|
public int getIconHeight() |
980 |
|
{ |
981 |
|
return 16; |
982 |
|
} |
983 |
|
|
984 |
|
/** |
985 |
|
* Paints the icon at the specified location. |
986 |
|
* |
987 |
|
* @param c the component. |
988 |
|
* @param g the graphics device. |
989 |
|
* @param x the x coordinate. |
990 |
|
* @param y the y coordinate. |
991 |
|
*/ |
992 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
993 |
|
{ |
994 |
|
Color color = MetalLookAndFeel.getControlDarkShadow(); |
995 |
|
if (c instanceof JInternalFrame) |
996 |
|
{ |
997 |
|
JInternalFrame f = (JInternalFrame) c; |
998 |
|
if (f.isSelected()) |
999 |
|
color = MetalLookAndFeel.getPrimaryControlShadow(); |
1000 |
|
} |
1001 |
|
g.setColor(color); |
1002 |
|
g.drawLine(x + 12, y + 1, x + 13, y + 1); |
1003 |
|
g.drawLine(x + 11, y + 2, x + 12, y + 2); |
1004 |
|
g.drawLine(x + 10, y + 3, x + 11, y + 3); |
1005 |
|
g.drawLine(x + 8, y + 2, x + 8, y + 3); |
1006 |
|
g.fillRect(x + 8, y + 4, 3, 3); |
1007 |
|
g.drawLine(x + 11, y + 6, x + 12, y + 6); |
1008 |
|
|
1009 |
|
g.drawLine(x + 1, y + 8, x + 6, y + 8); |
1010 |
|
g.drawLine(x + 1, y + 9, x + 1, y + 12); |
1011 |
|
g.drawLine(x + 6, y + 9, x + 6, y + 12); |
1012 |
|
g.drawLine(x + 1, y + 13, x + 6, y + 13); |
1013 |
|
|
1014 |
|
g.drawLine(x + 5, y + 9, x + 5, y + 9); |
1015 |
|
g.drawLine(x + 2, y + 12, x + 2, y + 12); |
1016 |
|
|
1017 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
1018 |
|
g.drawLine(x + 12, y, x + 9, y + 3); |
1019 |
|
g.drawLine(x + 7, y + 1, x + 8, y + 1); |
1020 |
|
g.drawLine(x + 7, y + 2, x + 7, y + 6); |
1021 |
|
g.drawLine(x, y + 7, x + 6, y + 7); |
1022 |
|
g.drawLine(x, y + 8, x, y + 13); |
1023 |
|
g.drawLine(x + 3, y + 12, x + 5, y + 12); |
1024 |
|
g.drawLine(x + 5, y + 10, x + 5, y + 11); |
1025 |
|
g.drawLine(x + 11, y + 5, x + 12, y + 5); |
1026 |
|
|
1027 |
|
g.setColor(MetalLookAndFeel.getWhite()); |
1028 |
|
g.drawLine(x + 9, y + 2, x + 9, y + 2); |
1029 |
|
g.drawLine(x + 11, y + 4, x + 13, y + 2); |
1030 |
|
g.drawLine(x + 13, y + 6, x + 13, y + 6); |
1031 |
|
g.drawLine(x + 8, y + 7, x + 13, y + 7); |
1032 |
|
g.drawLine(x + 2, y + 9, x + 4, y + 9); |
1033 |
|
g.drawLine(x + 2, y + 10, x + 2, y + 11); |
1034 |
|
g.drawLine(x + 7, y + 9, x + 7, y + 13); |
1035 |
|
g.drawLine(x + 1, y + 14, x + 7, y + 14); |
1036 |
|
} |
1037 |
|
} |
1038 |
|
|
1039 |
|
/** |
1040 |
* The icon used to display the thumb control on a horizontally oriented |
* The icon used to display the thumb control on a horizontally oriented |
1041 |
* {@link JSlider} component. |
* {@link JSlider} component. |
1042 |
*/ |
*/ |
1081 |
*/ |
*/ |
1082 |
public void paintIcon(Component c, Graphics g, int x, int y) |
public void paintIcon(Component c, Graphics g, int x, int y) |
1083 |
{ |
{ |
1084 |
|
boolean enabled = false; |
1085 |
boolean focus = false; |
boolean focus = false; |
1086 |
if (c != null) |
if (c != null) |
1087 |
focus = c.hasFocus(); |
{ |
1088 |
// TODO: pick up the colors from the look and feel |
enabled = c.isEnabled(); |
1089 |
|
focus = c.hasFocus(); |
1090 |
|
} |
1091 |
|
|
1092 |
// draw the outline |
// draw the outline |
1093 |
g.setColor(Color.black); |
if (enabled) |
1094 |
|
g.setColor(MetalLookAndFeel.getBlack()); |
1095 |
|
else |
1096 |
|
g.setColor(MetalLookAndFeel.getControlDarkShadow()); |
1097 |
g.drawLine(x + 1, y, x + 7, y); |
g.drawLine(x + 1, y, x + 7, y); |
1098 |
g.drawLine(x + 8, y, x + 15, y + 7); |
g.drawLine(x + 8, y, x + 15, y + 7); |
1099 |
g.drawLine(x + 14, y + 8, x + 8, y + 14); |
g.drawLine(x + 14, y + 8, x + 8, y + 14); |
1101 |
g.drawLine(x, y + 13, x, y + 1); |
g.drawLine(x, y + 13, x, y + 1); |
1102 |
|
|
1103 |
// fill the icon |
// fill the icon |
1104 |
g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium |
if (focus) |
1105 |
g.fillRect(x + 2, y + 2, 7, 12); |
g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); |
1106 |
|
else |
1107 |
|
g.setColor(MetalLookAndFeel.getControl()); |
1108 |
|
g.fillRect(x + 2, y + 1, 7, 13); |
1109 |
g.drawLine(x + 9, y + 2, x + 9, y + 12); |
g.drawLine(x + 9, y + 2, x + 9, y + 12); |
1110 |
g.drawLine(x + 10, y + 3, x + 10, y + 11); |
g.drawLine(x + 10, y + 3, x + 10, y + 11); |
1111 |
g.drawLine(x + 11, y + 4, x + 11, y + 10); |
g.drawLine(x + 11, y + 4, x + 11, y + 10); |
1113 |
g.drawLine(x + 13, y + 6, x + 13, y + 8); |
g.drawLine(x + 13, y + 6, x + 13, y + 8); |
1114 |
g.drawLine(x + 14, y + 7, x + 14, y + 7); |
g.drawLine(x + 14, y + 7, x + 14, y + 7); |
1115 |
|
|
1116 |
// draw highlights |
// if the slider is enabled, draw dots and highlights |
1117 |
g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light |
if (enabled) |
1118 |
g.drawLine(x + 1, y + 1, x + 8, y + 1); |
{ |
1119 |
g.drawLine(x + 1, y + 2, x + 1, y + 13); |
if (focus) |
1120 |
g.drawLine(x + 2, y + 2, x + 2, y + 2); |
g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); |
1121 |
g.drawLine(x + 2, y + 6, x + 2, y + 6); |
else |
1122 |
g.drawLine(x + 2, y + 10, x + 2, y + 10); |
g.setColor(MetalLookAndFeel.getBlack()); |
1123 |
|
g.drawLine(x + 3, y + 3, x + 3, y + 3); |
1124 |
g.drawLine(x + 4, y + 4, x + 4, y + 4); |
g.drawLine(x + 3, y + 7, x + 3, y + 7); |
1125 |
g.drawLine(x + 4, y + 8, x + 4, y + 8); |
g.drawLine(x + 3, y + 11, x + 3, y + 11); |
1126 |
|
|
1127 |
g.drawLine(x + 6, y + 2, x + 6, y + 2); |
g.drawLine(x + 5, y + 5, x + 5, y + 5); |
1128 |
g.drawLine(x + 6, y + 6, x + 6, y + 6); |
g.drawLine(x + 5, y + 9, x + 5, y + 9); |
1129 |
g.drawLine(x + 6, y + 10, x + 6, y + 10); |
|
1130 |
|
g.drawLine(x + 7, y + 3, x + 7, y + 3); |
1131 |
// draw dots |
g.drawLine(x + 7, y + 7, x + 7, y + 7); |
1132 |
g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark |
g.drawLine(x + 7, y + 11, x + 7, y + 11); |
1133 |
g.drawLine(x + 3, y + 3, x + 3, y + 3); |
|
1134 |
g.drawLine(x + 3, y + 7, x + 3, y + 7); |
// draw highlights |
1135 |
g.drawLine(x + 3, y + 11, x + 3, y + 11); |
if (focus) |
1136 |
|
g.setColor(MetalLookAndFeel.getPrimaryControl()); |
1137 |
g.drawLine(x + 5, y + 5, x + 5, y + 5); |
else |
1138 |
g.drawLine(x + 5, y + 9, x + 5, y + 9); |
g.setColor(MetalLookAndFeel.getWhite()); |
1139 |
|
g.drawLine(x + 1, y + 1, x + 8, y + 1); |
1140 |
g.drawLine(x + 7, y + 3, x + 7, y + 3); |
g.drawLine(x + 1, y + 2, x + 1, y + 13); |
1141 |
g.drawLine(x + 7, y + 7, x + 7, y + 7); |
g.drawLine(x + 2, y + 2, x + 2, y + 2); |
1142 |
g.drawLine(x + 7, y + 11, x + 7, y + 11); |
g.drawLine(x + 2, y + 6, x + 2, y + 6); |
1143 |
|
g.drawLine(x + 2, y + 10, x + 2, y + 10); |
1144 |
|
|
1145 |
|
g.drawLine(x + 4, y + 4, x + 4, y + 4); |
1146 |
|
g.drawLine(x + 4, y + 8, x + 4, y + 8); |
1147 |
|
|
1148 |
|
g.drawLine(x + 6, y + 2, x + 6, y + 2); |
1149 |
|
g.drawLine(x + 6, y + 6, x + 6, y + 6); |
1150 |
|
g.drawLine(x + 6, y + 10, x + 6, y + 10); |
1151 |
|
|
1152 |
|
} |
1153 |
} |
} |
1154 |
} |
} |
1155 |
|
|
1156 |
/** |
/** |
1157 |
* A tree control icon. This icon can be in one of two states: expanded and |
* A tree control icon. This icon can be in one of two states: expanded and |
1158 |
* collapsed. |
* collapsed. |
1365 |
} |
} |
1366 |
|
|
1367 |
/** |
/** |
1368 |
|
* Returns an icon for use when rendering the {@link JCheckBox} component. |
1369 |
|
* |
1370 |
|
* @return A check box icon. |
1371 |
|
* |
1372 |
|
* @since 1.3 |
1373 |
|
*/ |
1374 |
|
public static Icon getCheckBoxIcon() |
1375 |
|
{ |
1376 |
|
return new MetalCheckBoxIcon(); |
1377 |
|
} |
1378 |
|
|
1379 |
|
/** |
1380 |
|
* Returns an icon for use when rendering the {@link JCheckBoxMenuItem} |
1381 |
|
* component. |
1382 |
|
* |
1383 |
|
* @return An icon. |
1384 |
|
*/ |
1385 |
|
public static Icon getCheckBoxMenuItemIcon() |
1386 |
|
{ |
1387 |
|
return new CheckBoxMenuItemIcon(); |
1388 |
|
} |
1389 |
|
|
1390 |
|
/** |
1391 |
* Returns an icon for RadioButtons in the Metal L&F. |
* Returns an icon for RadioButtons in the Metal L&F. |
1392 |
* |
* |
1393 |
* @return an icon for RadioButtons in the Metal L&F |
* @return an icon for RadioButtons in the Metal L&F |
1400 |
} |
} |
1401 |
|
|
1402 |
/** |
/** |
1403 |
|
* Creates a new instance of the icon used in a {@link JRadioButtonMenuItem}. |
1404 |
|
* |
1405 |
|
* @return A new icon instance. |
1406 |
|
*/ |
1407 |
|
public static Icon getRadioButtonMenuItemIcon() |
1408 |
|
{ |
1409 |
|
return new RadioButtonMenuItemIcon(); |
1410 |
|
} |
1411 |
|
|
1412 |
|
/** |
1413 |
* Returns the icon used to display the thumb for a horizontally oriented |
* Returns the icon used to display the thumb for a horizontally oriented |
1414 |
* {@link JSlider}. |
* {@link JSlider}. |
1415 |
* |
* |
1421 |
} |
} |
1422 |
|
|
1423 |
/** |
/** |
1424 |
|
* Creates a new icon used to represent the 'close' button in the title |
1425 |
|
* pane of a {@link JInternalFrame}. |
1426 |
|
* |
1427 |
|
* @param size the icon size. |
1428 |
|
* |
1429 |
|
* @return A close icon. |
1430 |
|
*/ |
1431 |
|
public static Icon getInternalFrameCloseIcon(int size) |
1432 |
|
{ |
1433 |
|
return new InternalFrameCloseIcon(size); |
1434 |
|
} |
1435 |
|
|
1436 |
|
/** |
1437 |
|
* Creates a new icon for the menu in a {@link JInternalFrame}. This is the |
1438 |
|
* icon displayed at the top left of the frame. |
1439 |
|
* |
1440 |
|
* @return A menu icon. |
1441 |
|
*/ |
1442 |
|
public static Icon getInternalFrameDefaultMenuIcon() |
1443 |
|
{ |
1444 |
|
return new InternalFrameDefaultMenuIcon(); |
1445 |
|
} |
1446 |
|
|
1447 |
|
/** |
1448 |
|
* Creates a new icon for the 'maximize' button in a {@link JInternalFrame}. |
1449 |
|
* |
1450 |
|
* @param size the icon size in pixels. |
1451 |
|
* |
1452 |
|
* @return The icon. |
1453 |
|
* |
1454 |
|
* @see #getInternalFrameAltMaximizeIcon(int) |
1455 |
|
*/ |
1456 |
|
public static Icon getInternalFrameMaximizeIcon(int size) |
1457 |
|
{ |
1458 |
|
return new InternalFrameMaximizeIcon(); |
1459 |
|
} |
1460 |
|
|
1461 |
|
/** |
1462 |
|
* Returns the icon used for the minimize button in the frame title for a |
1463 |
|
* {@link JInternalFrame}. |
1464 |
|
* |
1465 |
|
* @param size the icon size in pixels (ignored by this implementation). |
1466 |
|
* |
1467 |
|
* @return The icon. |
1468 |
|
*/ |
1469 |
|
public static Icon getInternalFrameMinimizeIcon(int size) |
1470 |
|
{ |
1471 |
|
return new InternalFrameMinimizeIcon(); |
1472 |
|
} |
1473 |
|
|
1474 |
|
/** |
1475 |
|
* Creates a new icon for the 'restore' button in a {@link JInternalFrame} |
1476 |
|
* that has been maximised. |
1477 |
|
* |
1478 |
|
* @param size the icon size in pixels. |
1479 |
|
* |
1480 |
|
* @return The icon. |
1481 |
|
* |
1482 |
|
* @see #getInternalFrameMaximizeIcon(int) |
1483 |
|
*/ |
1484 |
|
public static Icon getInternalFrameAltMaximizeIcon(int size) |
1485 |
|
{ |
1486 |
|
return new InternalFrameAltMaximizeIcon(size); |
1487 |
|
} |
1488 |
|
|
1489 |
|
/** |
1490 |
* Returns the icon used to display the thumb for a vertically oriented |
* Returns the icon used to display the thumb for a vertically oriented |
1491 |
* {@link JSlider}. |
* {@link JSlider}. |
1492 |
* |
* |