Java FlowLayout Example Code GUI Tutorials Source code Flow Layout
package edu.umt.guiexamples;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class FlowLayoutExample {
public static void main(String[] args) {
// TODO code application logic here
JFrame f = new JFrame("Flow Layout Example");
JPanel p = new JPanel( );
FlowLayout L = new FlowLayout( );
JButton btnPressMe = new JButton("press me");
JTextField txtName = new JTextField (20);
JLabel lblName = new JLabel ("Name");
p.setLayout(L);
p.add(lblName);
p.add(txtName);
p.add(btnPressMe);
f.setContentPane(p);
f.setSize(300,300);
f.setVisible(true);
}
}
package edu.umt.guiexamples;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class FlowLayoutExample {
public static void main(String[] args) {
// TODO code application logic here
JFrame f = new JFrame("Flow Layout Example");
JPanel p = new JPanel( );
FlowLayout L = new FlowLayout( );
JButton btnPressMe = new JButton("press me");
JTextField txtName = new JTextField (20);
JLabel lblName = new JLabel ("Name");
p.setLayout(L);
p.add(lblName);
p.add(txtName);
p.add(btnPressMe);
f.setContentPane(p);
f.setSize(300,300);
f.setVisible(true);
}
}
0 comments:
Post a Comment