1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TestingAgain
{
public static void main(String[] args)
{
JFrame frame = new JFrame("MainFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800, 600);
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.setPreferredSize(new Dimension(800, 600));
JPanel button_Panel = new JPanel();
button_Panel.setPreferredSize(new Dimension(100, 600));
button_Panel.setLayout(new BoxLayout(button_Panel, BoxLayout.Y_AXIS));
JButton button_or = new JButton("Place OR");
JButton button_and = new JButton("Place AND");
button_or.setAlignmentX(Component.LEFT_ALIGNMENT);
button_and.setAlignmentX(Component.LEFT_ALIGNMENT);
frame.setContentPane(mainPanel);
mainPanel.add(button_Panel, BorderLayout.WEST);
button_Panel.add(button_or);
button_Panel.add(button_and);
//frame.pack();
frame.setVisible(true);
}
} |
Partager