I
want to share how to FLOW LAYOUT in J2SE. You can use this code
but if you copy this code and paste in your blog/website, please insert this
link of article.
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Main {
// public Main() {
//}
public static void main(String[] args) {
JFrame frame =new JFrame("FlowLayout LEFT");
FlowLayout layout= new FlowLayout(FlowLayout.LEFT);
layout.setVgap(10);
layout.setHgap(10);
frame.getContentPane().setLayout(layout);
JButton btn1 = new JButton("Position 1");
JButton btn2 = new JButton("Position 2");
JButton btn3= new JButton("Position 3");
JButton btn4 = new JButton("Position 4");
JButton btn5 = new JButton("Position 5");
frame.getContentPane().add(btn1);
frame.getContentPane().add(btn2);
frame.getContentPane().add(btn3);
frame.getContentPane().add(btn4);
frame.getContentPane().add(btn5);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(380,110);
frame.show();
}
}
how to clean DrPen needles – 5 things you should know
2 minggu yang lalu
0 komentar:
Posting Komentar