本文整理了Java中javax.swing.JMenuItem.getHeight()
方法的一些代码示例,展示了JMenuItem.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.getHeight()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:getHeight
暂无
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = HEIGHT_JSDOC)
@Override
public int getHeight() {
return super.getHeight();
}
代码示例来源:origin: net.sf.nimrod/nimrod-laf
public void paintIcon( Component c, Graphics g, int x, int y ) {
JMenuItem b = (JMenuItem) c;
g.setColor( NimRODUtils.getRolloverColor());
g.fillRect( 0,0, 22,b.getHeight());
g.setColor( NimRODUtils.getSombra());
g.drawLine( 22,0, 22,b.getHeight());
g.setColor( NimRODUtils.getBrillo());
g.drawLine( 23,0, 23,b.getHeight());
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
if (menuItem.isOpaque()) {
int w = menuItem.getWidth();
int h = menuItem.getHeight();
paintBackground(g, menuItem, 0, 0, w, h);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
if (menuItem.isOpaque()) {
int w = menuItem.getWidth();
int h = menuItem.getHeight();
paintBackground(g, menuItem, 0, 0, w, h);
}
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Draws the background of the menu item.
*
* @param g the paint graphics
* @param menuItem menu item to be painted
* @param bgColor selection background color
* @since 1.4
*/
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
if (menuItem.isOpaque()) {
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(bgColor);
g.fillRect(0, 0, menuWidth, menuHeight);
}
else {
g.setColor(menuItem.getBackground());
g.fillRect(0, 0, menuWidth, menuHeight);
}
g.setColor(oldColor);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/** Draws the background of the menu item
*
* @param g The paint graphics
* @param menuItem Menu item to be painted
* @param bgColor Selection background color
*/
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
{
ButtonModel model= menuItem.getModel();
Color oldColor= g.getColor();
int menuWidth= menuItem.getWidth();
int menuHeight= menuItem.getHeight();
if (menuItem.isOpaque())
{
g.setColor(menuItem.getBackground());
g.fillRect(0, 0, menuWidth, menuHeight);
if (model.isArmed()
|| (menuItem instanceof JMenu && model.isSelected()))
{
g.setColor(bgColor);
g.fillRect(1, 1, menuWidth-2, menuHeight-2);
}
g.setColor(oldColor);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
public void mouseReleased(MouseEvent e)
{
MenuSelectionManager manager= MenuSelectionManager.defaultManager();
Point p= e.getPoint();
if (p.x >= 0
&& p.x < menuItem.getWidth()
&& p.y >= 0
&& p.y < menuItem.getHeight())
{
doClick(manager);
}
else
{
manager.processMouseEvent(e);
}
}
public void mouseEntered(MouseEvent e)
代码示例来源:origin: com.jidesoft/jide-oss
public void mouseReleased(MouseEvent e) {
if (menuItem != null && menuItem.isEnabled()) {
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
doClick(manager);
}
else {
manager.processMouseEvent(e);
}
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) {
Point p = e.getPoint();
if (p.x >= 0 && p.x < item.getWidth() &&
p.y >= 0 && p.y < item.getHeight()) {
if (e.getID() == MouseEvent.MOUSE_RELEASED) {
manager.clearSelectedPath();
item.doClick(0);
}
else
manager.setSelectedPath(path);
}
else if (item.getModel().isArmed()) {
MenuElement newPath[] = new MenuElement[path.length - 1];
int i, c;
for (i = 0, c = path.length - 1; i < c; i++)
newPath[i] = path[i];
manager.setSelectedPath(newPath);
}
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public void mouseReleased(MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e)) {
return;
}
if (menuItem != null && menuItem.isEnabled()) {
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
doClick(manager);
}
else {
manager.processMouseEvent(e);
}
}
}
代码示例来源:origin: khuxtable/seaglass
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) {
Point p = e.getPoint();
if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) {
if (e.getID() == MouseEvent.MOUSE_RELEASED) {
manager.clearSelectedPath();
item.doClick(0);
} else {
manager.setSelectedPath(path);
}
} else if (item.getModel().isArmed()) {
int c = path.length - 1;
MenuElement newPath[] = new MenuElement[c];
for (int i = 0; i < c; i++) {
newPath[i] = path[i];
}
manager.setSelectedPath(newPath);
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public void mouseReleased(MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e)) {
return;
}
if (menuItem != null && menuItem.isEnabled()) {
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
doClick(manager);
}
else {
manager.processMouseEvent(e);
}
}
}
代码示例来源:origin: khuxtable/seaglass
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) {
Point p = e.getPoint();
if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) {
if (e.getID() == MouseEvent.MOUSE_RELEASED) {
manager.clearSelectedPath();
item.doClick(0);
item.setArmed(false);
} else
manager.setSelectedPath(path);
} else if (item.getModel().isArmed()) {
MenuElement newPath[] = new MenuElement[path.length - 1];
int i, c;
for (i = 0, c = path.length - 1; i < c; i++)
newPath[i] = path[i];
manager.setSelectedPath(newPath);
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) {
Point p = e.getPoint();
if (p.x >= 0 && p.x < item.getWidth() &&
p.y >= 0 && p.y < item.getHeight()) {
if (e.getID() == MouseEvent.MOUSE_RELEASED) {
manager.clearSelectedPath();
item.doClick(0);
item.setArmed(false);
}
else
manager.setSelectedPath(path);
}
else if (item.getModel().isArmed()) {
MenuElement newPath[] = new MenuElement[path.length - 1];
int i, c;
for (i = 0, c = path.length - 1; i < c; i++)
newPath[i] = path[i];
manager.setSelectedPath(newPath);
}
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public void menuDragMouseReleased(MenuDragMouseEvent e) {
if (menuItem != null && menuItem.isEnabled()) {
MenuSelectionManager manager = e.getMenuSelectionManager();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
doClick(manager);
}
else {
manager.clearSelectedPath();
}
}
}
}
代码示例来源:origin: khuxtable/seaglass
public static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon,
String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) {
JMenuItem mi = (JMenuItem) context.getComponent();
SynthStyle style = context.getStyle();
g.setFont(style.getFont(context));
Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
boolean leftToRight = SeaGlassLookAndFeel.isLeftToRight(mi);
applyInsets(viewRect, mi.getInsets(), leftToRight);
SeaGlassMenuItemLayoutHelper lh = new SeaGlassMenuItemLayoutHelper(context, accContext, mi, checkIcon, arrowIcon, viewRect,
defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix);
MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();
paintMenuItem(g, lh, lr);
}
代码示例来源:origin: com.jidesoft/jide-oss
public void menuDragMouseReleased(MenuDragMouseEvent e) {
if (menuItem != null && menuItem.isEnabled()) {
MenuSelectionManager manager = e.getMenuSelectionManager();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
doClick(manager);
}
else {
manager.clearSelectedPath();
}
}
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public void menuDragMouseReleased(MenuDragMouseEvent e) {
if (menuItem != null && menuItem.isEnabled()) {
MenuSelectionManager manager = e.getMenuSelectionManager();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
doClick(manager);
}
else {
manager.clearSelectedPath();
}
}
}
}
代码示例来源:origin: com.jidesoft/jide-oss
protected void paintArrow(JMenuItem menuItem, Graphics g) {
int menuWidth;
int menuHeight;
int orientation = JideSwingUtilities.getOrientationOf(menuItem);
if (orientation == SwingConstants.HORIZONTAL) {
menuWidth = menuItem.getWidth();
menuHeight = menuItem.getHeight();
}
else {
menuWidth = menuItem.getHeight();
menuHeight = menuItem.getWidth();
}
int startX;
if (menuItem.getComponentOrientation().isLeftToRight()) {
startX = menuWidth - 9;
}
else {
startX = 4;
}
if (menuItem.isEnabled()) {
JideSwingUtilities.paintArrow(g, getForegroundOfState(menuItem), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
}
else {
JideSwingUtilities.paintArrow(g, UIDefaultsLookup.getColor("controlShadow"), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
public void menuDragMouseReleased(MenuDragMouseEvent e)
{
MenuSelectionManager manager= e.getMenuSelectionManager();
MenuElement path[]= e.getPath();
Point p= e.getPoint();
if (p.x >= 0
&& p.x < menuItem.getWidth()
&& p.y >= 0
&& p.y < menuItem.getHeight())
{
doClick(manager);
}
else
{
manager.clearSelectedPath();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!