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

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

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

JButton.getY介绍

暂无

代码示例

代码示例来源:origin: Audiveris/audiveris

@Override
  public void actionPerformed (ActionEvent e)
  {
    JButton button = (JButton) e.getSource();
    menu.show(ShapesPane.this, button.getX(), button.getY());
  }
}

代码示例来源:origin: Audiveris/audiveris

@Override
  public void actionPerformed (ActionEvent e)
  {
    JButton button = (JButton) e.getSource();
    menu.show(RangesPane.this, button.getX(), button.getY());
  }
}

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

JFrame f = new JFrame("Test");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(new JLabel("Test"), BorderLayout.WEST);
JButton b = new JButton("Test");
f.add(b);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
System.out.println(SwingUtilities.convertPoint(b, b.getX(), b.getY(), f));

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking

@Override
  public void mouseClicked(MouseEvent e) {
    if (btnRecently.isEnabled()) {
      recentlyPopup.show(e.getComponent(), btnRecently.getX(), btnRecently.getY() + btnRecently.getHeight());
    }
  }
});

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

contentPanel.setLayout(null); // Absolute positioning of children.

@Override
public void actionPerformed(ActionEvent evt) {
  final JButton btn = (JButton) evt.getSource();
  final int buttonY = btn.getY(); // Must be final for usage in new Runnable object.

  SwingUtilities.invokeLater(new Runnable() { // Return fast from event handling.

    @Override
    public void run() {
      JPanel child = new JPanel();
      child.setBackground(Color.RED); // So we'll see it.
      child.setBounds(0, buttonY, 100, 300);
      contentPanel.removeAll(); // Clear content panel of prior additions.
      contentPanel.add(child); // Add a new panel.
      contentPanel.repaint(10L);
    }
  });
 }

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking

@Override
  public void mouseClicked(MouseEvent e) {
    if (btnFilter.isEnabled()) {
      filterPopup.show(e.getComponent(), btnFilter.getX(), btnFilter.getY() + btnFilter.getHeight());
    }
  }
});

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
protected void paintIncreaseHighlight(Graphics g) {
  Insets insets = scrollbar.getInsets();
  Rectangle thumbR = getThumbBounds();
  g.setColor(new Color(202,207,203));
  if (scrollbar.getOrientation() == JScrollBar.VERTICAL) {
    int x = insets.left+decrButton.getWidth()/2-2;
    int y = thumbR.y;
    int w = 4;
    int h = incrButton.getY() - y;
    g.fillRect(x, y, w, h);
  }
}

代码示例来源:origin: uk.ac.gate.plugins/tools

private void addLines(STreeNode newNode) {
 JButton newButton = buttons.get(newNode.getID());
 int nbX = newButton.getX() + newButton.getWidth()/2;
 int nbY = newButton.getY() + newButton.getHeight();
 for (Iterator<JButton> i = selection.iterator(); i.hasNext(); ) {
  JButton selButton = i.next();
  //I create it a rect but it will in fact be used as x1, y1, x2, y2 for the
  //draw line. see drawLines.
  Coordinates coords = new Coordinates(
               nbX,
               nbY,
               selButton.getX() + selButton.getWidth()/2,
               selButton.getY());
  lines.add(coords);
 }
} // addLines

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

/**
 * Remove column button pressed.
 *
 * @param removeColumnButton the remove column button
 * @param e the e
 */
protected void removeColumnButton(JButton removeColumnButton, ActionEvent e) {
  JPopupMenu popupMenu = new JPopupMenu();
  List<String> columnNames = model.getColumnNames();
  for (String columnName : columnNames) {
    JMenuItem menuItem = new JMenuItem(columnName);
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            model.removeColumn(columnName);
          }
        });
    popupMenu.add(menuItem);
  }
  if (e != null) {
    popupMenu.show(
        removeColumnButton,
        removeColumnButton.getX() - removeColumnButton.getWidth(),
        removeColumnButton.getY());
  }
}

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

j.setLocation(j.getX() + 10, j.getY() + 10);

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

public class PropertiesButton extends JButton {

  private JPanel theWindow;

