Java - How can I edit the size and position of a button using Swing?
- by mino
I have the following code but I'd like to structure several buttons of certain sizes. I'm just wondering how to do this as I've Googled it and found several different methods but none seem to work. Any advice?
import javax.swing.*;
public class GUI {
public static void main(String[] args) {
JFrame window = new JFrame();
window.setSize(500, 500);
window.setTitle("My Application");
JButton button = new JButton("click me");
window.add(button);
window.setVisible(true);
}
}