Advertisement
zoro-10

DemoFlowLayout.java

Mar 30th, 2024
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4. public class DemoFlowLayout {
  5.  
  6.   public static void main(String args[]) {
  7.     JFrame frame = new JFrame("Flow Layout");
  8.     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  9.     frame.setSize(300, 100);
  10.     JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  11.     JButton button1 = new JButton("Button1");
  12.     JButton button2 = new JButton("Button2");
  13.     JButton button3 = new JButton("Button3");
  14.     panel.add(button1);
  15.     panel.add(button2);
  16.     panel.add(button3);
  17.     frame.add(panel);
  18.     frame.setVisible(true);
  19.   }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement