List of utility methods to do Swing Mouse
boolean | isLeftMouseButton(MouseEvent anEvent) Replaces SwingUtilities#isLeftMouseButton() for consistency with other button-related methods return (anEvent.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) > 0;
|
boolean | isLeftMouseButton(MouseEvent e) Determines if the event is originated from a left mouse button return javax.swing.SwingUtilities.isLeftMouseButton(e);
|
boolean | isPopupTrigger(final MouseEvent e) Returns whether the specifid mouse events triggers popup menu or not. return e.isPopupTrigger() || SwingUtilities.isRightMouseButton(e);
|
boolean | isPrimaryMouseButton(MouseEvent e) Tests if a MouseEvent was triggered by primary mouse button return SwingUtilities.isLeftMouseButton(e) && !e.isControlDown();
|
void | makeMouseOverBorder(final JComponent b) Make a mouse over border b.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); b.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { if (b.isEnabled()) { b.setBorder(BorderFactory.createLineBorder(Color.gray)); public void mouseExited(MouseEvent e) { ... |
int | mapDragOperationFromModifiers(MouseEvent me, TransferHandler th) map Drag Operation From Modifiers return convertModifiersToDropAction(me.getModifiersEx(), th.getSourceActions((JComponent) me.getSource()));
|
void | paintBandTitle(Graphics g, Rectangle titleRectangle, String title, boolean isUnderMouse, boolean hasExpandIcon) paint Band Title Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); Shape s = new RoundRectangle2D.Double(titleRectangle.x, titleRectangle.y, titleRectangle.width, titleRectangle.height, 8, 8); GradientPaint gp1 = new GradientPaint(0, titleRectangle.y + titleRectangle.height / 2, new Color(75, 75, 75), 0, titleRectangle.y + titleRectangle.height, new Color(100, 100, 100)); g2.setPaint(gp1); ... |
MouseEvent | parentMouseEvent(JComponent c, MouseEvent m) build a moue event on the parent coordinates Point loc = c.getLocation(); int x = m.getX() + loc.x; int y = m.getY() + loc.y; MouseEvent ret = new MouseEvent(c.getParent(), m.getID(), m.getWhen(), m.getModifiers(), x, y, m.getClickCount(), m.isPopupTrigger(), m.getButton()); return ret; |
void | passBehind(MouseEvent e) Pass the event behind. JComponent source = (JComponent) e.getSource(); Container parent = source.getParent(); if (parent != null) { Point pos = SwingUtilities.convertPoint(source, e.getPoint(), parent); MouseEvent event = new MouseEvent(parent, e.getID(), e.getWhen(), e.getModifiers(), pos.x, pos.y, e.getClickCount(), e.isPopupTrigger()); parent.dispatchEvent(event); |
void | propagate(MouseEvent e, Component c) propagate Point p = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), c); MouseEvent e2; if (e instanceof MouseWheelEvent) { e2 = new MouseWheelEvent(c, e.getID(), e.getWhen(), e.getModifiers(), p.x, p.y, e.getClickCount(), e.isPopupTrigger(), ((MouseWheelEvent) e).getScrollType(), ((MouseWheelEvent) e).getScrollAmount(), ((MouseWheelEvent) e).getWheelRotation()); } else { e2 = new MouseEvent(c, e.getID(), e.getWhen(), e.getModifiers(), p.x, p.y, e.getClickCount(), ... |