Hey guys I'm new to this forum so sorry if this is the wrong section.Anyways I was wondering why are the buttons together? View UtZ3Mk.png on ScreenSnapr
Here is the code:
tuna.java
import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class tuna extends JFrame { private JLabel item1; private JButton reg; private JButton reg2; private JButton reg3; public tuna() { super("Matrix-RPG"); setLayout(new FlowLayout()); item1 = new JLabel("Welcome to Matrix RPG"); item1.setToolTipText("Coded in Java by Dayron1234"); add(item1); reg = new JButton("Singleplayer"); add(reg); reg2 = new JButton("Multiplayer"); add(reg2); reg3 = new JButton("Change Language"); add(reg3); } }
apples.java
import javax.swing.JFrame; class apples { public static void main(String[] args) { tuna matrix = new tuna(); matrix.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); matrix.setSize(500, 500); matrix.setVisible(true); } }
I want the buttons on top of each other and centered but I don't know how to do that.If you don't know what I mean then I mean like this:
Singleplayer button
Multiplayer button
Change Langauge
On top of each other and centered.