Пример #1
0
  void showPasswordDialog(boolean wasWrong) {
    WebPanel passPanel = new WebPanel();
    WebLabel passLabel = new WebLabel(Tr.tr("Please enter your key password:"******"Wrong password"));
      wrongLabel.setForeground(Color.RED);
      passPanel.add(wrongLabel, BorderLayout.SOUTH);
    }
    WebOptionPane passPane =
        new WebOptionPane(
            passPanel, WebOptionPane.QUESTION_MESSAGE, WebOptionPane.OK_CANCEL_OPTION);
    JDialog dialog = passPane.createDialog(mMainFrame, Tr.tr("Enter password"));
    dialog.setModal(true);
    dialog.addWindowFocusListener(
        new WindowAdapter() {
          @Override
          public void windowGainedFocus(WindowEvent e) {
            passField.requestFocusInWindow();
          }
        });
    // blocking
    dialog.setVisible(true);

    Object value = passPane.getValue();
    if (value != null && value.equals(WebOptionPane.OK_OPTION))
      mControl.connect(passField.getPassword());
  }
Пример #2
0
 public static void showWrongJavaVersionDialog() {
   String jVersion = System.getProperty("java.version");
   if (jVersion.length() >= 3) jVersion = jVersion.substring(2, 3);
   String errorText = Tr.tr("The installed Java version is too old") + ": " + jVersion;
   errorText += System.getProperty("line.separator");
   errorText += Tr.tr("Please install Java 8.");
   WebOptionPane.showMessageDialog(
       null, errorText, Tr.tr("Unsupported Java Version"), WebOptionPane.ERROR_MESSAGE);
 }
Пример #3
0
 private void showAboutDialog() {
   WebPanel aboutPanel = new WebPanel(new GridLayout(0, 1, 5, 5));
   aboutPanel.add(new WebLabel("Kontalk Java Client v" + Kontalk.VERSION));
   WebLinkLabel linkLabel = new WebLinkLabel();
   linkLabel.setLink("http://www.kontalk.org");
   linkLabel.setText(Tr.tr("Visit kontalk.org"));
   aboutPanel.add(linkLabel);
   WebLabel soundLabel = new WebLabel(Tr.tr("Notification sound by") + " FxProSound");
   aboutPanel.add(soundLabel);
   Icon icon = Utils.getIcon("kontalk.png");
   WebOptionPane.showMessageDialog(
       this, aboutPanel, Tr.tr("About"), WebOptionPane.INFORMATION_MESSAGE, icon);
 }
  private void openFile() {
    try {
      String[] client =
          global
              .root
              .getHeaderRootPanel1()
              .getClientComboBox()
              .getSelectedItem()
              .toString()
              .split(", ");
      String matterName =
          global
              .root
              .headerRootPanel1
              .getMatterComboBox()
              .getSelectedItem()
              .toString()
              .substring(
                  0,
                  global
                          .root
                          .headerRootPanel1
                          .getMatterComboBox()
                          .getSelectedItem()
                          .toString()
                          .length()
                      - 13);
      Desktop desktop = Desktop.getDesktop();
      global.MattersRS.first();
      File openFile =
          new File(
              global.archivePath
                  + client[0].trim()
                  + " "
                  + client[1].trim()
                  + "_"
                  + global.ClientIDRS.getInt("ClientID")
                  + "\\"
                  + matterName
                  + "_"
                  + global.ActivityDetailRS.getInt("MatterID")
                  + "\\"
                  + global.ActivityDetailRS.getString("File"));

      if (openFile.exists()) {
        desktop.open(openFile);
      } else {
        WebOptionPane.showMessageDialog(
            global.root, "Sorry, unable to locate file", "Error", WebOptionPane.ERROR_MESSAGE);
      }

    } catch (IOException | SQLException ex) {
      StringWriter error = new StringWriter();
      ex.printStackTrace(new PrintWriter(error));
      SystemCrashDialog crash =
          new SystemCrashDialog(
              global.root,
              true,
              global,
              global.root.getHeaderRootPanel1().getClientComboBox().getSelectedItem().toString(),
              global.root.getHeaderRootPanel1().getMatterComboBox().getSelectedItem().toString(),
              "Err0222",
              error.toString());
    }
  }