本文整理了Java中javax.swing.JPopupMenu.getWidth()
方法的一些代码示例,展示了JPopupMenu.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPopupMenu.getWidth()
方法的具体详情如下:
包路径:javax.swing.JPopupMenu
类名称:JPopupMenu
方法名:getWidth
暂无
代码示例来源:origin: ron190/jsql-injection
@Override
public void mouseReleased(MouseEvent evt) {
if (evt.isPopupTrigger()) {
// Fix #45348: IllegalComponentStateException on show()
try {
menu.show(evt.getComponent(), evt.getX(), evt.getY());
} catch (IllegalComponentStateException e) {
LOGGER.error(e, e);
}
menu.setLocation(
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? evt.getXOnScreen() - menu.getWidth()
: evt.getXOnScreen(),
evt.getYOnScreen()
);
}
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void mousePressed(MouseEvent e) {
popup.applyComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));
if (ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT) {
radioCustomMethod.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 6));
} else {
radioCustomMethod.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
}
popup.show(
e.getComponent(),
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? e.getComponent().getX() - e.getComponent().getWidth() - popup.getWidth()
: e.getComponent().getX(),
e.getComponent().getY() + e.getComponent().getWidth()
);
popup.setLocation(
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? e.getComponent().getLocationOnScreen().x + e.getComponent().getWidth() - popup.getWidth()
: e.getComponent().getLocationOnScreen().x,
e.getComponent().getLocationOnScreen().y + e.getComponent().getWidth()
);
}
});
代码示例来源:origin: ron190/jsql-injection
@Override
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
Component componentSource = (Component) e.getSource();
JPopupMenu menu = new JPopupMenu();
for (int position = 0 ; position < MediatorGui.menubar().getMenuView().getMenuComponentCount() ; position++) {
// Fix #35348: SerializationException on clone()
try {
JMenuItem itemMenu = (JMenuItem) SerializationUtils.clone(MediatorGui.menubar().getMenuView().getMenuComponent(position));
menu.add(itemMenu);
final int positionFinal = position;
itemMenu.addActionListener(actionEvent -> MediatorGui.tabManagers().setSelectedIndex(positionFinal));
} catch (SerializationException ex) {
LOGGER.error(ex, ex);
}
}
menu.show(componentSource, e.getX(), e.getY());
menu.setLocation(
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? e.getXOnScreen() - menu.getWidth()
: e.getXOnScreen(),
e.getYOnScreen()
);
}
}
代码示例来源:origin: ron190/jsql-injection
list,
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? mouseEvent.getX() - popupMenuList.getWidth()
: mouseEvent.getX(),
mouseEvent.getY()
? mouseEvent.getXOnScreen() - popupMenuList.getWidth()
: mouseEvent.getXOnScreen(),
mouseEvent.getYOnScreen()
代码示例来源:origin: org.netbeans.api/org-openide-awt
if (popup.isShowing() && e.getID() == MouseEvent.MOUSE_EXITED) {
int minX = popup.getLocationOnScreen().x;
int maxX = popup.getLocationOnScreen().x + popup.getWidth();
int minY = popup.getLocationOnScreen().y;
int maxY = popup.getLocationOnScreen().y + popup.getHeight();
int minX = overflowButton.getLocationOnScreen().x;
int maxX_ob = minX + overflowButton.getWidth();
int maxX = getOrientation() == HORIZONTAL ? minX + popup.getWidth()
: minX + overflowButton.getWidth() + popup.getWidth();
int minY = overflowButton.getLocationOnScreen().y;
int maxY_ob = minY + overflowButton.getHeight();
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
private boolean isInResizeSpot(Point point) {
if (point == null) return false;
Rectangle resizeSpot = new Rectangle(
menu.getWidth() - REZSIZE_SPOT_SIZE,
menu.getHeight() - REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE);
return resizeSpot.contains(point);
}
代码示例来源:origin: eugener/oxbow
private boolean isInResizeSpot( Point point ) {
if ( point == null ) return false;
Rectangle resizeSpot = new Rectangle(
menu.getWidth()-REZSIZE_SPOT_SIZE,
menu.getHeight()-REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE );
return resizeSpot.contains(point);
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets
private boolean isInResizeSpot(Point point) {
if (point == null) return false;
Rectangle resizeSpot = new Rectangle(
menu.getWidth() - REZSIZE_SPOT_SIZE,
menu.getHeight() - REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE);
return resizeSpot.contains(point);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = WIDTH_JSDOC)
@Override
public int getWidth() {
return super.getWidth();
}
代码示例来源:origin: org.bidib.org.oxbow/swingbits
private boolean isInResizeSpot( Point point ) {
if ( point == null ) return false;
Rectangle resizeSpot = new Rectangle(
menu.getWidth()-REZSIZE_SPOT_SIZE,
menu.getHeight()-REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE,
REZSIZE_SPOT_SIZE );
return resizeSpot.contains(point);
}
代码示例来源:origin: edu.stanford.protege/ca.uvic.cs.chisel.cajun
protected void showPopup(PInputEvent e) {
Component invoker = (Component) e.getComponent();
if ((invoker != null) && (popup != null) && (popup.getComponentCount() > 0)) {
int x = (int) e.getCanvasPosition().getX();
int y = (int) e.getCanvasPosition().getY();
if (x + popup.getWidth() > invoker.getX() + invoker.getWidth()) {
x = invoker.getX() + invoker.getWidth() - popup.getWidth();
}
if (y + popup.getHeight() > invoker.getY() + invoker.getHeight()) {
y = invoker.getY() + invoker.getHeight() - popup.getHeight();
}
popup.show(invoker, x, y);
}
}
代码示例来源:origin: datacleaner/DataCleaner
case LEFT:
x = menu.getWidth() * -1;
y = 0;
break;
代码示例来源:origin: google/sagetv
if ((screenLoc.x + theMenu.getWidth()) > scrBounds.x + scrBounds.width - screenInsets.right)
x -= theMenu.getWidth();
screenLoc.x -= theMenu.getWidth();
代码示例来源:origin: com.jtattoo/JTattoo
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src instanceof JTabbedPane) {
tabbedPane = (JTabbedPane) src;
} else if (src instanceof ScrollablePopupMenuTabButton) {
tabbedPane = (JTabbedPane) ((ScrollablePopupMenuTabButton) src).getParent();
} else {
return; // shouldn't happen
}
BaseTabbedPaneUI ui = (BaseTabbedPaneUI) tabbedPane.getUI();
if (ui.scrollableTabLayoutEnabled()) {
JPopupMenu popup = new JPopupMenu();
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
JMenuItem item = new JMenuItem(tabbedPane.getTitleAt(i));
item.addActionListener(new ScrollTabsPopupMenuItemAction(tabbedPane, i));
item.setEnabled(tabbedPane.isEnabledAt(i));
popup.add(item);
}
popup.show(ui.tabScroller.popupMenuButton, 0, 0);
Point pt = ui.tabScroller.popupMenuButton.getLocationOnScreen();
int x = -popup.getWidth() + ui.tabScroller.popupMenuButton.getWidth();
int y = ui.tabScroller.popupMenuButton.getHeight() - 1;
popup.setLocation(pt.x + x, pt.y + y);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!