Exemplo n.º 1
0
  public MakeReservation() {
    new BorderLayout();

    standardRoom.setMnemonic(KeyEvent.VK_K);
    standardRoom.setActionCommand("Standard Room");
    standardRoom.setSelected(true);

    familyRoom.setMnemonic(KeyEvent.VK_F);
    familyRoom.setActionCommand("Family Room");

    suiteRoom.setMnemonic(KeyEvent.VK_S);
    suiteRoom.setActionCommand("Suite");

    // Add Booking Button
    ImageIcon bookRoomIcon = createImageIcon("images/book.png");
    bookRoom = new JButton("Book Room", bookRoomIcon);
    bookRoom.setVerticalTextPosition(AbstractButton.BOTTOM);
    bookRoom.setHorizontalTextPosition(AbstractButton.CENTER);
    bookRoom.setMnemonic(KeyEvent.VK_M);
    bookRoom.addActionListener(this);
    bookRoom.setActionCommand("book");

    // Group the radio buttons.
    group.add(standardRoom);
    group.add(familyRoom);
    group.add(suiteRoom);

    // Create the labels.
    nameLabel = new JLabel("Name: ");
    amountroomsLabel = new JLabel("How many rooms? ");
    checkoutdateLabel = new JLabel("Check-Out Date: ");
    checkindateLabel = new JLabel("Check-In Date: ");

    // Create the text fields and set them up.
    nameField = new JFormattedTextField();
    nameField.setColumns(10);

    amountroomsField = new JFormattedTextField(new Integer(1));
    amountroomsField.setValue(new Integer(1));
    amountroomsField.setColumns(10);

    // java.util.Date dt_checkin = new java.util.Date();
    LocalDate today = LocalDate.now();
    // java.text.SimpleDateFormat sdf_checkin = new java.text.SimpleDateFormat("MM/dd/yyyy");
    currentDate_checkin = today.toString();
    checkindateField = new JFormattedTextField(currentDate_checkin);
    checkindateField.setColumns(10);

    // java.util.Date dt_checkout = new java.util.Date();
    LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS);
    // java.text.SimpleDateFormat sdf_checkout = new java.text.SimpleDateFormat("MM/dd/yyyy");
    currentDate_checkout = tomorrow.toString();
    checkoutdateField = new JFormattedTextField(currentDate_checkout);
    checkoutdateField.setColumns(10);

    // Tell accessibility tools about label/textfield pairs.
    nameLabel.setLabelFor(nameField);
    amountroomsLabel.setLabelFor(amountroomsField);
    checkoutdateLabel.setLabelFor(checkoutdateField);
    checkindateLabel.setLabelFor(checkindateField);

    // Lay out the labels in a panel.
    JPanel labelPane1 = new JPanel(new GridLayout(0, 1));

    labelPane1.add(amountroomsLabel);

    JPanel labelPane3 = new JPanel(new GridLayout(0, 1));
    labelPane3.add(checkindateLabel);

    JPanel labelPane2 = new JPanel(new GridLayout(0, 1));
    labelPane2.add(checkoutdateLabel);

    JPanel labelPane4 = new JPanel(new GridLayout(0, 1));
    labelPane4.add(nameLabel);

    // Layout the text fields in a panel.
    JPanel fieldPane1 = new JPanel(new GridLayout(0, 1));
    fieldPane1.add(amountroomsField);

    JPanel fieldPane3 = new JPanel(new GridLayout(0, 1));
    fieldPane3.add(checkindateField);

    JPanel fieldPane2 = new JPanel(new GridLayout(0, 1));
    fieldPane2.add(checkoutdateField);

    JPanel fieldPane4 = new JPanel(new GridLayout(0, 1));
    fieldPane4.add(nameField);

    // Put the radio buttons in a column in a panel.
    JPanel radioPanel = new JPanel(new GridLayout(0, 1));
    radioPanel.add(standardRoom);
    radioPanel.add(familyRoom);
    radioPanel.add(suiteRoom);

    // Put the panels in this panel, labels on left,
    // text fields on right.
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    add(labelPane1, BorderLayout.LINE_START);
    add(fieldPane1, BorderLayout.LINE_END);
    add(labelPane3, BorderLayout.LINE_START);
    add(fieldPane3, BorderLayout.LINE_END);
    add(labelPane2, BorderLayout.LINE_START);
    add(fieldPane2, BorderLayout.LINE_END);
    add(labelPane4, BorderLayout.LINE_START);
    add(fieldPane4, BorderLayout.LINE_END);

    add(radioPanel, BorderLayout.LINE_END);
    add(bookRoom);
  }
  public emp() {
    setTitle("AMRITA HUMAN RESOURCE MANAGEMENT SYSTEM    (EMPLOYEE DETAIL)");

    getContentPane().add(p, BorderLayout.CENTER);
    getContentPane().add(q, BorderLayout.SOUTH);

    setTitle("Placement Office");

    lname = new JLabel("Name: ");
    lextra = new JLabel("Vacancy(s): ");
    lfield = new JLabel("Field: ");
    lsal = new JLabel("Minimum Expected Salary: ");
    lusr = new JLabel("Login name: ");
    lpwd = new JLabel("Password: "******"5,000");
    cbsal.addItem("10,000");
    cbsal.addItem("15,000");
    cbsal.addItem("20,000");
    cbsal.setBackground(Color.ORANGE);

    it = new JRadioButton("Software Engg.");
    civil = new JRadioButton("Civil Engg.");
    mech = new JRadioButton("Mechanical Engg.");
    ButtonGroup bg2 = new ButtonGroup();
    bg2.add(it);
    bg2.add(civil);
    bg2.add(mech);
    civil.setBackground(Color.ORANGE);

    bSub = new JButton("Submit");
    bRes = new JButton("Reset");

    p.setLayout(new GridLayout(11, 2));
    Blank = new JLabel("");
    Blank1 = new JLabel("");
    Blank2 = new JLabel("");
    Blank3 = new JLabel("");
    Blank4 = new JLabel("");

    p.add(lusr);
    p.add(tusr);

    p.add(lpwd);
    p.add(tpwd);

    p.add(lname);
    p.add(tname);

    p.add(lextra);
    p.add(textra);

    p.add(lfield);
    p.add(it);

    p.add(Blank4);
    p.add(civil);

    p.add(Blank1);
    p.add(mech);

    p.add(lsal);
    p.add(cbsal);

    q.add(bSub);
    q.add(bRes);

    bSub.addActionListener(this);
    bRes.addActionListener(this);
    setVisible(true);
    setBounds(200, 200, 300, 300);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }