Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- import java.applet.Applet;
- import javax.swing.border.TitledBorder;
- public class Airport extends Applet{
- private static final long serialVersionUID = -5436879954963310328L;
- @Override
- public void init(){
- this.setSize(500, 500);
- this.setLayout(new BorderLayout());
- JPanel p1 = new JPanel();
- p1.setLayout(new GridLayout(1,2));
- JPanel p11 = new JPanel();
- p11.setLayout(new GridLayout(4,1));
- JLabel df = new JLabel("Destination(from):");
- df.setHorizontalTextPosition(JLabel.RIGHT);
- p11.add(df);
- JComboBox<String> j1 = new JComboBox<String>();
- j1.addItem("London");
- j1.addItem("Paris");
- j1.addItem("Berlin");
- p11.add(j1);
- p11.add(new JLabel("Number of seats:"));
- p11.add(new JLabel("Type of luggage:"));
- p1.add(p11);
- JPanel p12 = new JPanel();
- p12.setLayout(new GridLayout(4,1));
- JLabel dt = new JLabel("Destination(to):");
- dt.setHorizontalTextPosition(JLabel.CENTER);
- p12.add(dt);
- JComboBox<String> j2 = new JComboBox<String>();
- j2.addItem("Barcelona");
- j2.addItem("Prague");
- j2.addItem("Amsterdam");
- p12.add(j2);
- p12.add(new JTextField());
- JPanel p123 = new JPanel();
- p123.setLayout(new GridLayout(2,1));
- ButtonGroup bt = new ButtonGroup();
- JCheckBox cb1= new JCheckBox("Bag");
- JCheckBox cb2= new JCheckBox("Suitcase");
- bt.add(cb1);
- bt.add(cb2);
- p123.add(cb1);
- p123.add(cb2);
- p12.add(p123);
- p1.add(p12);
- TitledBorder tb1=new TitledBorder("Flight options:");
- p1.setBorder(tb1);
- JPanel p2= new JPanel();
- p2.setLayout(new GridLayout(3,2));
- p2.add(new JLabel("First name:"));
- p2.add(new JTextField());
- p2.add(new JLabel("Last name:"));
- p2.add(new JTextField());
- p2.add(new JLabel("Passport number:"));
- p2.add(new JTextField());
- TitledBorder tb2=new TitledBorder("Personal info:");
- p2.setBorder(tb2);
- JPanel p3= new JPanel();
- p3.setLayout(new GridLayout(1,4));
- p3.add(new JLabel("Card:"));
- ButtonGroup bg = new ButtonGroup();
- JRadioButton a= new JRadioButton("Visa");
- JRadioButton b= new JRadioButton("Maestro");
- JRadioButton c= new JRadioButton("Master");
- bg.add(a);
- bg.add(b);
- bg.add(c);
- p3.add(a);
- p3.add(b);
- p3.add(c);
- TitledBorder tb3=new TitledBorder("Payment:");
- p3.setBorder(tb3);
- JPanel glavna=new JPanel(new GridLayout(3,1));
- glavna.add(p1);
- glavna.add(p2);
- glavna.add(p3);
- JPanel p4= new JPanel();
- p4.setLayout(new GridLayout(1,3));
- JPanel prazna=new JPanel();
- p4.add(prazna);
- JButton quit = new JButton("Quit");
- JButton buy = new JButton("Buy");
- p4.add(quit);
- p4.add(buy);
- this.add(glavna,BorderLayout.CENTER);
- this.add(p4,BorderLayout.SOUTH);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement