import javax.swing.*;
import java.awt.*;
public class UITest {
public static void main(String[] args) {
UITest gui = new UITest();
gui.go();
}
public void go() {
//This has a BorderLayout manager's control
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//A JPanel's layout manager is FJowLayout by default.
JPanel panel = new JPanel();
panel.setBackground(Color.darkGray);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
frame.getContentPane().add(BorderLayout.EAST, panel);
JButton button = new JButton("Button 1");
panel.add(button);
button = new JButton("Button button");
panel.add(button);
button = new JButton("Button??");
panel.add(button);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
import java.awt.*;
public class UITest {
public static void main(String[] args) {
UITest gui = new UITest();
gui.go();
}
public void go() {
//This has a BorderLayout manager's control
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//A JPanel's layout manager is FJowLayout by default.
JPanel panel = new JPanel();
panel.setBackground(Color.darkGray);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
frame.getContentPane().add(BorderLayout.EAST, panel);
JButton button = new JButton("Button 1");
panel.add(button);
button = new JButton("Button button");
panel.add(button);
button = new JButton("Button??");
panel.add(button);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
Niciun comentariu:
Trimiteți un comentariu