public int getX(Component target) { if (sourceX < 0) return -1; return SwingUtilities.convertPoint(source, sourceX, 0, target).x; }
public int getYMin(Component target) { if (sourceYMin < 0) return -1; return SwingUtilities.convertPoint(source, 0, sourceYMin, target).y; }
public int getYMin(Component target) { if (sourceYMin < 0) return -1; return SwingUtilities.convertPoint(source, 0, sourceYMin, target).y; }
public int getYMax(Component target) { if (sourceYMax < 0) return -1; return SwingUtilities.convertPoint(source, 0, sourceYMax, target).y; }
public int getX(Component target) { if (sourceX < 0) return -1; return SwingUtilities.convertPoint(source, sourceX, 0, target).x; }
public int getY(Component target) { if (sourceY < 0) return -1; return SwingUtilities.convertPoint(source, 0, sourceY, target).y; }
public int getX(Component target) { if (sourceX < 0) return -1; return SwingUtilities.convertPoint(source, sourceX, 0, target).x; }
public int getX(Component target) { if (sourceX < 0) return -1; return SwingUtilities.convertPoint(source, sourceX, 0, target).x; }
public int getY(Component target) { if (sourceY < 0) return -1; return SwingUtilities.convertPoint(source, 0, sourceY, target).y; }
public int getYMax(Component target) { if (sourceYMax < 0) return -1; return SwingUtilities.convertPoint(source, 0, sourceYMax, target).y; }
/** * Get offset of game canvas in game window * * @return game canvas offset */ public Point getCanvasOffset() { if (client instanceof Client) { final Canvas canvas = ((Client) client).getCanvas(); if (canvas != null) { final java.awt.Point point = SwingUtilities.convertPoint(canvas, 0, 0, frame); return new Point(point.x, point.y); } } return new Point(0, 0); }
private void positionPanel() { if (parent == null) return; Container scroll = SwingUtilities.getAncestorOfClass(JScrollPane.class, parent); int height = (int)getPreferredSize().getHeight(); if (scroll != null) { Rectangle bounds = scroll.getBounds(); bounds.translate(0, scroll.getHeight() - height); bounds.height = height; Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), oldGlass); bounds.setLocation(pos); setBounds(bounds); repaint(); } }
bounds.height = height; final JRootPane rootPane = SwingUtilities.getRootPane(myParent); final Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), rootPane); final Window window = SwingUtilities.getWindowAncestor(myParent); final Point windowPos = window.getLocation();
private void positionPanel() { final JComponent contentComponent = myEditor.getContentComponent(); Container scroll = SwingUtilities.getAncestorOfClass(JScrollPane.class, contentComponent); setSize(scroll.getSize()); myLineHeight = myText.getFontMetrics(myText.getFont()).getHeight(); int count = countLines(myText.getText()); int visLines = getSize().height / myLineHeight - 1; int lines = Math.min(count, visLines); setSize(getSize().width, lines * myLineHeight + myLabel.getPreferredSize().height + getBorder().getBorderInsets(this).top * 2); int height = getSize().height; Rectangle bounds = scroll.getBounds(); bounds.translate(0, scroll.getHeight() - height); bounds.height = height; Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), SwingUtilities.getRootPane(contentComponent).getGlassPane()); bounds.setLocation(pos); setBounds(bounds); myScrollPane.getVerticalScrollBar().setValue(0); if (!Options.getInstance().isSet("more")) { // FIX scrollOffset(100000); } else { scrollOffset(0); } }
public void mouseDragged(MouseEvent e) { isDragging = true; JComponent c = ColorWell.this; Point pt = e.getPoint(); JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c); pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane()); MouseEvent newEvent = new MouseEvent(colorPicker, e.getID(), e.getWhen(), e.getModifiers(), (int) pt.getX(), (int) pt.getY(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); colorPicker.dispatchEvent(newEvent); }
public void mouseDragged(MouseEvent e) { isDragging = true; JComponent c = ColorWell.this; Point pt = e.getPoint(); JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c); pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane()); MouseEvent newEvent = new MouseEvent(colorPicker, e.getID(), e.getWhen(), e.getModifiers(), (int) pt.getX(), (int) pt.getY(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); colorPicker.dispatchEvent(newEvent); }
public void mousePressed(MouseEvent e) { isDragging = false; JComponent c = ColorWell.this; JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c); if (frame == null) return; Point pt = c.getLocation(); pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane()); Rectangle r = c.getBounds(); frame.setGlassPane(colorPicker); colorPicker.setVisible(true); colorPicker.setPoint(new Point(pt.x, pt.y + r.height)); frame.validate(); } }
public void mousePressed(MouseEvent e) { isDragging = false; JComponent c = ColorWell.this; JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c); if (frame == null) return; Point pt = c.getLocation(); pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane()); Rectangle r = c.getBounds(); frame.setGlassPane(colorPicker); colorPicker.setVisible(true); colorPicker.setPoint(new Point(pt.x, pt.y + r.height)); frame.validate(); } }
public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { Point p = SwingUtilities.convertPoint((Component) e.getSource(), e.getPoint(), this); updateSheetTableSelection(e); popupRequested(p); } }
public void mouseMoved(MouseEvent e) { Point p = e.getPoint(); JComponent comp = (JComponent) e.getSource(); JScrollPane jsp = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, comp); if (jsp != null) { p = SwingUtilities.convertPoint (comp, p, jsp); show(jsp, p); } }