  public PropertiesButton() {
    theWindow = new JPanel();
    theWindow.add(new JMenuCheckBoxItem("Something"));

    this.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (theWindow.isVisible()) {
          theWindow.setVisible(false);
          getParent().remove(theWindow);
        } else {
          JButton btn = (JButton)e.getSource();
          getParent().add(theWindow);             
          theWindow.setBounds(
            btn.getX(),
            btn.getY() + btn.getHeight(), 100, 100);

          theWindow.setVisible(true);
        }
      }
    });
    theWindow.setVisible(false);
  }

}

代码示例来源:origin: uk.ac.gate.plugins/tools

private void shiftButtonsDown(int offset) {
 for (Iterator<JButton> i = buttons.values().iterator(); i.hasNext(); ) {
  JButton button = i.next();
  button.setBounds(        button.getX(),
            button.getY() + offset,
            button.getWidth(),
            button.getHeight());
 } // for loop through buttons
 for (Iterator<Coordinates> k = lines.iterator(); k.hasNext(); ) {
  Coordinates coords = k.next();
  coords.setY1(coords.getY1() + offset);
  coords.setY2(coords.getY2() + offset);
 }
}// private void shiftButtonsDown(int offset)

代码示例来源:origin: uk.ac.gate.plugins/tools

/**
 * recalculates all lines from that node to all its children
 */
private void recalculateLines(STreeNode node) {
 Integer id = node.getID();
 JButton button = buttons.get(id);
 int bX = button.getX() + button.getWidth()/2;
 int bY = button.getY() + button.getHeight();
 for (Enumeration<?> e = node.children(); e.hasMoreElements(); ) {
  STreeNode subNode = (STreeNode) e.nextElement();
  Integer sid = subNode.getID();
  JButton subButton = buttons.get(sid);
  Coordinates coords = new Coordinates(
               bX,
               bY,
               subButton.getX() + subButton.getWidth()/2,
               subButton.getY());
  lines.add(coords);
 }
}

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

namePanel.add(nameCheckBox);
namePanel.setBounds(225, 270, 140, namePanel.getHeight() + 25);
deleteButton.setBounds(230, deleteButton.getY() + 25, 100, 25);
JFrame frame = (JFrame) getRootPane().getParent();
frame.setSize(frame.getWidth(), frame.getHeight() + 25);

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

g2d.setColor(Color.RED);
int x = lastSelected.getX() + ((lastSelected.getWidth() - 8) / 2);
int y = lastSelected.getY() + ((lastSelected.getHeight() - 8) / 2);
g2d.fillOval(x, y, 8, 8);

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

@Override
  public void mousePressed(MouseEvent evt)
  {
    if(popup != null && popup.isVisible())
      popup.setVisible(false);
    else
    {
      popup = dockableWindowManager.createPopupMenu(
        FloatingWindowContainer.this,
        entry.factory.name,clone);
      GUIUtilities.showPopupMenu(popup,
        menu,menu.getX(),menu.getY() + menu.getHeight(),
        false);
    }
  }
} //}}}

代码示例来源:origin: uk.ac.gate.plugins/tools

if (childButton.getX() + childButton.getWidth() > right)
 right = childButton.getX() + childButton.getWidth();
if (childButton.getY() < top)
 top = childButton.getY();

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

thumbMin = sbInsets.top;
thumbMax = XTraScrollBarUI.this.decrButton().getY()

代码示例来源:origin: com.github.insubstantial/substance

leftButton.setBounds(x, extraY + offset, blockSize,
    leftButton.getPreferredSize().height * 2 / 3);
rightButton.setBounds(x, leftButton.getY()
    + leftButton.getHeight(), blockSize, leftButton
    .getPreferredSize().height * 2 / 3);

代码示例来源:origin: org.java.net.substance/substance

leftButton.setBounds(x, extraY + offset, blockSize,
    leftButton.getPreferredSize().height * 2 / 3);
rightButton.setBounds(x, leftButton.getY()
    + leftButton.getHeight(), blockSize, leftButton
    .getPreferredSize().height * 2 / 3);

相关文章

JButton类方法