javax.swing.JComponent.getY()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中javax.swing.JComponent.getY()方法的一些代码示例,展示了JComponent.getY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.getY()方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:getY

JComponent.getY介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

windowY = container.getY() + textField.getY() + textField.getHeight() + autoSuggestionPopUpWindow.getMinimumSize().height;
} else {
  windowY = container.getY() + textField.getY() + textField.getHeight() + autoSuggestionPopUpWindow.getHeight();

代码示例来源:origin: stackoverflow.com

myY = getY();

代码示例来源:origin: stackoverflow.com

g2d.setStroke(s);
int x1 = one.getX() + one.getWidth() / 2;
int y1 = one.getY() + one.getHeight() / 2;
int x2 = two.getX() + two.getWidth() / 2;
int y2 = two.getY() + two.getHeight() / 2;
g2d.drawLine(x1, y1, x2, y2);

代码示例来源:origin: stackoverflow.com

public static double distance(Point p, JComponent comp) {
  Point2D.Float center =
    // note: use (0, 0) instead of (getX(), getY())
    // if the Point 'p' is in the coordinates of 'comp'
    // instead of the parent of 'comp'
    new Point2D.Float(comp.getX(), comp.getY());

  center.x += comp.getWidth() / 2f;
  center.y += comp.getHeight() / 2f;

  return center.distance(p);
}

代码示例来源:origin: stackoverflow.com

public static Rectangle placeAbove(JComponent j, int a) {
  int x= j.getX();
  int y= j.getY();
  int w= j.getWidth();
  int h= j.getHeight();

  y=(y-h)-a;

  //return our new bounds projected in a Rectangle Object
  return new Rectangle(x, y, w, h); 
}

代码示例来源:origin: bcdev/beam

public void setImageWidthFixed(boolean imageWidthFixed) {
  if (this.imageWidthFixed == imageWidthFixed) {
    return;
  }
  this.imageWidthFixed = imageWidthFixed;
  if (this.imageWidthFixed) {
    setSliderBoxBounds(0, sliderBox.getY(), imageWidth, sliderBox.getHeight(), true);
  }
}

代码示例来源:origin: senbox-org/snap-desktop

public void setImageWidthFixed(boolean imageWidthFixed) {
  if (this.imageWidthFixed == imageWidthFixed) {
    return;
  }
  this.imageWidthFixed = imageWidthFixed;
  if (this.imageWidthFixed) {
    setSliderBoxBounds(0, sliderBox.getY(), imageWidth, sliderBox.getHeight(), true);
  }
}

代码示例来源:origin: stackoverflow.com

public void mouseDragged(MouseEvent e) {
   if (e.getSource() == label2) {
   JComponent jc = (JComponent)e.getSource();
   jc.setLocation(jc.getX()+e.getX()-clicX, jc.getY()+e.getY()-clicY);
   }

代码示例来源:origin: stackoverflow.com

public void mouseDragged(MouseEvent e) 
{
  if (drag == true) 
  {
    JComponent jc = (JComponent)e.getSource();
    jc.setLocation(jc.getX()+e.getX(), jc.getY()+e.getY());
  }
}

代码示例来源:origin: mikaelhg/openblocks

/**
 * Called when the mouse is pressed over the JComponent.
 * Saves the point (which is measured relative to the JComponent's corner)
 * over which the mouse was pressed.
 */
public void mousePressed(MouseEvent e) {
  myComponent.setCursor(closedHandCursor);
  mPressedX = e.getX();
  mPressedY = e.getY();
  oldLocX = myComponent.getX();
  oldLocY = myComponent.getY();
}

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Paints the component with the current zoom scale
 * @param g graphics
 * @param c component
 */
@Override
public void paint(Graphics g, JComponent c) {
  g.clearRect(c.getX(), c.getY(), c.getWidth(), c.getHeight());
  Graphics2D g2 = (Graphics2D) g;
  g2.scale(zoom, zoom);
  super.paint(g2, c);
}

代码示例来源:origin: Spoutcraft/LegacyLauncher

public void run() {
    if (repaintCallback != null) {
      repaintCallback.setBounds(repaintCallback.getX(), repaintCallback.getY(), repaintCallback.getWidth(), repaintCallback.getHeight());
      repaintCallback.repaint();
    }
  }
});

代码示例来源:origin: stackoverflow.com

public int print(Graphics g, PageFormat pf, int page) throws PrinterException
{
  if(page > 0) return Printable.NO_SUCH_PAGE;
  Graphics2D g2 = (Graphics2D)g;
  g2.translate(pf.getImageableX(), pf.getImageableY());

  for(JComponent item : items)
  {
    g2.translate(item.getX(), item.getY());
    item.printAll(g);
    g2.translate(-item.getX(), -item.getY()); // bring all back to default coordinates
  }
  return Printable.PAGE_EXISTS;
}

代码示例来源:origin: freeplane/freeplane

private int getRefY(NodeView sibling) {
  return sibling.getY() + sibling.getContent().getY();
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

public static void repaintRequest(JComponent c) {
  RepaintManager.currentManager(c).addDirtyRegion(
      c, c.getX(), c.getY(), c.getWidth(), c.getHeight());
}

代码示例来源:origin: de.sciss/jtreetable

private void dispatchMouseEvent(MouseEvent e, JComponent c) {
  MouseEvent me = new MouseEvent(c, e.getID(), e.getWhen(), e.getModifiers(),
      e.getX()-c.getX(), e.getY()-c.getY(), e.getXOnScreen(), e.getYOnScreen(),
      e.getClickCount(), false, e.getButton());
  c.dispatchEvent(me);
  if (me.isConsumed())
    e.consume();
}

代码示例来源:origin: com.harium.propan/propan-jogl

/**
 * Called after the canvas is set on {@code g2d} but before any painting is
 * done. This should setup the matrices and ask {@code g2d} to setup any
 * client state.
 */
protected void prePaint(GLAutoDrawable drawable) {
  setupViewport(drawable);
  g2d.prePaint(drawable);
  g2d.translate(comp.getX(), comp.getY());
  g2d.clipRect(0, 0, comp.getWidth(), comp.getHeight());
}

代码示例来源:origin: brandonborkholder/glg2d

/**
 * Called before any painting is done. This should setup the matrices and ask
 * the {@code GLGraphics2D} object to setup any client state.
 */
protected void prePaint(GLAutoDrawable drawable) {
 setupViewport(drawable);
 g2d.prePaint(drawable.getContext());
 // clip to only the component we're painting
 g2d.translate(comp.getX(), comp.getY());
 g2d.clipRect(0, 0, comp.getWidth(), comp.getHeight());
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

private boolean isTabFullyVisible( ITab tab )
{
 switch( _tabContainer.getTabPosition() )
 {
  case TOP:
  case BOTTOM:
   return tab.getComponent().getX() + tab.getComponent().getWidth() <= _tabContainer.getWidth();
  case LEFT:
  case RIGHT:
   return tab.getComponent().getY() + tab.getComponent().getHeight() <= _tabContainer.getHeight();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

private boolean isTabFullyVisible( ITab tab )
{
 switch( _tabContainer.getTabPosition() )
 {
  case TOP:
  case BOTTOM:
   return tab.getComponent().getX() + tab.getComponent().getWidth() <= _tabContainer.getWidth();
  case LEFT:
  case RIGHT:
   return tab.getComponent().getY() + tab.getComponent().getHeight() <= _tabContainer.getHeight();
 }
 throw new IllegalStateException();
}

相关文章

JComponent类方法