Tutorial by Examples

import static java.awt.BorderLayout.*; import javax.swing.*; import java.awt.BorderLayout; JPanel root = new JPanel(new BorderLayout()); root.add(new JButton("East"), EAST); root.add(new JButton("West"), WEST); root.add(new JButton("North"), NORTH); root.add(...
import javax.swing.*; import java.awt.FlowLayout; public class FlowExample { public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable(){ @Override public void run(){ JPanel panel = new JPanel(); pa...
The GridLayout allows you to arrange components in the form of a grid. You pass the number of rows and columns you want the grid to have to the GridLayout's constructor, for example new GridLayout(3, 2) will create a GridLayout with 3 rows and 2 columns. When adding components to a container with ...

Page 1 of 1