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

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

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

JButton.getX介绍

暂无

代码示例

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

  1. @Override
  2. public void actionPerformed (ActionEvent e)
  3. {
  4. JButton button = (JButton) e.getSource();
  5. menu.show(ShapesPane.this, button.getX(), button.getY());
  6. }
  7. }

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

  1. @Override
  2. public void actionPerformed (ActionEvent e)
  3. {
  4. JButton button = (JButton) e.getSource();
  5. menu.show(RangesPane.this, button.getX(), button.getY());
  6. }
  7. }

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

  1. JFrame f = new JFrame("Test");
  2. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  3. f.add(new JLabel("Test"), BorderLayout.WEST);
  4. JButton b = new JButton("Test");
  5. f.add(b);
  6. f.pack();
  7. f.setLocationRelativeTo(null);
  8. f.setVisible(true);
  9. System.out.println(SwingUtilities.convertPoint(b, b.getX(), b.getY(), f));

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

  1. @Override
  2. public void componentMoved(ComponentEvent ce) {
  3. if (m.isVisible()) {
  4. m.show(pillInstance, editButton.getX(), pillInstance.getHeight());
  5. }
  6. }

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

  1. @Override
  2. public void mouseClicked(MouseEvent e) {
  3. if (btnRecently.isEnabled()) {
  4. recentlyPopup.show(e.getComponent(), btnRecently.getX(), btnRecently.getY() + btnRecently.getHeight());
  5. }
  6. }
  7. });

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

  1. @Override
  2. public void mouseClicked(MouseEvent e) {
  3. if (btnFilter.isEnabled()) {
  4. filterPopup.show(e.getComponent(), btnFilter.getX(), btnFilter.getY() + btnFilter.getHeight());
  5. }
  6. }
  7. });

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

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

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

  1. /**
  2. * Remove column button pressed.
  3. *
  4. * @param removeColumnButton the remove column button
  5. * @param e the e
  6. */
  7. protected void removeColumnButton(JButton removeColumnButton, ActionEvent e) {
  8. JPopupMenu popupMenu = new JPopupMenu();
  9. List<String> columnNames = model.getColumnNames();
  10. for (String columnName : columnNames) {
  11. JMenuItem menuItem = new JMenuItem(columnName);
  12. menuItem.addActionListener(
  13. new ActionListener() {
  14. public void actionPerformed(ActionEvent event) {
  15. model.removeColumn(columnName);
  16. }
  17. });
  18. popupMenu.add(menuItem);
  19. }
  20. if (e != null) {
  21. popupMenu.show(
  22. removeColumnButton,
  23. removeColumnButton.getX() - removeColumnButton.getWidth(),
  24. removeColumnButton.getY());
  25. }
  26. }

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

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

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

  1. public class PropertiesButton extends JButton {
  2. private JPanel theWindow;
  3. public PropertiesButton() {
  4. theWindow = new JPanel();
  5. theWindow.add(new JMenuCheckBoxItem("Something"));
  6. this.addActionListener(new ActionListener() {
  7. public void actionPerformed(ActionEvent e) {
  8. if (theWindow.isVisible()) {
  9. theWindow.setVisible(false);
  10. getParent().remove(theWindow);
  11. } else {
  12. JButton btn = (JButton)e.getSource();
  13. getParent().add(theWindow);
  14. theWindow.setBounds(
  15. btn.getX(),
  16. btn.getY() + btn.getHeight(), 100, 100);
  17. theWindow.setVisible(true);
  18. }
  19. }
  20. });
  21. theWindow.setVisible(false);
  22. }
  23. }

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

  1. private void shiftButtonsDown(int offset) {
  2. for (Iterator<JButton> i = buttons.values().iterator(); i.hasNext(); ) {
  3. JButton button = i.next();
  4. button.setBounds( button.getX(),
  5. button.getY() + offset,
  6. button.getWidth(),
  7. button.getHeight());
  8. } // for loop through buttons
  9. for (Iterator<Coordinates> k = lines.iterator(); k.hasNext(); ) {
  10. Coordinates coords = k.next();
  11. coords.setY1(coords.getY1() + offset);
  12. coords.setY2(coords.getY2() + offset);
  13. }
  14. }// private void shiftButtonsDown(int offset)

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

  1. /**
  2. * recalculates all lines from that node to all its children
  3. */
  4. private void recalculateLines(STreeNode node) {
  5. Integer id = node.getID();
  6. JButton button = buttons.get(id);
  7. int bX = button.getX() + button.getWidth()/2;
  8. int bY = button.getY() + button.getHeight();
  9. for (Enumeration<?> e = node.children(); e.hasMoreElements(); ) {
  10. STreeNode subNode = (STreeNode) e.nextElement();
  11. Integer sid = subNode.getID();
  12. JButton subButton = buttons.get(sid);
  13. Coordinates coords = new Coordinates(
  14. bX,
  15. bY,
  16. subButton.getX() + subButton.getWidth()/2,
  17. subButton.getY());
  18. lines.add(coords);
  19. }
  20. }

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

  1. int x = btnEditFilter.getX() + btnEditFilter.getWidth() + 5;
  2. btnClearFilter.setBounds(x, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
  3. fieldPanel.add(btnClearFilter);

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

  1. @Override
  2. public void mousePressed(MouseEvent evt)
  3. {
  4. if(popup != null && popup.isVisible())
  5. popup.setVisible(false);
  6. else
  7. {
  8. popup = dockableWindowManager.createPopupMenu(
  9. FloatingWindowContainer.this,
  10. entry.factory.name,clone);
  11. GUIUtilities.showPopupMenu(popup,
  12. menu,menu.getX(),menu.getY() + menu.getHeight(),
  13. false);
  14. }
  15. }
  16. } //}}}

