public void actionPerformed(ActionEvent evt) {
    // Get button clicked
    JButton buttonClicked = (JButton) evt.getSource();
    String actionCommand = new String(buttonClicked.getActionCommand());

    if (actionCommand.equals("Submit")) {
      System.out.println(clientUser.getLogon() + ": updating ticket...");

      // Recover ticket and update it
      Ticket ticketToUpdate = ticket;
      ticketToUpdate.setDesc(clientTicketDialog.getSummaryDescriptionField());
      ticketToUpdate.setResolution(clientTicketDialog.getResolutionDescriptionField());

      // Call checkInTicket() on the RMI object to update the ticket on the server
      try {
        ticketServerObject.checkInTicket(ticketToUpdate);
        // Refresh the activeTickets HashMap
        owner.getActiveTickets();
      } catch (RemoteException re) {
        System.out.println(re.getMessage());
      }

      // Close the ClientTicketDialog
      clientTicketDialog.setVisible(false);
      clientTicketDialog.dispose();
    }
  }
Beispiel #2
0
 public void actionPerformed(ActionEvent ev) {
   System.out.print("ETAT BOUTONS = ");
   for (int i = 0; i < NBOUTONS; i++) System.out.print(tabBout[i].isEnabled() + " ");
   System.out.println();
   JButton source = (JButton) ev.getSource();
   System.out.println("on desactive le bouton : " + source.getActionCommand());
   source.setEnabled(false);
 }
Beispiel #3
0
 public void mouseExited(MouseEvent e) {
   JButton jbutton = (JButton) e.getSource();
   int comm = Integer.parseInt(jbutton.getActionCommand());
   int today = getNowCalendar().get(Calendar.DAY_OF_MONTH);
   if (comm == today) {
     jbutton.setBackground(todayBtnColor);
   } else {
     jbutton.setBackground(palletTableColor);
   }
 }
Beispiel #4
0
  public void actionPerformed(ActionEvent even) {

    Object respuesta = even.getSource(); // se esta diciendo que respuesta sea un objeto.

    if (respuesta == b1) {

      txt = new JTextField(4 + 4);
      setTitle("sumar");
    } else if (respuesta == b2) {

      // txt=new JTextField (4-1);

      txt.setActionCommand("4");
      setTitle("Restar");
    }

    // cambiar el boton b2

    b2.setActionCommand("LOL");
    b2.setLabel(b2.getActionCommand());

    repaint();
  }
Beispiel #5
0
    private void flushWeekAndDayPanal(Calendar c) {
      //            c.set
      c.set(Calendar.DAY_OF_MONTH, 1);
      c.setFirstDayOfWeek(0);
      int firstdayofWeek = c.get(Calendar.DAY_OF_WEEK);
      int lastdayofWeek = c.getActualMaximum(Calendar.DAY_OF_MONTH);
      String colname[] = {"日", "一", "二", "三", "四", "五", "六"};
      int today = getNowCalendar().get(Calendar.DAY_OF_MONTH);
      // 璁剧疆鍥哄畾瀛椾綋锛屼互鍏嶈皟鐢ㄧ幆澧冩敼鍙樺奖鍝嶇晫闈㈢編瑙�
      dayPanel.setFont(new java.awt.Font("寰蒋闆呴粦", java.awt.Font.PLAIN, 12));
      dayPanel.setLayout(new GridBagLayout());
      dayPanel.setBackground(palletTableColor);

      JLabel cell;

      for (int i = 0; i < 7; i++) {
        cell = new JLabel(colname[i]);
        cell.setHorizontalAlignment(JLabel.CENTER);
        cell.setPreferredSize(new Dimension(25, 25));
        if (i == 0 || i == 6) {
          cell.setForeground(weekendFontColor);
        } else {
          cell.setForeground(weekFontColor);
        }
        dayPanel.add(
            cell,
            new GridBagConstraints(
                i,
                0,
                1,
                1,
                0.0,
                0.0,
                GridBagConstraints.CENTER,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0));
      }

      int actionCommandId = 1;
      for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 7; j++) {

          JButton numberButton = daysButton[i][j];
          actionCommandId = Integer.parseInt(numberButton.getActionCommand());
          if (actionCommandId == today) {
            numberButton.setBackground(todayBtnColor);
          }
          if ((actionCommandId + firstdayofWeek - 2) % 7 == 6
              || (actionCommandId + firstdayofWeek - 2) % 7 == 0) {
            numberButton.setForeground(weekendFontColor);
          } else {
            numberButton.setForeground(dateFontColor);
          }
          if (actionCommandId <= lastdayofWeek) {
            int y = 0;
            if ((firstdayofWeek - 1) <= (j + firstdayofWeek - 1) % 7) {
              y = i + 1;
            } else {
              y = i + 2;
            }
            dayPanel.add(
                numberButton,
                new GridBagConstraints(
                    (j + firstdayofWeek - 1) % 7,
                    y,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.NONE,
                    new Insets(0, 0, 0, 0),
                    0,
                    0));
          }
        }
      }
    }