01: /*
02: * @(#)VsnetRadioButtonMenuItemUI.java
03: *
04: * Copyright 2002 JIDE Software Inc. All rights reserved.
05: */
06:
07: package com.jidesoft.plaf.eclipse;
08:
09: 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,
28: MenuElement path[], MenuSelectionManager manager) {
29: Point p = e.getPoint();
30: if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0
31: && p.y < item.getHeight()) {
32: if (e.getID() == MouseEvent.MOUSE_RELEASED) {
33: manager.clearSelectedPath();
34: item.doClick(0);
35: item.setArmed(false);
36: } else
37: manager.setSelectedPath(path);
38: } else if (item.getModel().isArmed()) {
39: MenuElement newPath[] = new MenuElement[path.length - 1];
40: int i, c;
41: for (i = 0, c = path.length - 1; i < c; i++)
42: newPath[i] = path[i];
43: manager.setSelectedPath(newPath);
44: }
45: }
46: }
|