Search in sources :

Example 36 with JPasswordField

use of javax.swing.JPasswordField in project triplea by triplea-game.

the class LobbyGamePanel method mutePlayerInHeadlessHostBot.

private void mutePlayerInHeadlessHostBot() {
    final int selectedIndex = gameTable.getSelectedRow();
    if (selectedIndex == -1) {
        return;
    }
    final int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to perform a remote mute player on this host?", "Remote Player Mute Headless Host Bot", JOptionPane.OK_CANCEL_OPTION);
    if (result != JOptionPane.OK_OPTION) {
        return;
    }
    final String playerToBeMuted = JOptionPane.showInputDialog(getTopLevelAncestor(), "Player Name To Be Muted?", "Player Name To Be Muted?", JOptionPane.QUESTION_MESSAGE);
    if (playerToBeMuted == null) {
        return;
    }
    final Object minutes = JOptionPane.showInputDialog(getTopLevelAncestor(), "Minutes to Mute for?  (between 0 and 2880, choose zero to unmute [works only if players is in the host])", "Minutes to Mute for?", JOptionPane.QUESTION_MESSAGE, null, null, 10);
    if (minutes == null) {
        return;
    }
    final int min;
    try {
        min = Math.max(0, Math.min(60 * 24 * 2, Integer.parseInt((String) minutes)));
    } catch (final NumberFormatException e) {
        return;
    }
    final INode lobbyWatcherNode = getLobbyWatcherNodeForTableRow(selectedIndex);
    final IModeratorController controller = (IModeratorController) messengers.getRemoteMessenger().getRemote(AbstractModeratorController.getModeratorControllerName());
    final JLabel label = new JLabel("Enter Host Remote Access Password, (Leave blank for no password).");
    final JPasswordField passwordField = new JPasswordField();
    final JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(label, BorderLayout.NORTH);
    panel.add(passwordField, BorderLayout.CENTER);
    final int selectedOption = JOptionPane.showOptionDialog(getTopLevelAncestor(), panel, "Host Remote Access Password?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null);
    if (selectedOption != JOptionPane.OK_OPTION || passwordField.getPassword() == null) {
        return;
    }
    final String password = new String(passwordField.getPassword());
    final String salt = controller.getHeadlessHostBotSalt(lobbyWatcherNode);
    final String hashedPassword = hashPassword(password, salt);
    final String response = controller.mutePlayerHeadlessHostBot(lobbyWatcherNode, playerToBeMuted, min, hashedPassword, salt);
    JOptionPane.showMessageDialog(null, (response == null ? "Successfully attempted to mute player (" + playerToBeMuted + ") on host" : "Failed: " + response));
}
Also used : JPanel(javax.swing.JPanel) INode(games.strategy.net.INode) IModeratorController(games.strategy.engine.lobby.server.IModeratorController) BorderLayout(java.awt.BorderLayout) JPasswordField(javax.swing.JPasswordField) JLabel(javax.swing.JLabel)

Example 37 with JPasswordField

use of javax.swing.JPasswordField in project ili2db by claeis.

the class FgdbDbPanel method getDbpwdUi.

/**
 * This method initializes dbpwdUi
 *
 * @return javax.swing.JPasswordField
 */
private JPasswordField getDbpwdUi() {
    if (dbpwdUi == null) {
        dbpwdUi = new JPasswordField();
        dbpwdUi.setColumns(40);
    }
    return dbpwdUi;
}
Also used : JPasswordField(javax.swing.JPasswordField)

Example 38 with JPasswordField

use of javax.swing.JPasswordField in project ili2db by claeis.

the class MdbDbPanel method getDbpwdUi.

/**
 * This method initializes dbpwdUi
 *
 * @return javax.swing.JPasswordField
 */
private JPasswordField getDbpwdUi() {
    if (dbpwdUi == null) {
        dbpwdUi = new JPasswordField();
        dbpwdUi.setColumns(40);
    }
    return dbpwdUi;
}
Also used : JPasswordField(javax.swing.JPasswordField)

Example 39 with JPasswordField

use of javax.swing.JPasswordField in project ili2db by claeis.

the class OraDbPanel method getDbpwdUi.

/**
 * This method initializes dbpwdUi
 *
 * @return javax.swing.JPasswordField
 */
private JPasswordField getDbpwdUi() {
    if (dbpwdUi == null) {
        dbpwdUi = new JPasswordField();
        dbpwdUi.setColumns(40);
    }
    return dbpwdUi;
}
Also used : JPasswordField(javax.swing.JPasswordField)

Example 40 with JPasswordField

use of javax.swing.JPasswordField in project ili2db by claeis.

the class GenericDbPanel method getDbpwdUi.

/**
 * This method initializes dbpwdUi
 *
 * @return javax.swing.JPasswordField
 */
private JPasswordField getDbpwdUi() {
    if (dbpwdUi == null) {
        dbpwdUi = new JPasswordField();
        dbpwdUi.setColumns(40);
    }
    return dbpwdUi;
}
Also used : JPasswordField(javax.swing.JPasswordField)

Aggregations

JPasswordField (javax.swing.JPasswordField)102 JLabel (javax.swing.JLabel)61 JPanel (javax.swing.JPanel)47 JTextField (javax.swing.JTextField)46 BorderLayout (java.awt.BorderLayout)30 JButton (javax.swing.JButton)24 JCheckBox (javax.swing.JCheckBox)24 GridBagLayout (java.awt.GridBagLayout)22 GridBagConstraints (java.awt.GridBagConstraints)19 ActionEvent (java.awt.event.ActionEvent)19 ActionListener (java.awt.event.ActionListener)19 Insets (java.awt.Insets)18 Dimension (java.awt.Dimension)15 WindowAdapter (java.awt.event.WindowAdapter)12 WindowEvent (java.awt.event.WindowEvent)12 EmptyBorder (javax.swing.border.EmptyBorder)12 EtchedBorder (javax.swing.border.EtchedBorder)12 AbstractAction (javax.swing.AbstractAction)11 CompoundBorder (javax.swing.border.CompoundBorder)11 JTextArea (javax.swing.JTextArea)8