@Override
  public JComponent layoutDialogContent() {
    final JPanel contentpane = new JPanel(new MigLayout("ins 0,wrap 2", "[fill,grow]"));
    messageArea = new JTextPane();
    messageArea.setBorder(null);
    messageArea.setBackground(null);
    messageArea.setOpaque(false);
    messageArea.setText(message);
    messageArea.setEditable(false);
    messageArea.putClientProperty("Synthetica.opaque", Boolean.FALSE);

    contentpane.add("span 2", messageArea);
    contentpane.add(new JLabel(_AWU.T.PASSWORDDIALOG_PASSWORDCHANGE_OLDPASSWORD()));
    if (BinaryLogic.containsAll(flagMask, Dialog.STYLE_LARGE)) {
      input1 = new JPasswordField();
      input1.addKeyListener(this);
      input1.addMouseListener(this);
      contentpane.add(new JScrollPane(input1), "height 20:60:n,pushy,growy,w 250");
    } else {
      input1 = new JPasswordField();
      input1.setBorder(BorderFactory.createEtchedBorder());
      input1.addKeyListener(this);
      input1.addMouseListener(this);
      contentpane.add(input1, "pushy,growy,w 250");
    }
    contentpane.add(new JLabel(_AWU.T.PASSWORDDIALOG_PASSWORDCHANGE_NEWPASSWORD()));
    if (BinaryLogic.containsAll(flagMask, Dialog.STYLE_LARGE)) {
      input2 = new JPasswordField();
      input2.addKeyListener(this);
      input2.addMouseListener(this);
      contentpane.add(new JScrollPane(input2), "height 20:60:n,pushy,growy,w 250");
    } else {
      input2 = new JPasswordField();
      input2.setBorder(BorderFactory.createEtchedBorder());
      input2.addKeyListener(this);
      input2.addMouseListener(this);
      contentpane.add(input2, "pushy,growy,w 250");
    }
    contentpane.add(new JLabel(_AWU.T.PASSWORDDIALOG_PASSWORDCHANGE_NEWPASSWORD_REPEAT()));
    if (BinaryLogic.containsAll(flagMask, Dialog.STYLE_LARGE)) {
      input3 = new JPasswordField();
      input3.addKeyListener(this);
      input3.addMouseListener(this);
      contentpane.add(new JScrollPane(input3), "height 20:60:n,pushy,growy,w 250");
    } else {
      input3 = new JPasswordField();
      input3.setBorder(BorderFactory.createEtchedBorder());
      input3.addKeyListener(this);
      input3.addMouseListener(this);
      contentpane.add(input3, "pushy,growy,w 250");
    }

    return contentpane;
  }
  @Override
  public JComponent layoutDialogContent() {
    final JPanel panel = new JPanel(new MigLayout("ins 5,wrap 1", "[fill,grow]"));

    ImageIcon imageIcon = null;

    if (this.imagefile != null && this.imagefile.exists()) {
      imageIcon = new ImageIcon(this.imagefile.getAbsolutePath());
    } else {
      imageIcon = NewTheme.I().getIcon("ocr", 0);
    }

    final int size =
        SubConfiguration.getConfig("JAC").getIntegerProperty(Configuration.PARAM_CAPTCHA_SIZE, 100);
    if (size != 100) {
      imageIcon =
          new ImageIcon(
              imageIcon
                  .getImage()
                  .getScaledInstance(
                      (int) (imageIcon.getIconWidth() * size / 100.0f),
                      (int) (imageIcon.getIconHeight() * size / 100.0f),
                      Image.SCALE_SMOOTH));
    }

    final JLabel captcha = new JLabel(imageIcon);
    captcha.addMouseListener(this);
    captcha.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    captcha.setToolTipText(this.explain);

    if (this.explain != null) {
      final JTextPane tf = new JTextPane();
      tf.setBorder(null);
      tf.setBackground(null);
      tf.setContentType("text/html");
      tf.setOpaque(false);
      tf.putClientProperty("Synthetica.opaque", Boolean.FALSE);
      tf.setText(this.explain);
      tf.setEditable(false);
      panel.add(tf, "");
    }
    panel.add(captcha, "w pref!, h pref!, alignx center");

    return panel;
  }
Exemple #3
0
  /** Constructor. */
  public LegendPanel(int mode, final CyServices cyServices) {
    this.setLayout(new BorderLayout());

    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setContentType("text/html");
    textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    URL legendUrl;
    if (mode == BIOPAX_LEGEND) {
      legendUrl = LegendPanel.class.getResource("legend.html");
    } else {
      legendUrl = LegendPanel.class.getResource("binary_legend.html");
    }
    StringBuffer temp = new StringBuffer();
    temp.append("<html><body>");

    try {
      String legendHtml = retrieveDocument(legendUrl.toString());
      temp.append(legendHtml);
    } catch (Exception e) {
      temp.append("Could not load legend... " + e.toString());
    }

    temp.append("</body></html>");
    textPane.setText(temp.toString());

    textPane.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
            if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              String name = hyperlinkEvent.getDescription();
              if (name.equalsIgnoreCase("filter")) {
                new EdgeFilterUi(cyServices.applicationManager.getCurrentNetwork(), cyServices);
              }
            }
          }
        });

    BioPaxDetailsPanel.modifyStyleSheetForSingleDocument(textPane);

    JScrollPane scrollPane = new JScrollPane(textPane);
    this.add(scrollPane, BorderLayout.CENTER);
  }