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

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

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

JButton.getY介绍

暂无

代码示例

代码示例来源: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: 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: stackoverflow.com

  1. contentPanel.setLayout(null); // Absolute positioning of children.
  2. @Override
  3. public void actionPerformed(ActionEvent evt) {
  4. final JButton btn = (JButton) evt.getSource();
  5. final int buttonY = btn.getY(); // Must be final for usage in new Runnable object.
  6. SwingUtilities.invokeLater(new Runnable() { // Return fast from event handling.
  7. @Override
  8. public void run() {
  9. JPanel child = new JPanel();
  10. child.setBackground(Color.RED); // So we'll see it.
  11. child.setBounds(0, buttonY, 100, 300);
  12. contentPanel.removeAll(); // Clear content panel of prior additions.
  13. contentPanel.add(child); // Add a new panel.
  14. contentPanel.repaint(10L);
  15. }
  16. });
  17. }

代码示例来源: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: UNIVALI-LITE/Portugol-Studio

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

代码示例来源: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: stackoverflow.com

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

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

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

代码示例来源: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: uk.ac.gate.plugins/tools

  1. if (childButton.getX() + childButton.getWidth() > right)
  2. right = childButton.getX() + childButton.getWidth();
  3. if (childButton.getY() < top)
  4. top = childButton.getY();

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

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

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

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

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

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

相关文章

JButton类方法