import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; public class Main{ public static void main(String[] args) { // Layout Manager = Defines the natural layout for components within a container // FlowLayout = places components in a row, sized at their preferred size. // If the horizontal space in the container is too small, // the FlowLayout class uses the next available row. JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 500); frame.setLayout(new FlowLayout(FlowLayout.CENTER,0,0)); frame.add(new JButton("1")); frame.add(new JButton("2")); frame.add(new JButton("3")); frame.add(new JButton("4")); frame.add(new JButton("5")); frame.add(new JButton("6")); frame.add(new JButton("7")); frame.add(new JButton("8")); frame.add(new JButton("9")); frame.setVisible(true); } }
Thank you soooo much for your tutorial, it is so simple and beginner friendly, even me who don't speak fluently english i understood everything. Thank You!!
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
Learned a lot. Haven’t seen all your videos but would like to see some Java programming projects importing files, adding to sql table and run query to fill out forms etc. Thanks
bro, i used the shortcut to create an object of the JButton but if i want to modify my button using methods how should i call the methods with no name?