| 1 |
/* |
| 2 |
* @(#)VsnetRadioButtonMenuItemUI.java |
| 3 |
* |
| 4 |
* Copyright 2002 JIDE Software Inc. All rights reserved. |
| 5 |
*/ |
| 6 |
|
| 7 |
package com.jidesoft.plaf.eclipse; |
| 8 |
|
| 9 |
import javax.swing.*; |
| 10 |
import javax.swing.plaf.ComponentUI; |
| 11 |
import java.awt.*; |
| 12 |
import java.awt.event.MouseEvent; |
| 13 |
|
| 14 |
/** |
| 15 |
* RadioButtonMenuItem UI implementation |
| 16 |
*/ |
| 17 |
public class EclipseRadioButtonMenuItemUI extends EclipseMenuItemUI { |
| 18 |
public static ComponentUI createUI(JComponent b) { |
| 19 |
return new EclipseRadioButtonMenuItemUI(); |
| 20 |
} |
| 21 |
|
| 22 |
@Override |
| 23 |
protected String getPropertyPrefix() { |
| 24 |
return "RadioButtonMenuItem"; |
| 25 |
} |
| 26 |
|
| 27 |
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) { |
| 28 |
Point p = e.getPoint(); |
| 29 |
if (p.x >= 0 && p.x < item.getWidth() && |
| 30 |
p.y >= 0 && p.y < item.getHeight()) { |
| 31 |
if (e.getID() == MouseEvent.MOUSE_RELEASED) { |
| 32 |
manager.clearSelectedPath(); |
| 33 |
item.doClick(0); |
| 34 |
item.setArmed(false); |
| 35 |
} |
| 36 |
else |
| 37 |
manager.setSelectedPath(path); |
| 38 |
} |
| 39 |
else if (item.getModel().isArmed()) { |
| 40 |
MenuElement newPath[] = new MenuElement[path.length - 1]; |
| 41 |
int i, c; |
| 42 |
for (i = 0, c = path.length - 1; i < c; i++) |
| 43 |
newPath[i] = path[i]; |
| 44 |
manager.setSelectedPath(newPath); |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|