Java Code Examples for javax.swing.JButton#setLocation()

The following examples show how to use javax.swing.JButton#setLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleForm.java    From java-1-class-demos with MIT License 7 votes vote down vote up
public void addBtn(String name) {
	button = new JButton(name);
	button.setVisible(true);
	button.setSize(100, 50);
	button.setLocation(50, 25);
	
	this.add(button);
}
 
Example 2
Source File: SimpleForm.java    From java-1-class-demos with MIT License 7 votes vote down vote up
public void addBtn(String name) {
	button = new JButton(name);
	button.setVisible(true);
	button.setSize(100, 50);
	button.setLocation(50, 25);

	this.add(button);
}
 
Example 3
Source File: ClosableTab.java    From incubator-iotdb with Apache License 2.0 6 votes vote down vote up
ClosableTab(String name, TabCloseCallBack closeCallBack) {
  setName(name);
  setLayout(null);

  closeTabButton = new JButton("Close");
  closeTabButton.setLocation(720, 5);
  closeTabButton.setSize(new Dimension(70, 30));
  closeTabButton.setFont(closeTabButton.getFont().deriveFont(10.0f));
  add(closeTabButton);
  closeTabButton.addActionListener(new AbstractAction() {
    @Override
    public void actionPerformed(ActionEvent e) {
      closeCallBack.call(name);
    }
  });
}
 
Example 4
Source File: SwingBQPMonitor.java    From swift-k with Apache License 2.0 5 votes vote down vote up
private JButton addButton(int x, int y, String t) {
    JButton b = new JButton();
    b.setText(t);
    b.setLocation(x, y);
    b.setSize(44, 24);
    this.add(b);
    b.addActionListener(this);
    return b;
}