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

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

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

JPanel.getY介绍

暂无

代码示例

代码示例来源:origin: org.japura/japura-gui

private boolean check(MouseEvent e) {
 int y = getInnerTitlePanel().getY() - titleMargin;
 int max =
   getInnerTitlePanel().getY() + getInnerTitlePanel().getHeight()
     + titleMargin;
 if (e.getPoint().y > y && e.getPoint().y < max) {
  return true;
 }
 return false;
}

代码示例来源:origin: net.sf.cuf/cuf-swing

/**
 * Checks what kind of button got hit at position (<code>x</code>, <code>y</code>).
 *
 * @param pX x-coordinate
 * @param pY y-coordinate
 * @return {@link #ASCENDING} or {@link #NONE} or {@link #DESCENDING}, depending on button that got hit
 */
public int hitButton(final int pX, final int pY)
{
  Component component = mPanelButtons.findComponentAt(pX - mPanelButtons.getX(), pY - mPanelButtons.getY());
  if (component != null && component.equals(mButtonSortAscending)) return ASCENDING;
  if (component != null && component.equals(mButtonSortDescending)) return DESCENDING;
  return NONE;
}

代码示例来源:origin: org.jvnet.hudson/netx

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    int x = bar.getX();
    int y = bar.getY();
    int h = bar.getHeight();
    int w = bar.getWidth();
    if (readSoFar <= 0 || total <= 0) {
      // make barber pole
    }
    else {
      double progress = (double)readSoFar / (double)total;
      int divide = (int)(w * progress);
      g.setColor(Color.white);
      g.fillRect(x, y, w, h);
      g.setColor(Color.blue);
      g.fillRect(x+1, y+1, divide-1, h-1);
    }
  }
};

代码示例来源:origin: org.japura/japura-gui

@Override
public Dimension getPreferredSize() {
 if (isPreferredSizeSet()) {
  return super.getPreferredSize();
 }
 Dimension dim = this.innerPanel.getPreferredSize();
 if (this.titleIcon != null) {
  int iconHeight = this.titleIcon.getPreferredSize().height;
  Insets insets = this.innerPanel.getInsets();
  int yBase = getTitleBar().getIconBase().getY();
  int yBaseToTop = yBase + insets.top;
  dim.height += Math.max(0, iconHeight - yBaseToTop);
 }
 return dim;
}

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

public void mouseMoved(MouseEvent e) {
  Point pt1 = e.getPoint();
  pt1.translate(-p1.getX(), -p1.getY());
  Point pt2 = e.getPoint(); 
  pt2.translate(-p2.getX(), -p2.getY());
  if (p1.contains(pt1) && p2.contains(pt2)) {
      System.out.println("both contain: " + e.getPoint());

代码示例来源:origin: sc.fiji/TrakEM2_

Utils.invokeLater(new Runnable() { @Override
  public void run() {
    final JViewport view = scroll.getViewport();
    final Point current = view.getViewPosition();
    final Dimension extent = view.getExtentSize();
    final int panel_y = dp.getY();
    if ((panel_y + DisplayablePanel.HEIGHT - current.y) <= extent.height && panel_y >= current.y) {
      // it's completely visible already
      return;
    } else {
      // scroll just enough
      // if it's above, show at the top
      if (panel_y - current.y < 0) {
        view.setViewPosition(new Point(0, panel_y));
      }
      // if it's below (even if partially), show at the bottom
      else if (panel_y + 50 > current.y + extent.height) {
        view.setViewPosition(new Point(0, panel_y - extent.height + 50));
        //Utils.log("Display.scrollToShow: panel_y: " + panel_y + "   current.y: " + current.y + "  extent.height: " + extent.height);
      }
    }
  }});
}

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

Random colorGenerator = new Random();
int curx = drawPanel.getX();
int cury = drawPanel.getY();

代码示例来源:origin: org.japura/japura-gui

@Override
protected final void paintBorder(Graphics g) {
 Border border = getBorder();
 if (border != null) {
  int y = getInnerTitlePanel().getY() - getInsets().top - titleMargin;
  border.paintBorder(this, g, 0, y, getWidth(), getHeight() - y);
 }
}

代码示例来源:origin: org.japura/japura-gui

int y = getInnerTitlePanel().getY() - titleMargin;
int height = getInnerTitlePanel().getHeight() + (2 * titleMargin);

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

/**
 * Selects the particular canvas at the specified index.
 * THe canvas is placed onto the it's glass pane and the placed onto
 * the canvasPane.  A timer is used to roll out the canvasPane.
 * @param index
 */
public void selectCanvas(int index) {
  if ((!timer.timer.isRunning()) || (this.selectedCanvasIndex != index)) {
    if (index >= 0 && index < drawers.size()) {
      this.selectedCanvasIndex = index;
      GlassCard card = drawers.get(index);
      canvasPane.removeAll();
      canvasPane.add(card.getScroll());
      canvasPane.setBackground(card.getBackgorundColor());
      timer.expand();
      canvasPane.setBounds(buttonPane.getWidth(), buttonPane.getY(),
          0, 0);
      this.requestFocus();
    }
  }
}
/**

代码示例来源:origin: robward-scisys/sldeditor

/** Creates the ui. */
@Override
public void createUI() {
  if (!start.areFieldsConfigured()) {
    FieldPanel fieldPanel = createFieldPanel(getXPos(), Y_OFFSET, "");
    createUIPanel(
        fieldPanel,
        start,
        0,
        Localisation.getString(FieldConfigBase.class, "FieldConfigTimePeriod.from"));
    createUIPanel(
        fieldPanel,
        end,
        1,
        Localisation.getString(FieldConfigBase.class, "FieldConfigTimePeriod.to"));
    Dimension preferredSize =
        new Dimension(
            (int) fieldPanel.getPreferredSize().getWidth(),
            end.panel.getY() + end.panel.getHeight());
    fieldPanel.setPreferredSize(preferredSize);
    if (!isValueOnly()) {
      setAttributeSelectionPanel(
          fieldPanel.internalCreateAttrButton(Double.class, this, isRasterSymbol()));
    }
  }
}

相关文章

微信公众号

最新文章

更多

JPanel类方法