コード例 #1
0
 /**
  * Shows a color chooser dialog and changes the foreground color of the button which is initiating
  * the dialog.
  *
  * @param aButton The button initiating the dialog
  */
 private void showColorChooser(JButton aButton) {
   Color newColor = JColorChooser.showDialog(this, "Choose Text Color", aButton.getForeground());
   if (null != newColor) {
     aButton.setForeground(newColor);
     onChange();
   }
 } // END private void showColorChooser(JButton)
コード例 #2
0
  /**
   * Creates and initializes the components
   *
   * @param userName The name of the user.
   * @param hostName The default hostName.
   */
  private void initialize(String userName, String hostName) {
    components = new ArrayList<JComponent>();
    // status update.
    currentTask = new JLabel();
    Font newFont = currentTask.getFont().deriveFont(8);
    currentTask.setFont(newFont);
    currentTask.setForeground(ScreenLogin.TEXT_COLOR);
    progressBar = new JProgressBar();
    progressBar.setVisible(false);
    progressBar.setStringPainted(false);
    progressBar.setFont(newFont);

    originalName = userName;
    user = new JTextField();
    user.setName("username field");
    user.setText(userName);
    user.setToolTipText("Enter your username.");
    user.setColumns(TEXT_COLUMN);
    pass = new JPasswordField();
    pass.setName("password field");
    pass.setToolTipText("Enter your password.");
    pass.setColumns(TEXT_COLUMN);
    Map<String, String> servers = editor.getServers();
    if (CommonsLangUtils.isNotBlank(hostName)) {
      serverName = hostName;
      // if user did point to another server
      if (servers != null && servers.size() > 0) {
        int n = servers.size() - 1;
        Iterator<String> i = servers.keySet().iterator();
        int k = 0;
        String value;
        while (i.hasNext()) {
          serverName = i.next();
          if (k == n) {
            value = servers.get(serverName);
            if (value != null) {
              try {
                selectedPort = Integer.parseInt(value);
              } catch (Exception e) {
              }
            }
          }
          k++;
        }
      } else {
        editor.removeLastRow();
        editor.addRow(hostName);
      }
    } else {
      if (servers == null || servers.size() == 0) serverName = hostName;
      else {
        int n = servers.size() - 1;
        Iterator<String> i = servers.keySet().iterator();
        int k = 0;
        String value;
        while (i.hasNext()) {
          serverName = i.next();
          if (k == n) {
            value = servers.get(serverName);
            if (value != null) {
              try {
                selectedPort = Integer.parseInt(value);
              } catch (Exception e) {
              }
            }
          }
          k++;
        }
      }
    }
    if (serverName.length() == 0) serverName = DEFAULT_SERVER;
    if (!DEFAULT_SERVER.equals(serverName)) originalServerName = serverName;
    connectionSpeedText = new JLabel(getConnectionSpeed());
    connectionSpeedText.setForeground(TEXT_COLOR);
    connectionSpeedText.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    serverText = UIUtilities.buildTextPane(serverName, TEXT_COLOR);
    serverText.setName("server name text pane");

    serverTextPane = UIUtilities.buildComponentPanelRight(serverText, false);
    serverTextPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    initializeGroups();
    ref = new ArrayList<JComponent>();
    login = new JButton("Login");
    login.setName("login button");
    defaultForeground = login.getForeground();
    login.setMnemonic('L');
    login.setToolTipText("Login");
    setButtonDefault(login);
    login.setEnabled(false);
    // UIUtilities.enterPressesWhenFocused(login);
    UIUtilities.opacityCheck(login);
    cancel = new JButton("Quit");
    cancel.setMnemonic('Q');
    cancel.setToolTipText("Cancel Login.");
    setButtonDefault(cancel);
    UIUtilities.opacityCheck(cancel);
    configButton = new JButton();
    configButton.setName("config server button");
    configButton.setMnemonic('X');
    configButton.setToolTipText("Enter the server's address.");
    configButton.setBorderPainted(false);
    configButton.setBorder(null);
    // configButton.setMargin(new Insets(1, 1, 1, 1));
    configButton.setFocusPainted(false);
    configButton.setContentAreaFilled(false);
    IconManager icons = IconManager.getInstance();
    configButton.setIcon(icons.getIcon(IconManager.CONFIG_24));
    // configButton.setPressedIcon(icons.getIcon(
    //		IconManager.CONFIG_PRESSED_24));

    encrypted = !isEncrypted();
    encryptedButton = new JButton();
    List<String> tips = new ArrayList<String>();
    tips.add("The connection to the server is always encrypted.");
    tips.add(
        "If selected, the data transfer (e.g. annotations, images) " + "will also be encrypted.");
    tips.add("But the transfer will be much slower.");

    encryptedButton.setToolTipText(UIUtilities.formatToolTipText(tips));
    encryptedButton.setBorderPainted(false);
    encryptedButton.setBorder(null);
    encryptedButton.setFocusPainted(false);
    encryptedButton.setContentAreaFilled(false);
    if (encrypted) encryptedButton.setIcon(icons.getIcon(IconManager.ENCRYPTED_24));
    else encryptedButton.setIcon(icons.getIcon(IconManager.DECRYPTED_24));
    getRootPane().setDefaultButton(login);
    enableControls();
  }
コード例 #3
0
 public Color getSyllableColorDefault() {
   return defaultChangeB.getForeground();
 }
コード例 #4
0
 public Color getSyllableColorCaron() {
   return caronChangeB.getForeground();
 }
コード例 #5
0
 public Color getSyllableColorBreve() {
   return breveChangeB.getForeground();
 }
コード例 #6
0
 public Color getSyllableColorMacron() {
   return macronChangeB.getForeground();
 }
コード例 #7
0
 public Color getSyllableColorGrave() {
   return graveChangeB.getForeground();
 }
コード例 #8
0
 public Color getSyllableColorCircumflex() {
   return circumflexChangeB.getForeground();
 }
コード例 #9
0
 public Color getSyllableColorAcute() {
   return acuteChangeB.getForeground();
 }
コード例 #10
0
 // implements IPreferencesEditView
 public Color getResultTextColor() {
   return resultTextChangeB.getForeground();
 } // END public Color getResultTextColor()
コード例 #11
0
 // implements IPreferencesEditView
 public Color getHintTextColor() {
   return hintTextChangeB.getForeground();
 } // END public Color getHintTextColor()