代码示例来源:origin: khuxtable/seaglass

  1. maxX = lastButton.getX() - titleSpacing;
  2. } else {
  3. maxX = frame.getWidth() - frame.getInsets().right - titleSpacing;
  4. minX = menuButton.getX() + menuButton.getWidth() + titleSpacing;
  5. } else {
  6. minX = lastButton.getX() + lastButton.getWidth() + titleSpacing;
  7. } else {
  8. minX = frame.getInsets().left + titleSpacing;
  9. maxX = menuButton.getX() - titleSpacing;

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

  1. JButton childButton = i.next();
  2. if (left > childButton.getX())
  3. left = childButton.getX();
  4. if (childButton.getX() + childButton.getWidth() > right)
  5. right = childButton.getX() + childButton.getWidth();
  6. if (childButton.getY() < top)
  7. top = childButton.getY();

代码示例来源:origin: khuxtable/seaglass

  1. maxX = lastButton.getX() - titleSpacing;
  2. } else {
  3. maxX = getParentWidth() - getParentInsets().right - titleSpacing;
  4. minX = menuButton.getX() + menuButton.getWidth() + titleSpacing;
  5. } else {
  6. minX = lastButton.getX() + lastButton.getWidth() + titleSpacing;
  7. } else {
  8. minX = getParentInsets().left + titleSpacing;
  9. maxX = getParentWidth() - getParentInsets().right - menuButton.getX() - titleSpacing;

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

  1. thumbMin = sbInsets.left;
  2. thumbMax = XTraScrollBarUI.this.decrButton().getX()

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

  1. leftButton.setBounds(extraX + offset, y, leftButton
  2. .getPreferredSize().width * 2 / 3, blockSize);
  3. rightButton.setBounds(leftButton.getX()
  4. + leftButton.getWidth(), y, rightButton
  5. .getPreferredSize().width * 2 / 3, blockSize);

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

  1. leftButton.setBounds(extraX + offset, y, leftButton
  2. .getPreferredSize().width * 2 / 3, blockSize);
  3. rightButton.setBounds(leftButton.getX()
  4. + leftButton.getWidth(), y, rightButton
  5. .getPreferredSize().width * 2 / 3, blockSize);

相关文章

JButton类方法