Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.40 KB | None | 0 0
  1. import java.awt.FlowLayout;
  2. import java.awt.GridLayout;
  3. import javax.swing.BorderFactory;
  4. import javax.swing.JApplet;
  5. import javax.swing.JButton;
  6. import javax.swing.JCheckBox;
  7. import javax.swing.JComboBox;
  8. import javax.swing.JLabel;
  9. import javax.swing.JPanel;
  10. import javax.swing.JTextField;
  11.  
  12. public class AvionskiBilet extends JApplet{
  13.     String[] destinacii = {"Ilinden", "Nedojdija", "Paris", "Barcelona"};
  14.     JPanel options = new JPanel(new GridLayout(2, 2, 0, 10));
  15.     JPanel options_top = new JPanel(new GridLayout(2, 2));
  16.     JPanel options_bottom = new JPanel(new GridLayout(1, 2, 0, 0));
  17.     JPanel options_bottom_left = new JPanel(new GridLayout(2, 1, 0, 10));
  18.     JPanel options_bottom_right = new JPanel(new GridLayout(3, 1, 0, 5));
  19.     JPanel info = new JPanel(new GridLayout(3, 2));
  20.     JPanel payment = new JPanel(new GridLayout(1, 4));
  21.     JPanel butt = new JPanel (new GridLayout(1, 2));
  22.     JButton buy = new JButton("Buy");
  23.     JButton cancel = new JButton("Cancel");
  24.     JLabel empty = new JLabel();
  25.     JComboBox dest_from = new JComboBox(destinacii);
  26.     JComboBox dest_to = new JComboBox(destinacii);
  27.     JLabel title_dest_from = new JLabel("Destination (from):");
  28.     JLabel title_dest_to = new JLabel("Destination (to):");
  29.     JLabel no_seats = new JLabel("Number of seats:");
  30.     JLabel lug = new JLabel("Type of luggage:");
  31.     JTextField tekst = new JTextField(1);
  32.     JCheckBox bag = new JCheckBox("Bag");
  33.     JCheckBox suitcase = new JCheckBox("Suitcase");
  34.    
  35.     @Override
  36.     public void init() {
  37.         setLayout(new GridLayout(4, 1));
  38.        
  39.         options.setBorder(BorderFactory.createTitledBorder("Flight options:"));
  40.         info.setBorder(BorderFactory.createTitledBorder("Personal info:"));
  41.         payment.setBorder(BorderFactory.createTitledBorder("Payment:"));
  42.         butt.add(empty);
  43.         butt.add(buy);
  44.         butt.add(cancel);
  45.        
  46.         options.add(options_top);
  47.             options_top.add(title_dest_from);
  48.             options_top.add(title_dest_to);
  49.             options_top.add(dest_from);
  50.             options_top.add(dest_to);
  51.         options.add(options_bottom);
  52.         options_bottom.add(options_bottom_left);
  53.             options_bottom_left.add(no_seats);
  54.             options_bottom_left.add(lug);
  55.         options_bottom.add(options_bottom_right);
  56.             options_bottom_right.add(tekst);
  57.             options_bottom_right.add(bag);
  58.             options_bottom_right.add(suitcase);
  59.            
  60.        
  61.         this.getContentPane().add(options);
  62.         this.getContentPane().add(info);
  63.         this.getContentPane().add(payment);
  64.         this.getContentPane().add(butt);
  65.     }
  66.    
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement