import java.awt.*;
import javax.swing.*;
public class BorderLayoutExample extends JFrame {
public static void main(String[] args) {
//JFrame.setDefaultLookAndFeelDecorated(true);
JFrame bs = new JFrame();
bs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = bs.getContentPane();
pane.setLayout(new BorderLayout());
JButton label = new JButton("North");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.NORTH);
label = new JButton("South");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.SOUTH);
label = new JButton("East");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.EAST);
label = new JButton("West");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.WEST);
label = new JButton("Center");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.CENTER);
bs.setSize(400, 300);
bs.setVisible(true);
}
}
Friday, 26 January 2018
Related Posts:
login class in javaimport javax.swing.*;import java.awt.*;import javax.swing.text.*;impor… Read More
GridBag Layout demo in java import java.awt.*;import javax.swing.JButton;import javax.swing.JFrame… Read More
Button action listnr example 2 in java import java.awt.BorderLayout;import java.awt.Container;import java.awt… Read More
Gridbag Layout examples in java import javax.swing.*;import java.awt.*;import javax.swing.text.*;impor… Read More
0 comments: