Пример #1
0
  void addButton_actionPerformed(ActionEvent e) {
    if (jTextFieldAccountname.getText().length() == 0) {
      JOptionPane.showMessageDialog(
          null, "Fill in the Account Name", "Error", JOptionPane.ERROR_MESSAGE);
      jTextFieldAccountname.requestFocus();
    } else if (jTextFieldFullname.getText().length() == 0) {
      JOptionPane.showMessageDialog(
          null, "Fill in the Full Name", "Error", JOptionPane.ERROR_MESSAGE);
      jTextFieldFullname.requestFocus();
    } else if ((String.valueOf(jPasswordField1.getPassword()))
            .equals(String.valueOf(jPasswordField2.getPassword()))
        == false) {

      JOptionPane.showMessageDialog(
          null, "Passwords don't match", "Error", JOptionPane.ERROR_MESSAGE);
      jPasswordField1.requestFocus();
    } else {
      usermodel.addUser(
          new User(
              jTextFieldAccountname.getText(),
              jTextFieldFullname.getText(),
              jPasswordField1.getPassword()));
      usermodel.fireTableDataChanged();
    }
  }
Пример #2
0
 void deleteButton_actionPerformed(ActionEvent e) {
   int row = table.getSelectedRow();
   if (row != -1) {
     String accountname = (String) usermodel.getValueAt(row, 0);
     usermodel.removeUser(accountname);
     usermodel.fireTableDataChanged();
   }
 }
Пример #3
0
  public AccountPanel() {
    try {
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }

    usermodel.addUser(new User("karl", "Karl Marx", ("rabid#communist").toCharArray()));
    usermodel.addUser(new User("vlad", "Vladimir Lenin", ("looney").toCharArray()));
    table = new JTable(usermodel);
    table.setPreferredScrollableViewportSize(new Dimension(28, 8));
    JScrollPane scrollpane = new JScrollPane(table);
    jPanelUsers.add(scrollpane);
  }
Пример #4
0
  /*
   * Creates new form ChatPanel
   *
   */
  public PlayersChatPanel() {
    userTableModel = new UserTableModel(); // needs to be set before initComponents();

    initComponents();
    setBackground(new Color(0, 0, 0, CHAT_ALPHA));

    jTablePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
    jTablePlayers.setForeground(Color.white);
    jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
    setGUISize();

    TableUtil.setColumnWidthAndOrder(
        jTablePlayers, DEFAULT_COLUMNS_WIDTH, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
    userTableModel.initHeaderTooltips();

    jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());

    jScrollPaneTalk.setSystemMessagesPane(colorPaneSystem);
    jScrollPaneTalk.setOpaque(false);

    jScrollPaneSystem.getViewport().setOpaque(false);
    colorPaneSystem.setExtBackgroundColor(
        new Color(0, 0, 0, CHAT_ALPHA)); // Alpha = 255 not transparent
    colorPaneSystem.setBorder(new EmptyBorder(5, 5, 5, 5));
    if (jScrollPanePlayers != null) {
      jScrollPanePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
      jScrollPanePlayers.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
    }
  }
Пример #5
0
 public void setRoomUserInfo(List<Collection<RoomUsersView>> view) {
   try {
     userTableModel.loadData(view.get(0));
   } catch (Exception ex) {
     this.players.clear();
   }
 }