Java
Never
import javax.swing.*; import java.awt.*; import java.awt.GridLayout; class Ch14GridLayoutSample extends JFrame { private static final int FRAME_WIDTH = 300; private static final int FRAME_HEIGHT = 200; private static final int FRAME_X_ORIGIN = 150; private static final int FRAME_Y_ORIGIN = 250; //---------------------------------// Main method public static void main(String[]args){ Ch14GridLayoutSample frame = new Ch14GridLayoutSample(); frame.setVisible(true); } public Ch14GridLayoutSample() { Container contentPane; JButton button1, button2, button3, button4, button5; //set the frame properties setSize (FRAME_WIDTH, FRAME_HEIGHT); setTitle ("Program Ch14GridLayoutSample"); setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN); contentPane = getContentPane( ); contentPane.setBackground( Color.WHITE ); contentPane.setLayout(new GridLayout(2,3)); //create and place four buttons on the content pane button1 = new JButton("button 1"); button2 = new JButton("button 2"); button3 = new JButton("button 3"); button4 = new JButton("button 4"); button5 = new JButton("button 5"); contentPane.add(button1); contentPane.add(button2); contentPane.add(button3); contentPane.add(button4); contentPane.add(button5); //register 'Exit upon closing' as a default close operation setDefaultCloseOperation(EXIT_ON_CLOSE ); } } import javax.swing.*; import java.awt.*; import java.awt.BorderLayout; class Ch14BorderLayoutSample extends JFrame { private static final int FRAME_WIDTH = 300; private static final int FRAME_HEIGHT = 200; private static final int FRAME_X_ORIGIN = 150; private static final int FRAME_Y_ORIGIN = 250; public static void main(String[]args){ Ch14BorderLayoutSample frame = new Ch14BorderLayoutSample(); frame.setVisible(true); } public Ch14BorderLayoutSample() { Container contentPane; JButton button1, button2, button3, button4, button5; //set the frame properties setSize (FRAME_WIDTH, FRAME_HEIGHT); setTitle ("Program Ch14BorderLayoutSample"); setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN); contentPane = getContentPane( ); contentPane.setBackground(Color.WHITE); contentPane.setLayout(new BorderLayout()); //contentPane.setLayout(new BorderLayout(/*hgap*/10, /*vgap*/10)); //create and place four buttons on the content pane button1 = new JButton("button 1"); button2 = new JButton("button 2"); button3 = new JButton("button 3"); button4 = new JButton("button 4"); button5 = new JButton("button 5"); contentPane.add(button1, BorderLayout.NORTH); contentPane.add(button2, BorderLayout.SOUTH); contentPane.add(button3, BorderLayout.EAST); contentPane.add(button4, BorderLayout.WEST); contentPane.add(button5, BorderLayout.CENTER); //register 'Exit upon closing' as a default close operation setDefaultCloseOperation( EXIT_ON_CLOSE ); } }
Raw Text
-
Untitled
1 min ago
-
Porno hun vandt mig i Tekken, jeg vandt i køn
13 min ago
-
https://fightupdates.com/haneyvsgarcialivestream/
14 min ago
-
Untitled
18 min ago
-
Untitled
20 min ago
-
Untitled
42 min ago
-
Dahlia Sky And Holly Taylor Love Licking Box
44 min ago
-
CP🍭 VIDEO 😏 R@PED😈 LITTLE GIRL🍼👧💦
44 min ago
-
Untitled
45 min ago
-
dgbg bhtgb tgb
1 hour ago