Menambahkan Button pada java
import javax.swing.*;
public class MyFlowLayout extends JFrame{
public MyFlowLayout() {
setLayout(new FlowLayout());
add(new JButton ("Button 1"));
add(new JButton ("Button 2"));
add(new JButton ("Button 3"));
add(new JButton ("Button 4"));
add(new JButton ("Button 5"));
setTitle("FlowLayout");
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setVisible(true);
}
public static void main(String args[]){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
new MyFlowLayout();
}
});
}
}
{ 0 komentar... Views All / Send Comment! }
Posting Komentar