|
|
@ -3,285 +3,341 @@ package com.fr.design.gui.imenu; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.Action; |
|
|
|
|
|
|
|
import javax.swing.JButton; |
|
|
|
|
|
|
|
import javax.swing.JMenu; |
|
|
|
|
|
|
|
import javax.swing.JMenuItem; |
|
|
|
|
|
|
|
import javax.swing.JPopupMenu; |
|
|
|
|
|
|
|
import javax.swing.MenuElement; |
|
|
|
import javax.swing.border.Border; |
|
|
|
import javax.swing.border.Border; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
|
|
|
import java.awt.Insets; |
|
|
|
|
|
|
|
import java.awt.RenderingHints; |
|
|
|
|
|
|
|
import java.awt.Shape; |
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @author null |
|
|
|
|
|
|
|
*/ |
|
|
|
public class UIMenu extends JMenu { |
|
|
|
public class UIMenu extends JMenu { |
|
|
|
private static final float REC = 8f; |
|
|
|
private static final float REC = 8f; |
|
|
|
private JPopupMenu popupMenu; |
|
|
|
private JPopupMenu popupMenu; |
|
|
|
|
|
|
|
|
|
|
|
public UIMenu(String name) { |
|
|
|
public UIMenu(String name) { |
|
|
|
super(name); |
|
|
|
super(name); |
|
|
|
setName(name); |
|
|
|
setName(name); |
|
|
|
setRolloverEnabled(true); |
|
|
|
setRolloverEnabled(true); |
|
|
|
setBackground(UIConstants.NORMAL_BACKGROUND); |
|
|
|
setBackground(UIConstants.NORMAL_BACKGROUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String getText() { |
|
|
|
public String getText() { |
|
|
|
if (this.getParent() instanceof JPopupMenu) { |
|
|
|
if (this.getParent() instanceof JPopupMenu) { |
|
|
|
return StringUtils.BLANK + super.getText(); |
|
|
|
return StringUtils.BLANK + super.getText(); |
|
|
|
} |
|
|
|
} |
|
|
|
return " " + super.getText(); |
|
|
|
return " " + super.getText(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JPopupMenu getPopupMenu() { |
|
|
|
@Override |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
public JPopupMenu getPopupMenu() { |
|
|
|
popupMenu.setOpaque(false); |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
popupMenu.setBorder(new Border() { |
|
|
|
popupMenu.setOpaque(false); |
|
|
|
|
|
|
|
popupMenu.setBorder(new Border() { |
|
|
|
@Override |
|
|
|
|
|
|
|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { |
|
|
|
@Override |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { |
|
|
|
int rec = (int) REC; |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); |
|
|
|
int rec = (int) REC; |
|
|
|
g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR); |
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); |
|
|
|
g2d.drawRoundRect(x, y, width - 1, height - 1,rec, rec); |
|
|
|
g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR); |
|
|
|
if (!(UIMenu.this.getParent() instanceof JPopupMenu)) { |
|
|
|
g2d.drawRoundRect(x, y, width - 1, height - 1, rec, rec); |
|
|
|
g.setColor(UIConstants.NORMAL_BACKGROUND); |
|
|
|
if (!(UIMenu.this.getParent() instanceof JPopupMenu)) { |
|
|
|
g.drawLine(1, 0, UIMenu.this.getWidth() - 2, 0); |
|
|
|
g.setColor(UIConstants.NORMAL_BACKGROUND); |
|
|
|
} |
|
|
|
g.drawLine(1, 0, UIMenu.this.getWidth() - 2, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean isBorderOpaque() { |
|
|
|
@Override |
|
|
|
return false; |
|
|
|
public boolean isBorderOpaque() { |
|
|
|
} |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
public Insets getBorderInsets(Component c) { |
|
|
|
@Override |
|
|
|
return new Insets(5, 2, 10, 10); |
|
|
|
public Insets getBorderInsets(Component c) { |
|
|
|
} |
|
|
|
return new Insets(5, 2, 10, 10); |
|
|
|
}); |
|
|
|
} |
|
|
|
return popupMenu; |
|
|
|
}); |
|
|
|
} |
|
|
|
return popupMenu; |
|
|
|
|
|
|
|
} |
|
|
|
protected void ensurePopupMenuCreated() { |
|
|
|
|
|
|
|
if (popupMenu == null) { |
|
|
|
protected void ensurePopupMenuCreated() { |
|
|
|
this.popupMenu = new JPopupMenu() { |
|
|
|
if (popupMenu == null) { |
|
|
|
@Override |
|
|
|
this.popupMenu = new JPopupMenu() { |
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
@Override |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
int rec = (int) REC; |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), REC, REC); |
|
|
|
int rec = (int) REC; |
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), REC, REC); |
|
|
|
g2d.setColor(UIConstants.NORMAL_BACKGROUND); |
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
g2d.fillRoundRect(0, 0, getWidth(), getHeight(), rec, rec); |
|
|
|
g2d.setColor(UIConstants.NORMAL_BACKGROUND); |
|
|
|
g2d.setClip(shape); |
|
|
|
g2d.fillRoundRect(0, 0, getWidth(), getHeight(), rec, rec); |
|
|
|
super.paintComponent(g2d); |
|
|
|
g2d.setClip(shape); |
|
|
|
} |
|
|
|
super.paintComponent(g2d); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
popupMenu.setInvoker(this); |
|
|
|
}; |
|
|
|
|
|
|
|
popupMenu.setInvoker(this); |
|
|
|
popupListener = createWinListener(popupMenu); |
|
|
|
|
|
|
|
} |
|
|
|
popupListener = createWinListener(popupMenu); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
*画界面 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 画界面 |
|
|
|
@Override |
|
|
|
*/ |
|
|
|
public void updateUI() { |
|
|
|
@Override |
|
|
|
setUI(new UIMenuUI()); |
|
|
|
public void updateUI() { |
|
|
|
} |
|
|
|
setUI(new UIMenuUI()); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 判断popupmeu是否隐藏 |
|
|
|
/** |
|
|
|
* @return 如果隐藏 返回true |
|
|
|
* 判断popupmeu是否隐藏 |
|
|
|
*/ |
|
|
|
* |
|
|
|
public boolean isPopupMenuVisible() { |
|
|
|
* @return 如果隐藏 返回true |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
*/ |
|
|
|
return popupMenu.isVisible(); |
|
|
|
@Override |
|
|
|
} |
|
|
|
public boolean isPopupMenuVisible() { |
|
|
|
|
|
|
|
ensurePopupMenuCreated(); |
|
|
|
|
|
|
|
return popupMenu.isVisible(); |
|
|
|
/** |
|
|
|
} |
|
|
|
* 设置popupmenu位置 |
|
|
|
|
|
|
|
* @param x |
|
|
|
|
|
|
|
* @param y |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 设置popupmenu位置 |
|
|
|
public void setMenuLocation(int x, int y) { |
|
|
|
* |
|
|
|
super.setMenuLocation(x, y); |
|
|
|
* @param x x |
|
|
|
if (popupMenu != null) { |
|
|
|
* @param y y |
|
|
|
popupMenu.setLocation(x, y); |
|
|
|
*/ |
|
|
|
} |
|
|
|
@Override |
|
|
|
} |
|
|
|
public void setMenuLocation(int x, int y) { |
|
|
|
|
|
|
|
super.setMenuLocation(x, y); |
|
|
|
/** |
|
|
|
if (popupMenu != null) { |
|
|
|
* 向popupmenu添加 JMenuItem |
|
|
|
popupMenu.setLocation(x, y); |
|
|
|
* @param menuItem 菜单项 |
|
|
|
} |
|
|
|
* @return 菜单项 |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public JMenuItem add(JMenuItem menuItem) { |
|
|
|
/** |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
* 向popupmenu添加 JMenuItem |
|
|
|
return popupMenu.add(menuItem); |
|
|
|
* |
|
|
|
} |
|
|
|
* @param menuItem 菜单项 |
|
|
|
|
|
|
|
* @return 菜单项 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 添加组件 |
|
|
|
@Override |
|
|
|
* @param c 组件 |
|
|
|
public JMenuItem add(JMenuItem menuItem) { |
|
|
|
* @return 组件 |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
*/ |
|
|
|
return popupMenu.add(menuItem); |
|
|
|
public Component add(Component c) { |
|
|
|
} |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
|
|
|
|
popupMenu.add(c); |
|
|
|
/** |
|
|
|
return c; |
|
|
|
* 添加组件 |
|
|
|
} |
|
|
|
* |
|
|
|
|
|
|
|
* @param c 组件 |
|
|
|
/** |
|
|
|
* @return 组件 |
|
|
|
* 向指定位置添加组件 |
|
|
|
*/ |
|
|
|
* @param c 组件 |
|
|
|
@Override |
|
|
|
* @param index 位置 |
|
|
|
public Component add(Component c) { |
|
|
|
* @return 组件 |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
*/ |
|
|
|
popupMenu.add(c); |
|
|
|
public Component add(Component c, int index) { |
|
|
|
return c; |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
} |
|
|
|
popupMenu.add(c, index); |
|
|
|
|
|
|
|
return c; |
|
|
|
/** |
|
|
|
} |
|
|
|
* 向指定位置添加组件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param c 组件 |
|
|
|
/** |
|
|
|
* @param index 位置 |
|
|
|
* 添加分隔符 |
|
|
|
* @return 组件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addSeparator() { |
|
|
|
@Override |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
public Component add(Component c, int index) { |
|
|
|
popupMenu.addSeparator(); |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
} |
|
|
|
popupMenu.add(c, index); |
|
|
|
|
|
|
|
return c; |
|
|
|
/** |
|
|
|
} |
|
|
|
* 添加menuitem到指定位置 |
|
|
|
|
|
|
|
* @param s 字符 |
|
|
|
|
|
|
|
* @param pos 位置 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 添加分隔符 |
|
|
|
public void insert(String s, int pos) { |
|
|
|
*/ |
|
|
|
if (pos < 0) { |
|
|
|
@Override |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
public void addSeparator() { |
|
|
|
} |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
|
|
|
|
popupMenu.addSeparator(); |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
} |
|
|
|
popupMenu.insert(new JMenuItem(s), pos); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 添加menuitem到指定位置 |
|
|
|
/** |
|
|
|
* |
|
|
|
* 添加么会特么到指定位置 |
|
|
|
* @param s 字符 |
|
|
|
* @param mi 菜单项 |
|
|
|
* @param pos 位置 |
|
|
|
* @param pos 位置 |
|
|
|
*/ |
|
|
|
* @return 菜单项 |
|
|
|
@Override |
|
|
|
*/ |
|
|
|
public void insert(String s, int pos) { |
|
|
|
public JMenuItem insert(JMenuItem mi, int pos) { |
|
|
|
if (pos < 0) { |
|
|
|
if (pos < 0) { |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ensurePopupMenuCreated(); |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
popupMenu.insert(mi, pos); |
|
|
|
popupMenu.insert(new JMenuItem(s), pos); |
|
|
|
return mi; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 添加么会特么到指定位置 |
|
|
|
* 添加到指定位置 |
|
|
|
* |
|
|
|
* @param a 事件 |
|
|
|
* @param mi 菜单项 |
|
|
|
* @param pos 位置 |
|
|
|
* @param pos 位置 |
|
|
|
* @return 菜单项 |
|
|
|
* @return 菜单项 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public JMenuItem insert(Action a, int pos) { |
|
|
|
@Override |
|
|
|
if (pos < 0) { |
|
|
|
public JMenuItem insert(JMenuItem mi, int pos) { |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
if (pos < 0) { |
|
|
|
} |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
|
|
|
|
} |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
JMenuItem mi = new JMenuItem(a); |
|
|
|
popupMenu.insert(mi, pos); |
|
|
|
mi.setHorizontalTextPosition(JButton.TRAILING); |
|
|
|
return mi; |
|
|
|
mi.setVerticalTextPosition(JButton.CENTER); |
|
|
|
} |
|
|
|
popupMenu.insert(mi, pos); |
|
|
|
|
|
|
|
return mi; |
|
|
|
/** |
|
|
|
} |
|
|
|
* 添加到指定位置 |
|
|
|
|
|
|
|
* |
|
|
|
/** |
|
|
|
* @param a 事件 |
|
|
|
* 添加分隔符到指定位置 |
|
|
|
* @param pos 位置 |
|
|
|
* @param index 指定位置 |
|
|
|
* @return 菜单项 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void insertSeparator(int index) { |
|
|
|
@Override |
|
|
|
if (index < 0) { |
|
|
|
public JMenuItem insert(Action a, int pos) { |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
if (pos < 0) { |
|
|
|
} |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
|
|
|
|
} |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
popupMenu.insert(new JPopupMenu.Separator(), index); |
|
|
|
JMenuItem mi = new JMenuItem(a); |
|
|
|
} |
|
|
|
mi.setHorizontalTextPosition(JButton.TRAILING); |
|
|
|
|
|
|
|
mi.setVerticalTextPosition(JButton.CENTER); |
|
|
|
|
|
|
|
popupMenu.insert(mi, pos); |
|
|
|
/** |
|
|
|
return mi; |
|
|
|
* 移除 |
|
|
|
} |
|
|
|
* @param item 菜单项 |
|
|
|
|
|
|
|
*/ |
|
|
|
/** |
|
|
|
public void remove(JMenuItem item) { |
|
|
|
* 添加分隔符到指定位置 |
|
|
|
if (popupMenu != null) { |
|
|
|
* |
|
|
|
popupMenu.remove(item); |
|
|
|
* @param index 指定位置 |
|
|
|
} |
|
|
|
*/ |
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
public void insertSeparator(int index) { |
|
|
|
/** |
|
|
|
if (index < 0) { |
|
|
|
* 移除指定位置菜单项 |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
* @param pos 指定位置 |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public void remove(int pos) { |
|
|
|
ensurePopupMenuCreated(); |
|
|
|
if (pos < 0) { |
|
|
|
popupMenu.insert(new JPopupMenu.Separator(), index); |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (pos > getItemCount()) { |
|
|
|
|
|
|
|
throw new IllegalArgumentException("index greater than the number of items."); |
|
|
|
/** |
|
|
|
} |
|
|
|
* 移除 |
|
|
|
if (popupMenu != null) { |
|
|
|
* |
|
|
|
popupMenu.remove(pos); |
|
|
|
* @param item 菜单项 |
|
|
|
} |
|
|
|
*/ |
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
public void remove(JMenuItem item) { |
|
|
|
/** |
|
|
|
if (popupMenu != null) { |
|
|
|
* 移除组件 |
|
|
|
popupMenu.remove(item); |
|
|
|
* @param c 组件 |
|
|
|
} |
|
|
|
*/ |
|
|
|
} |
|
|
|
public void remove(Component c) { |
|
|
|
|
|
|
|
if (popupMenu != null) { |
|
|
|
/** |
|
|
|
popupMenu.remove(c); |
|
|
|
* 移除指定位置菜单项 |
|
|
|
} |
|
|
|
* |
|
|
|
} |
|
|
|
* @param pos 指定位置 |
|
|
|
|
|
|
|
*/ |
|
|
|
/** |
|
|
|
@Override |
|
|
|
* 移除所有 |
|
|
|
public void remove(int pos) { |
|
|
|
*/ |
|
|
|
if (pos < 0) { |
|
|
|
public void removeAll() { |
|
|
|
throw new IllegalArgumentException("index less than zero."); |
|
|
|
if (popupMenu != null) { |
|
|
|
} |
|
|
|
popupMenu.removeAll(); |
|
|
|
if (pos > getItemCount()) { |
|
|
|
} |
|
|
|
throw new IllegalArgumentException("index greater than the number of items."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (popupMenu != null) { |
|
|
|
/** |
|
|
|
popupMenu.remove(pos); |
|
|
|
* 组件总数 |
|
|
|
} |
|
|
|
* @return 组件总数 |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public int getMenuComponentCount() { |
|
|
|
/** |
|
|
|
return (popupMenu == null) ? 0 : popupMenu.getComponentCount(); |
|
|
|
* 移除组件 |
|
|
|
} |
|
|
|
* |
|
|
|
|
|
|
|
* @param c 组件 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 指定位置组件 |
|
|
|
@Override |
|
|
|
* @param n 指定位置 |
|
|
|
public void remove(Component c) { |
|
|
|
* @return 组件 |
|
|
|
if (popupMenu != null) { |
|
|
|
*/ |
|
|
|
popupMenu.remove(c); |
|
|
|
public Component getMenuComponent(int n) { |
|
|
|
} |
|
|
|
return (popupMenu == null) ? null : popupMenu.getComponent(n); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 移除所有 |
|
|
|
* 所有组件 |
|
|
|
*/ |
|
|
|
* @return 所有组件 |
|
|
|
@Override |
|
|
|
*/ |
|
|
|
public void removeAll() { |
|
|
|
public Component[] getMenuComponents() { |
|
|
|
if (popupMenu != null) { |
|
|
|
return (popupMenu == null) ? new Component[0] : popupMenu.getComponents(); |
|
|
|
popupMenu.removeAll(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 组件总数 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 组件总数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int getMenuComponentCount() { |
|
|
|
|
|
|
|
return (popupMenu == null) ? 0 : popupMenu.getComponentCount(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 指定位置组件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param n 指定位置 |
|
|
|
|
|
|
|
* @return 组件 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Component getMenuComponent(int n) { |
|
|
|
|
|
|
|
return (popupMenu == null) ? null : popupMenu.getComponent(n); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 所有组件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 所有组件 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Component[] getMenuComponents() { |
|
|
|
|
|
|
|
return (popupMenu == null) ? new Component[0] : popupMenu.getComponents(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public MenuElement[] getSubElements() { |
|
|
|
|
|
|
|
if (popupMenu == null) { |
|
|
|
|
|
|
|
return new MenuElement[0]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
MenuElement[] result = new MenuElement[1]; |
|
|
|
|
|
|
|
result[0] = popupMenu; |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |