68 |
|
|
69 |
/** A constant representing "light". */ |
/** A constant representing "light". */ |
70 |
public static final boolean LIGHT = true; |
public static final boolean LIGHT = true; |
71 |
|
|
72 |
|
/** A shared instance of the MenuArrowIcon. */ |
73 |
|
private static Icon menuArrow; |
74 |
|
|
75 |
|
/** A shared instance of the MenuItemArrowIcon. */ |
76 |
|
private static Icon menuItemArrow; |
77 |
|
|
78 |
/** |
/** |
79 |
* An icon displayed for {@link JCheckBoxMenuItem} components. |
* An icon displayed for {@link JCheckBoxMenuItem} components. |
2482 |
*/ |
*/ |
2483 |
public static Icon getMenuArrowIcon() |
public static Icon getMenuArrowIcon() |
2484 |
{ |
{ |
2485 |
return new Icon() |
if (menuArrow == null) |
2486 |
{ |
menuArrow = new Icon() |
|
public int getIconHeight() |
|
2487 |
{ |
{ |
2488 |
return 8; |
public int getIconHeight() |
2489 |
} |
{ |
2490 |
|
return 8; |
2491 |
|
} |
2492 |
|
|
2493 |
public int getIconWidth() |
public int getIconWidth() |
2494 |
{ |
{ |
2495 |
return 4; |
return 4; |
2496 |
} |
} |
2497 |
|
|
2498 |
public void paintIcon(Component c, Graphics g, int x, int y) |
public void paintIcon(Component c, Graphics g, int x, int y) |
2499 |
{ |
{ |
2500 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
2501 |
g.setColor(Color.BLACK); |
g.setColor(Color.BLACK); |
2502 |
for (int i = 0; i < 4; i++) |
for (int i = 0; i < 4; i++) |
2503 |
g.drawLine(x + i, y + i, x + i, y + 7 - i); |
g.drawLine(x + i, y + i, x + i, y + 7 - i); |
2504 |
g.setColor(saved); |
g.setColor(saved); |
2505 |
} |
} |
2506 |
}; |
}; |
2507 |
|
return menuArrow; |
2508 |
} |
} |
2509 |
|
|
2510 |
/** |
/** |
2511 |
* Returns a new instance of a 4 x 8 icon showing a small black triangle that |
* Returns a new instance of a 4 x 8 icon showing a small black triangle that |
2512 |
* points to the right. This is displayed in menu items that have a |
* points to the right. This is displayed in menu items that have a sub menu. |
|
* sub menu. |
|
2513 |
* |
* |
2514 |
* @return The icon. |
* @return The icon. |
2515 |
*/ |
*/ |
2516 |
public static Icon getMenuItemArrowIcon() |
public static Icon getMenuItemArrowIcon() |
2517 |
{ |
{ |
2518 |
return getMenuArrowIcon(); |
if (menuItemArrow == null) |
2519 |
|
menuItemArrow = new Icon() |
2520 |
|
{ |
2521 |
|
public int getIconHeight() |
2522 |
|
{ |
2523 |
|
return 8; |
2524 |
|
} |
2525 |
|
|
2526 |
|
public int getIconWidth() |
2527 |
|
{ |
2528 |
|
return 4; |
2529 |
|
} |
2530 |
|
|
2531 |
|
public void paintIcon(Component c, Graphics g, int x, int y) |
2532 |
|
{ |
2533 |
|
Color saved = g.getColor(); |
2534 |
|
g.setColor(Color.BLACK); |
2535 |
|
for (int i = 0; i < 4; i++) |
2536 |
|
g.drawLine(x + i, y + i, x + i, y + 7 - i); |
2537 |
|
g.setColor(saved); |
2538 |
|
} |
2539 |
|
}; |
2540 |
|
return menuItemArrow; |
2541 |
} |
} |
2542 |
|
|
2543 |
/** |
/** |