本文整理了Java中javax.swing.JButton.getX()
方法的一些代码示例,展示了JButton.getX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.getX()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:getX
暂无
代码示例来源: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: edu.toronto.cs.medsavant/medsavant-client
@Override
public void componentMoved(ComponentEvent ce) {
if (m.isVisible()) {
m.show(pillInstance, editButton.getX(), pillInstance.getHeight());
}
}
代码示例来源: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: 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: 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: robward-scisys/sldeditor
int x = btnEditFilter.getX() + btnEditFilter.getWidth() + 5;
btnClearFilter.setBounds(x, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
fieldPanel.add(btnClearFilter);
代码示例来源: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: khuxtable/seaglass
maxX = lastButton.getX() - titleSpacing;
} else {
maxX = frame.getWidth() - frame.getInsets().right - titleSpacing;
minX = menuButton.getX() + menuButton.getWidth() + titleSpacing;
} else {
minX = lastButton.getX() + lastButton.getWidth() + titleSpacing;
} else {
minX = frame.getInsets().left + titleSpacing;
maxX = menuButton.getX() - titleSpacing;
代码示例来源:origin: uk.ac.gate.plugins/tools
JButton childButton = i.next();
if (left > childButton.getX())
left = childButton.getX();
if (childButton.getX() + childButton.getWidth() > right)
right = childButton.getX() + childButton.getWidth();
if (childButton.getY() < top)
top = childButton.getY();
代码示例来源:origin: khuxtable/seaglass
maxX = lastButton.getX() - titleSpacing;
} else {
maxX = getParentWidth() - getParentInsets().right - titleSpacing;
minX = menuButton.getX() + menuButton.getWidth() + titleSpacing;
} else {
minX = lastButton.getX() + lastButton.getWidth() + titleSpacing;
} else {
minX = getParentInsets().left + titleSpacing;
maxX = getParentWidth() - getParentInsets().right - menuButton.getX() - titleSpacing;
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
thumbMin = sbInsets.left;
thumbMax = XTraScrollBarUI.this.decrButton().getX()
代码示例来源:origin: com.github.insubstantial/substance
leftButton.setBounds(extraX + offset, y, leftButton
.getPreferredSize().width * 2 / 3, blockSize);
rightButton.setBounds(leftButton.getX()
+ leftButton.getWidth(), y, rightButton
.getPreferredSize().width * 2 / 3, blockSize);
代码示例来源:origin: org.java.net.substance/substance
leftButton.setBounds(extraX + offset, y, leftButton
.getPreferredSize().width * 2 / 3, blockSize);
rightButton.setBounds(leftButton.getX()
+ leftButton.getWidth(), y, rightButton
.getPreferredSize().width * 2 / 3, blockSize);
内容来源于网络,如有侵权,请联系作者删除!