本文整理了Java中javax.swing.JPopupMenu.getSize()
方法的一些代码示例,展示了JPopupMenu.getSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPopupMenu.getSize()
方法的具体详情如下:
包路径:javax.swing.JPopupMenu
类名称:JPopupMenu
方法名:getSize
暂无
代码示例来源:origin: skylot/jadx
private void process(MouseEvent e) {
textComponent.requestFocus();
boolean enabled = textComponent.isEnabled();
boolean editable = textComponent.isEditable();
boolean nonempty = !(textComponent.getText() == null || textComponent.getText().equals(""));
boolean marked = textComponent.getSelectedText() != null;
boolean pasteAvailable = Toolkit.getDefaultToolkit().getSystemClipboard()
.getContents(null).isDataFlavorSupported(DataFlavor.stringFlavor);
undoAction.setEnabled(enabled && editable && undoManager.canUndo());
redoAction.setEnabled(enabled && editable && undoManager.canRedo());
cutAction.setEnabled(enabled && editable && marked);
copyAction.setEnabled(enabled && marked);
pasteAction.setEnabled(enabled && editable && pasteAvailable);
deleteAction.setEnabled(enabled && editable && marked);
selectAllAction.setEnabled(enabled && nonempty);
int nx = e.getX();
if (nx > 500) {
nx = nx - popup.getSize().width;
}
popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
}
}
代码示例来源:origin: RipMeApp/ripme
@Override
public void mouseClicked(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
if (!(e.getSource() instanceof JTable)) {
return;
}
tableComponent = (JTable) e.getSource();
tableComponent.requestFocus();
int nx = e.getX();
if (nx > 500) {
nx = nx - popup.getSize().width;
}
popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
}
}
}
代码示例来源:origin: RipMeApp/ripme
@Override
public void mouseClicked(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
if (!(e.getSource() instanceof JList)) {
return;
}
queueList = (JList) e.getSource();
queueListModel = (DefaultListModel) queueList.getModel();
queueList.requestFocus();
int nx = e.getX();
if (nx > 500) {
nx = nx - popup.getSize().width;
}
popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
}
}
}
代码示例来源:origin: RipMeApp/ripme
nx = nx - popup.getSize().width;
popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
代码示例来源:origin: stackoverflow.com
nx = nx - popup.getSize().width;
popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
代码示例来源:origin: org.netbeans.api/org-openide-awt
private static boolean willPopupBeContained(JPopupMenu popup, Point origin) {
if (!popup.isShowing()) {
return false;
}
Window w = SwingUtilities.windowForComponent(popup.getInvoker());
Rectangle r = new Rectangle(origin, popup.getSize());
return (w != null) && w.getBounds().contains(r);
}
代码示例来源:origin: eugener/oxbow
@Override
public void mousePressed(MouseEvent e) {
mouseStart = toScreen(e);
startSize = menu.getSize();
isResizing = isInResizeSpot(e.getPoint());
}
代码示例来源:origin: org.bidib.org.oxbow/swingbits
@Override
public void mousePressed(MouseEvent e) {
mouseStart = toScreen(e);
startSize = menu.getSize();
isResizing = isInResizeSpot(e.getPoint());
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
@Override
public void mousePressed(MouseEvent e) {
mouseStart = toScreen(e);
startSize = menu.getSize();
isResizing = isInResizeSpot(e.getPoint());
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets
@Override
public void mousePressed(MouseEvent e) {
mouseStart = toScreen(e);
startSize = menu.getSize();
isResizing = isInResizeSpot(e.getPoint());
}
代码示例来源:origin: Vhati/Slipstream-Mod-Manager
private void showMenu( MouseEvent e ) {
AttributeSet tmpAttr = doc.getCharacterElement( textPane.viewToModel( e.getPoint() ) ).getAttributes();
Object targetObj = tmpAttr.getAttribute( ATTR_HYPERLINK_TARGET );
if ( targetObj != null ) { // Link menu.
textPane.requestFocus();
lastClickedLinkTarget = targetObj.toString();
int nx = e.getX();
if ( nx > 500 ) nx = nx - linkPopup.getSize().width;
linkPopup.show( e.getComponent(), nx, e.getY() - linkPopup.getSize().height );
e.consume();
}
}
};
代码示例来源:origin: Vhati/Slipstream-Mod-Manager
public void showMenu( MouseEvent e ) {
if ( e.getSource() instanceof JTextComponent == false ) return;
textComponent = (JTextComponent)e.getSource();
textComponent.requestFocus();
boolean enabled = textComponent.isEnabled();
boolean editable = textComponent.isEditable();
boolean nonempty = !(textComponent.getText() == null || textComponent.getText().equals( "" ));
boolean marked = textComponent.getSelectedText() != null;
boolean pasteAvailable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents( null ).isDataFlavorSupported( DataFlavor.stringFlavor );
cutAction.setEnabled( enabled && editable && marked );
copyAction.setEnabled( enabled && marked );
pasteAction.setEnabled( enabled && editable && pasteAvailable );
selectAllAction.setEnabled( enabled && nonempty );
int nx = e.getX();
if ( nx > 500 ) nx = nx - popup.getSize().width;
popup.show( e.getComponent(), nx, e.getY() - popup.getSize().height );
e.consume();
}
}
代码示例来源:origin: tonikelope/megabasterd
@Override
public void mouseClicked(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
if (!(e.getSource() instanceof JTextComponent)) {
return;
}
_textComponent = (JTextComponent) e.getSource();
_textComponent.requestFocus();
boolean enabled = _textComponent.isEnabled();
boolean editable = _textComponent.isEditable();
boolean nonempty = !(_textComponent.getText() == null || _textComponent.getText().isEmpty());
boolean marked = _textComponent.getSelectedText() != null;
boolean pasteAvailable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).isDataFlavorSupported(DataFlavor.stringFlavor);
_undoAction.setEnabled(enabled && editable && (_lastActionSelected == _Actions.CUT || _lastActionSelected == _Actions.PASTE));
_cutAction.setEnabled(enabled && editable && marked);
_copyAction.setEnabled(enabled && marked);
_pasteAction.setEnabled(enabled && editable && pasteAvailable);
_selectAllAction.setEnabled(enabled && nonempty);
int nx = e.getX();
if (nx > 500) {
nx -= _popup.getSize().width;
}
_popup.show(e.getComponent(), nx, e.getY() - _popup.getSize().height);
}
}
代码示例来源:origin: SimpleAmazonGlacierUploader/SAGU
nx = nx - popup.getSize().width;
popup.show(e.getComponent(), nx, e.getY() - popup.getSize().height);
代码示例来源:origin: net.java.dev.laf-widget/laf-widget
@Override
public void mouseDragged(MouseEvent e) {
if (theStartPoint == null)
return;
if (!thePopupMenu.isShowing())
return;
Point newPoint = e.getPoint();
SwingUtilities.convertPointToScreen(newPoint, (Component) e
.getSource());
Rectangle popupScreenRect = new Rectangle(thePopupMenu
.getLocationOnScreen(), thePopupMenu.getSize());
if (!popupScreenRect.contains(newPoint))
return;
int deltaX = (int) ((newPoint.x - thePrevPoint.x) / theScale);
int deltaY = (int) ((newPoint.y - thePrevPoint.y) / theScale);
scroll(deltaX, deltaY, false);
thePrevPoint = newPoint;
}
};
代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d
public void popup(final Component _c, final int _xe, final int _ye) {
int xe = _xe;
int ye = _ye;
final int selRow = getRowForLocation(xe, ye);
if (selRow != -1) {
final TreePath selPath = getPathForLocation(xe, ye);
final Object selObject = selPath.getLastPathComponent();
final JPopupMenu menu = buildPopupMenu((BCalque) selObject);
xe = 20 - menu.getSize().width;
ye -= 5;
menu.show(_c, xe, ye);
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
private static boolean willPopupBeContained(JPopupMenu popup, Point origin) {
if (!popup.isShowing()) {
return false;
}
Window w = SwingUtilities.windowForComponent (popup.getInvoker());
Rectangle r = new Rectangle (origin, popup.getSize ());
return w != null && w.getBounds ().contains (r);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
private static boolean willPopupBeContained(JPopupMenu popup, Point origin) {
if (!popup.isShowing()) {
return false;
}
Window w = SwingUtilities.windowForComponent (popup.getInvoker());
Rectangle r = new Rectangle (origin, popup.getSize ());
return w != null && w.getBounds ().contains (r);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void inversePopupMenu() {
createPopupMenu();
int w = popupMenu.getSize().width;
if (w == 0) {
w = popupMenu.getPreferredSize().width;
}
popupMenu.show(this, -w + this.getWidth(), this.getHeight());
}
代码示例来源:origin: org.japura/japura-gui
Dimension dim = popup.getSize();
popupBounds =
new Rectangle2D.Double(point.getX(), point.getY(), dim.getWidth(),
内容来源于网络,如有侵权,请联系作者删除!