Esempio n. 1
0
    public PropertyPanel(String title, Properties properties) {
      super();
      setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), title));
      setLayout(new GridLayout(1, 1, 10, 10));
      JTextArea area = new JTextArea(Math.min(properties.size(), 20), 40);
      area.setEditable(false);
      area.setOpaque(false);
      area.setTabSize(16);

      Iterator iter = properties.keySet().iterator();
      if (iter.hasNext()) { // first line
        String key = (String) iter.next();
        area.append(key);
        area.append("\t");
        area.append(properties.getProperty(key));
      }
      while (iter.hasNext()) { // remaining lines
        area.append("\n");
        String key = (String) iter.next();
        area.append(key);
        area.append("\t");
        area.append(properties.getProperty(key));
      }
      add(new JScrollPane(area));
    }
Esempio n. 2
0
  private void themeing() {

    aboutDialogLogger.entry();
    Color color = new Color(0, 0, 0, 0);

    mainPanel.setOpaque(false);
    mainPanel.setBackground(new Color(51, 181, 229));

    programLabel.setFont(new Font(programLabel.getFont().getName(), Font.BOLD, 24));

    displayPanel.setOpaque(false);

    licenseScrollPane.setOpaque(false);
    licenseScrollPane.getViewport().setOpaque(false);
    licenseScrollPane.setBorder(null);
    licenseScrollPane.setViewportBorder(null);
    licenseTextArea.setOpaque(false);
    licenseTextArea.setBackground(color);
    licenseTextArea.setEditable(false);

    developerScrollPane.setOpaque(false);
    developerScrollPane.getViewport().setOpaque(false);
    developerScrollPane.setBorder(null);
    developerScrollPane.setViewportBorder(null);
    developerPane.setOpaque(false);
    developerPane.setBackground(color);
    developerPane.setEditable(false);
    emptyPanel.setOpaque(false);
    aboutDialogLogger.exit(LoggerValues.SUCCESSFUL_EXIT);
  }
Esempio n. 3
0
 /** Create and add Clippy's output text */
 public void addClippyTxt() {
   clippyTxt.setLineWrap(true);
   clippyTxt.setWrapStyleWord(true);
   clippyTxt.setEditable(false);
   clippyTxt.setFont(txtFont);
   clippyTxt.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
   clippyTxt.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
   clippyTxt.setBorder(null);
   clippyTxt.setSize(105, 35);
   clippyTxt.setLocation(25, 45);
   clippyTxt.setOpaque(false);
   lpane.add(clippyTxt, new Integer(1), 0);
 }
Esempio n. 4
0
  public MomentCellContent() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    MomTextArea = new JTextArea("this is my first moment!");
    MomTextArea.setLineWrap(true);
    // MomTextArea.setBackground(new Color(220, 220, 220));
    MomTextArea.setWrapStyleWord(true);
    MomTextArea.setAlignmentY(0.0f);
    MomTextArea.setEditable(false);
    MomTextArea.setOpaque(false);
    // MomTextArea.setPreferredSize(new Dimension(400, 100));
    MomTextArea.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(MomTextArea);
    add(lblPic);
  }
Esempio n. 5
0
 void init() {
   JPanel panel1 = new JJPanel(imgPath);
   JTextArea textArea = new JTextArea();
   textArea.setEditable(false);
   ImageIcon img = new ImageIcon(Policy.class.getResource("/source/image/lazy.jpg"));
   JLabel label1 = new JLabel(img);
   label1.setOpaque(false);
   String str =
       "0.特别提醒,为了充分了解软件的功能及使用\n"
           + "1.登陆后查看帮助说明\n"
           + ""
           + "2.否则您将无法充分使用该软件\n"
           + "3.你会一直报告此软件BUG\n"
           + "4.本软件遵守GPL许可协议\n";
   textArea.append(str);
   textArea.setOpaque(false);
   textArea.setFont(new Font("微软雅黑", Font.ITALIC, 20));
   Box box = Box.createVerticalBox();
   box.add(label1);
   box.add(Box.createVerticalStrut(30));
   box.add(textArea);
   box.add(Box.createVerticalStrut(30));
   JCheckBox check = new JCheckBox(new HTMLString().getLabelString("我自愿同意以上协议", "blue"));
   //		check.setOpaque(false);
   check.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent ie) {
           if (ie.getStateChange() == ItemEvent.SELECTED) {
             policyB = true;
           }
         }
       });
   box.add(check);
   box.add(Box.createVerticalStrut(20));
   Box box1 = Box.createHorizontalBox();
   JButton confirm = new JButton("确定");
   JButton cancel = new JButton("取消");
   box1.add(Box.createHorizontalStrut(50));
   box1.add(confirm);
   box1.add(Box.createHorizontalStrut(50));
   box1.add(cancel);
   confirm.addActionListener(this);
   cancel.addActionListener(this);
   box.add(box1);
   panel1.add(box);
   add(panel1);
 }
Esempio n. 6
0
  public ButtonsRenderer(DefaultListModel<E> model) {
    super(new BorderLayout());
    this.model = model;
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
    setOpaque(true);
    label.setLineWrap(true);
    label.setOpaque(false);
    add(label);

    Box box = Box.createHorizontalBox();
    for (JButton b : Arrays.asList(deleteButton, copyButton)) {
      b.setFocusable(false);
      b.setRolloverEnabled(false);
      box.add(b);
      box.add(Box.createHorizontalStrut(5));
    }
    add(box, BorderLayout.EAST);
  }
 public JPanel getFunctionPanel() {
   JPanel p = new JPanel();
   functionPanel.setLayout(new BoxLayout(functionPanel, BoxLayout.Y_AXIS));
   p.setBorder(BorderFactory.createTitledBorder("Status:"));
   scroll = new JScrollPane(statusArea);
   statusArea.setEditable(false);
   statusArea.setOpaque(false);
   statusArea.setLineWrap(true);
   statusArea.setWrapStyleWord(true);
   statusArea.setFont(new Font("Arial", Font.PLAIN, 9));
   for (JPanel o : form.getFormList()) {
     functionPanel.add(o);
   }
   scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   ((DefaultCaret) statusArea.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
   p.add(scroll);
   functionPanel.add(p);
   return functionPanel;
 }
  private void jbInit() throws Exception {

    final JLabel textAndFont = new JLabel(Messages.getMessage("PdfViewerLabel.TextAndFont"));
    textAndFont.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    textAndFont.setDisplayedMnemonic('0');
    textAndFont.setBounds(new Rectangle(13, 13, 220, 26));

    final JLabel left = new JLabel(Messages.getMessage("PdfViewerLabel.Left"));
    left.setBounds(new Rectangle(130, 40, 50, 23));

    final JLabel center = new JLabel(Messages.getMessage("PdfViewerLabel.Center"));
    center.setBounds(new Rectangle(300, 40, 50, 23));

    final JLabel right = new JLabel(Messages.getMessage("PdfViewerLabel.Right"));
    right.setBounds(new Rectangle(475, 40, 50, 23));

    final JLabel header = new JLabel(Messages.getMessage("PdfViewerLabel.Header"));
    header.setBounds(new Rectangle(20, 60, 90, 23));

    final JLabel footer = new JLabel(Messages.getMessage("PdfViewerLabel.Footer"));
    footer.setBounds(new Rectangle(20, 90, 50, 23));

    leftHeaderBox.setBounds(new Rectangle(85, 60, 133, 23));
    centerHeaderBox.setBounds(new Rectangle(250, 60, 133, 23));
    rightHeaderBox.setBounds(new Rectangle(425, 60, 133, 23));

    leftFooterBox.setBounds(new Rectangle(85, 90, 133, 23));
    centerFooterBox.setBounds(new Rectangle(250, 90, 133, 23));
    rightFooterBox.setBounds(new Rectangle(425, 90, 133, 23));

    final JLabel font = new JLabel(Messages.getMessage("PdfViewerLabel.Font"));
    font.setBounds(new Rectangle(20, 120, 75, 23));

    fontsList.setBounds(new Rectangle(85, 120, 150, 23));
    fontsList.setSelectedItem("Helvetica");

    final JLabel size = new JLabel(Messages.getMessage("PdfViewerLabel.Size"));
    size.setBounds(new Rectangle(250, 120, 50, 23));

    fontSize.setBounds(new Rectangle(290, 120, 50, 23));

    final JLabel color = new JLabel(Messages.getMessage("PdfViewerLabel.Color"));
    color.setBounds(new Rectangle(360, 120, 50, 23));

    colorBox.setBackground(Color.black);
    colorBox.setOpaque(true);
    colorBox.setBounds(new Rectangle(410, 120, 23, 23));

    final JButton chooseColor = new JButton(Messages.getMessage("PdfViewerButton.ChooseColor"));
    chooseColor.setBounds(new Rectangle(450, 120, 160, 23));
    chooseColor.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            colorBox.setBackground(
                JColorChooser.showDialog(null, "Color", colorBox.getBackground()));
          }
        });

    tagsList.setText(
        "You may use the following\n"
            + "tags as part of the text.\n\n"
            + "<d> - Date in short format\n"
            + "<D> - Date in long format\n"
            + "<t> - Time in 12-hour format\n"
            + "<T> - Time in 24-hour format\n"
            + "<f> - Filename\n"
            + "<F> - Full path filename\n"
            + "<p> - Current page number\n"
            + "<P> - Total number of pages");
    tagsList.setOpaque(false);
    tagsList.setBounds(350, 160, 200, 210);

    final JLabel margins = new JLabel(Messages.getMessage("PdfViewerLabel.Margins"));

    margins.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    margins.setDisplayedMnemonic('0');
    margins.setBounds(new Rectangle(13, 150, 220, 26));

    final JLabel leftRight = new JLabel(Messages.getMessage("PdfViewerLabel.LeftAndRight"));
    leftRight.setBounds(new Rectangle(20, 185, 90, 23));

    leftRightBox.setBounds(new Rectangle(100, 185, 70, 23));

    final JLabel topBottom = new JLabel(Messages.getMessage("PdfViewerLabel.TopAndBottom"));
    topBottom.setBounds(new Rectangle(180, 185, 120, 23));

    topBottomBox.setBounds(new Rectangle(300, 185, 70, 23));

    pageRangeLabel.setText(Messages.getMessage("PdfViewerPageRange.text"));
    pageRangeLabel.setBounds(new Rectangle(13, 220, 400, 26));

    printAll.setText(Messages.getMessage("PdfViewerRadioButton.All"));
    printAll.setBounds(new Rectangle(23, 250, 75, 22));

    printCurrent.setText(Messages.getMessage("PdfViewerRadioButton.CurrentPage"));
    printCurrent.setBounds(new Rectangle(23, 270, 100, 22));
    printCurrent.setSelected(true);

    printPages.setText(Messages.getMessage("PdfViewerRadioButton.Pages"));
    printPages.setBounds(new Rectangle(23, 292, 70, 22));

    pagesBox.setBounds(new Rectangle(95, 292, 230, 22));
    pagesBox.addKeyListener(
        new KeyListener() {
          @Override
          public void keyPressed(final KeyEvent arg0) {}

          @Override
          public void keyReleased(final KeyEvent arg0) {
            if (pagesBox.getText().isEmpty()) {
              printCurrent.setSelected(true);
            } else {
              printPages.setSelected(true);
            }
          }

          @Override
          public void keyTyped(final KeyEvent arg0) {}
        });

    final JTextArea pagesInfo =
        new JTextArea(Messages.getMessage("PdfViewerMessage.PageNumberOrRangeLong"));
    pagesInfo.setBounds(new Rectangle(23, 320, 620, 40));
    pagesInfo.setOpaque(false);

    this.add(printAll, null);
    this.add(printCurrent, null);

    this.add(printPages, null);
    this.add(pagesBox, null);
    this.add(pagesInfo, null);

    this.add(left, null);
    this.add(center, null);
    this.add(right, null);
    this.add(header, null);
    this.add(footer, null);
    this.add(leftHeaderBox, null);
    this.add(centerHeaderBox, null);
    this.add(rightHeaderBox, null);
    this.add(leftFooterBox, null);
    this.add(centerFooterBox, null);
    this.add(rightFooterBox, null);
    this.add(font, null);
    this.add(fontsList, null);
    this.add(size, null);
    this.add(fontSize, null);
    this.add(color, null);
    this.add(colorBox, null);
    this.add(chooseColor, null);
    this.add(margins, null);
    this.add(leftRight, null);
    this.add(leftRightBox, null);
    this.add(topBottom, null);
    this.add(topBottomBox, null);

    this.add(textAndFont, null);
    this.add(changeButton, null);
    this.add(pageRangeLabel, null);

    // this.add(tagsList, null);

    this.add(jToggleButton2, null);
    this.add(jToggleButton3, null);

    buttonGroup1.add(printAll);
    buttonGroup1.add(printCurrent);
    buttonGroup1.add(printPages);
  }
Esempio n. 9
0
  public RegisterPane(final Controller controller) {

    setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();

    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridBagLayout());
    panel1.setOpaque(false);

    titleLabel = new JLabel("Create a new account");
    titleLabel.setForeground(Color.WHITE);
    titleLabel.setFont(new Font("Helvatica", Font.BOLD, 14));
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 3;
    panel1.add(titleLabel, constraints);

    usernameLabel = new JLabel("Username:"******"Email:");
    emailLabel.setForeground(Color.WHITE);
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.insets.top = 0;
    constraints.anchor = GridBagConstraints.EAST;
    panel1.add(emailLabel, constraints);

    emailField = new JTextField(16);
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.gridwidth = 3;
    constraints.insets.top = 0;
    constraints.anchor = GridBagConstraints.EAST;
    panel1.add(emailField, constraints);

    passwordLabel = new JLabel("Password:"******"Register");
    constraints.gridx = 3;
    constraints.gridy = 4;
    constraints.gridwidth = 1;
    constraints.insets.top = 20;
    constraints.ipady = 5;
    constraints.anchor = GridBagConstraints.EAST;
    panel1.add(registerButton, constraints);

    registerButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (registerButton.isEnabled()) {
              statusLabel.setText("");
              controller.register(
                  usernameField.getText(),
                  emailField.getText(),
                  new String(passwordField.getPassword()));
              registerButton.setEnabled(false);
            }
          }
        });

    backButton = new JLabel("<HTML><FONT color=\"#00ffff\"><U>Back</U></FONT></HTML>");
    backButton.setOpaque(false);
    backButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    constraints.gridx = 3;
    constraints.gridy = 5;
    constraints.gridwidth = 1;
    constraints.insets.top = 20;
    constraints.insets.right = 0;
    constraints.ipady = 5;
    constraints.anchor = GridBagConstraints.EAST;
    panel1.add(backButton, constraints);

    backButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (backButton.isEnabled()) {
              controller.goBack(RegisterPane.class);
            }
          }
        });

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.insets.top = 0;
    constraints.insets.right = 0;
    constraints.ipady = 0;
    constraints.anchor = GridBagConstraints.CENTER;
    add(panel1, constraints);

    JPanel panel2 = new JPanel();
    panel2.setLayout(new BorderLayout());
    panel2.setOpaque(false);

    statusLabel = new JTextArea();
    statusLabel.putClientProperty("html.disable", Boolean.TRUE);
    statusLabel.setFont(statusLabel.getFont().deriveFont(Font.BOLD));
    statusLabel.setBackground(new Color(0, 0, 0, 0));
    statusLabel.setForeground(Color.PINK);
    statusLabel.setOpaque(false);
    statusLabel.setBorder(null);
    statusLabel.setEditable(false);
    // statusLabel.setHorizontalAlignment(SwingConstants.CENTER);

    panel2.add(statusLabel, BorderLayout.CENTER);

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.insets.top = 20;
    constraints.insets.right = 0;
    constraints.ipady = 5;
    constraints.anchor = GridBagConstraints.WEST;
    add(panel2, constraints);
  }
Esempio n. 10
0
  protected void initializeWidgets() {
    textArea_ = new JTextArea();
    textArea_.setFont(new Font("Arial", Font.PLAIN, 12));
    textArea_.setWrapStyleWord(true);
    textArea_.setText(instructionsText_);
    textArea_.setEditable(false);
    textArea_.setOpaque(false);
    getContentPane().add(textArea_);
    springLayout_.putConstraint(
        SpringLayout.EAST, textArea_, 250, SpringLayout.WEST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.WEST, textArea_, 5, SpringLayout.WEST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.SOUTH, textArea_, 37, SpringLayout.NORTH, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.NORTH, textArea_, 5, SpringLayout.NORTH, getContentPane());

    if (showShowReadonlyCheckBox_) {
      showReadonlyCheckBox_ = new JCheckBox();
      showReadonlyCheckBox_.setFont(new Font("Arial", Font.PLAIN, 10));
      showReadonlyCheckBox_.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              // show/hide read-only properties
              data_.setShowReadOnly(showReadonlyCheckBox_.isSelected());
              data_.update();
              data_.fireTableStructureChanged();
            }
          });
      showReadonlyCheckBox_.setText("Show read-only properties");
      getContentPane().add(showReadonlyCheckBox_);
      springLayout_.putConstraint(
          SpringLayout.EAST, showReadonlyCheckBox_, 250, SpringLayout.WEST, getContentPane());
      springLayout_.putConstraint(
          SpringLayout.WEST, showReadonlyCheckBox_, 5, SpringLayout.WEST, getContentPane());
      springLayout_.putConstraint(
          SpringLayout.NORTH, showReadonlyCheckBox_, 45, SpringLayout.NORTH, getContentPane());
      springLayout_.putConstraint(
          SpringLayout.SOUTH, showReadonlyCheckBox_, 70, SpringLayout.NORTH, getContentPane());
    }

    nameField_ = new JTextField();
    nameField_.setText(initName_);
    nameField_.setEditable(true);
    nameField_.setSelectionStart(0);
    nameField_.setSelectionEnd(nameField_.getText().length());
    getContentPane().add(nameField_);
    springLayout_.putConstraint(
        SpringLayout.EAST, nameField_, 280, SpringLayout.WEST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.WEST, nameField_, 95, SpringLayout.WEST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.SOUTH, nameField_, -3, SpringLayout.NORTH, scrollPane_);
    springLayout_.putConstraint(
        SpringLayout.NORTH, nameField_, -30, SpringLayout.NORTH, scrollPane_);

    nameFieldLabel_ = new JLabel();
    nameFieldLabel_.setText(nameFieldLabelText_);
    nameFieldLabel_.setFont(new Font("Arial", Font.BOLD, 12));
    nameFieldLabel_.setHorizontalAlignment(SwingConstants.RIGHT);
    getContentPane().add(nameFieldLabel_);
    springLayout_.putConstraint(
        SpringLayout.EAST, nameFieldLabel_, 90, SpringLayout.WEST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.WEST, nameFieldLabel_, 5, SpringLayout.WEST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.SOUTH, nameFieldLabel_, -3, SpringLayout.NORTH, scrollPane_);
    springLayout_.putConstraint(
        SpringLayout.NORTH, nameFieldLabel_, -30, SpringLayout.NORTH, scrollPane_);

    okButton_ = new JButton("OK");
    getContentPane().add(okButton_);
    springLayout_.putConstraint(
        SpringLayout.EAST, okButton_, -5, SpringLayout.EAST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.WEST, okButton_, -105, SpringLayout.EAST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.SOUTH, okButton_, 30, SpringLayout.NORTH, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.NORTH, okButton_, 5, SpringLayout.NORTH, getContentPane());
    okButton_.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            okChosen();
          }
        });

    cancelButton_ = new JButton("Cancel");
    getContentPane().add(cancelButton_);
    springLayout_.putConstraint(
        SpringLayout.EAST, cancelButton_, -5, SpringLayout.EAST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.WEST, cancelButton_, -105, SpringLayout.EAST, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.SOUTH, cancelButton_, 57, SpringLayout.NORTH, getContentPane());
    springLayout_.putConstraint(
        SpringLayout.NORTH, cancelButton_, 32, SpringLayout.NORTH, getContentPane());
    cancelButton_.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancelChosen();
          }
        });
  }
Esempio n. 11
0
  public AboutDialog(Frame frame) {
    super(frame);
    JLabel imageLabel;
    GridBagConstraints gridBagConstraints;
    JButton closeButton;
    getContentPane().setLayout(new GridBagLayout());
    setTitle("About");
    setBounds(100, 100, 242, 158);

    imageLabel = new JLabel();
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(10, 5, 0, 10);
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridx = 0;
    imageLabel.setText("");
    imageLabel.setMinimumSize(new Dimension(50, 18));
    imageLabel.setPreferredSize(new Dimension(50, 18));
    imageLabel.setIcon(createImageIcon("/wowc.gif", "WoWC"));
    getContentPane().add(imageLabel, gridBagConstraints);

    textArea = new JTextArea();
    textArea.setOpaque(false);
    textArea.setColumns(30);
    textArea.setRows(4);
    textArea.setTabSize(4);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(10, 0, 10, 5);
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridx = 1;
    getContentPane().add(textArea, gridBagConstraints);
    Font font = new Font("Arial", Font.PLAIN, 10);
    textArea.setFont(new Font("Arial", Font.PLAIN, 10));

    String about =
        "Created by arimus & ulic\nCouncil of Thoyr, Lightbringer\n\n(C) Copyright David Castro, 2005\nAll rights reserved";
    try {
      about = new WoWConfig().getProperty("about.info");
    } catch (WoWConfigException e) {
      // do nothing
    } catch (WoWConfigPropertyNotFoundException e) {
      // do nothing
    }
    textArea.setText(about);
    textArea.setEditable(false);

    closeButton = new JButton();
    closeButton.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {}

          public void mouseReleased(MouseEvent e) {
            setVisible(false);
          }
        });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints.anchor = GridBagConstraints.EAST;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridx = 1;
    getContentPane().add(closeButton, gridBagConstraints);
    closeButton.setText("Close");
    //
  }
Esempio n. 12
0
  private void jbInit() throws Exception {

    direction.setFont(new java.awt.Font("Dialog", 1, 14));
    direction.setDisplayedMnemonic('0');
    direction.setBounds(new Rectangle(13, 13, 220, 26));

    directionBox.setBounds(new Rectangle(23, 40, 300, 23));

    pageRangeLabel.setText(Messages.getMessage("PdfViewerPageRange.text"));
    pageRangeLabel.setBounds(new Rectangle(13, 71, 199, 26));

    printAll.setText(Messages.getMessage("PdfViewerRadioButton.All"));
    printAll.setBounds(new Rectangle(23, 100, 75, 22));

    printCurrent.setText(Messages.getMessage("PdfViewerRadioButton.CurrentPage"));
    printCurrent.setBounds(new Rectangle(23, 120, 100, 22));
    printCurrent.setSelected(true);

    printPages.setText(Messages.getMessage("PdfViewerRadioButton.Pages"));
    printPages.setBounds(new Rectangle(23, 142, 70, 22));

    pagesBox.setBounds(new Rectangle(95, 142, 200, 22));
    pagesBox.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {}

          public void keyReleased(KeyEvent arg0) {
            if (pagesBox.getText().length() == 0) printCurrent.setSelected(true);
            else printPages.setSelected(true);
          }

          public void keyTyped(KeyEvent arg0) {}
        });

    JTextArea pagesInfo =
        new JTextArea(
            Messages.getMessage("PdfViewerMessage.PageNumberOrRange")
                + '\n'
                + Messages.getMessage("PdfViewerMessage.PageRangeExample"));
    pagesInfo.setBounds(new Rectangle(23, 185, 400, 40));
    pagesInfo.setOpaque(false);

    optionsForFilesLabel.setBounds(new Rectangle(13, 220, 199, 26));

    this.add(printAll, null);
    this.add(printCurrent, null);

    this.add(printPages, null);
    this.add(pagesBox, null);
    this.add(pagesInfo, null);

    this.add(directionBox, null);
    this.add(direction, null);
    this.add(changeButton, null);
    this.add(pageRangeLabel, null);

    this.add(jToggleButton2, null);
    this.add(jToggleButton3, null);

    buttonGroup1.add(printAll);
    buttonGroup1.add(printCurrent);
    buttonGroup1.add(printPages);
  }
Esempio n. 13
0
  // initializes the internal component of the translator
  protected void jbInit() {
    this.getContentPane().setLayout(new GridBagLayout());

    loadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadButton_actionPerformed(e);
          }
        });
    loadButton.setMaximumSize(new Dimension(39, 39));
    loadButton.setMinimumSize(new Dimension(39, 39));
    loadButton.setPreferredSize(new Dimension(39, 39));
    loadButton.setSize(new Dimension(39, 39));
    loadButton.setToolTipText("Load Source File");
    loadButton.setIcon(loadIcon);

    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveButton_actionPerformed(e);
          }
        });
    saveButton.setMaximumSize(new Dimension(39, 39));
    saveButton.setMinimumSize(new Dimension(39, 39));
    saveButton.setPreferredSize(new Dimension(39, 39));
    saveButton.setSize(new Dimension(39, 39));
    saveButton.setToolTipText("Save Destination File");
    saveButton.setIcon(saveIcon);

    singleStepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepButton_actionPerformed(e);
          }
        });
    singleStepButton.setMaximumSize(new Dimension(39, 39));
    singleStepButton.setMinimumSize(new Dimension(39, 39));
    singleStepButton.setPreferredSize(new Dimension(39, 39));
    singleStepButton.setSize(new Dimension(39, 39));
    singleStepButton.setToolTipText("Single Step");
    singleStepButton.setIcon(singleStepIcon);

    ffwdButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdButton_actionPerformed(e);
          }
        });
    ffwdButton.setMaximumSize(new Dimension(39, 39));
    ffwdButton.setMinimumSize(new Dimension(39, 39));
    ffwdButton.setPreferredSize(new Dimension(39, 39));
    ffwdButton.setSize(new Dimension(39, 39));
    ffwdButton.setToolTipText("Fast Forward");
    ffwdButton.setIcon(ffwdIcon);

    rewindButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindButton_actionPerformed(e);
          }
        });
    rewindButton.setMaximumSize(new Dimension(39, 39));
    rewindButton.setMinimumSize(new Dimension(39, 39));
    rewindButton.setPreferredSize(new Dimension(39, 39));
    rewindButton.setSize(new Dimension(39, 39));
    rewindButton.setToolTipText("Rewind");
    rewindButton.setIcon(rewindIcon);

    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed(e);
          }
        });
    stopButton.setMaximumSize(new Dimension(39, 39));
    stopButton.setMinimumSize(new Dimension(39, 39));
    stopButton.setPreferredSize(new Dimension(39, 39));
    stopButton.setSize(new Dimension(39, 39));
    stopButton.setToolTipText("Stop");
    stopButton.setIcon(stopIcon);

    fullTranslationButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fullTranslationButton_actionPerformed(e);
          }
        });
    fullTranslationButton.setMaximumSize(new Dimension(39, 39));
    fullTranslationButton.setMinimumSize(new Dimension(39, 39));
    fullTranslationButton.setPreferredSize(new Dimension(39, 39));
    fullTranslationButton.setSize(new Dimension(39, 39));
    fullTranslationButton.setToolTipText("Fast Translation");
    fullTranslationButton.setIcon(fullTranslationIcon);

    messageLbl.setFont(Utilities.statusLineFont);
    messageLbl.setLineWrap(true);
    messageLbl.setEditable(false);
    messageLbl.setCursor(null);
    messageLbl.setOpaque(false);
    messageLbl.setFocusable(false);
    messageLblPane.setBorder(BorderFactory.createLoweredBevelBorder());
    // messageLblPane.setBounds(new Rectangle(0, 672, TRANSLATOR_WIDTH - 8, 20));
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 2;
    this.getContentPane().add(messageLblPane, c);

    // arrowLabel.setBounds(new Rectangle(290, 324, 88, 71));
    arrowLabel.setIcon(arrowIcon);

    // source.setVisibleRows(31);
    // destination.setVisibleRows(31);
    // source.setBounds(new Rectangle(35,100,source.getWidth(),source.getHeight()));
    // destination.setBounds(new Rectangle(375,100,destination.getWidth(),destination.getHeight()));

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 1;
    this.getContentPane().add(source, c);

    c.fill = GridBagConstraints.NONE;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 1;
    c.gridy = 1;
    this.getContentPane().add(arrowLabel, c);

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 2;
    c.gridy = 1;
    this.getContentPane().add(destination, c);

    // Adding the tool bar to this container.
    toolBar.setFloatable(false);
    toolBar.setLocation(0, 0);
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    arrangeToolBar();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 0;
    this.getContentPane().add(toolBar, c);
    toolBar.revalidate();
    toolBar.repaint();
    repaint();

    // Creating the menu bar
    arrangeMenu();
    setJMenuBar(menuBar);

    // initializing the window size and visibility
    setDefaultCloseOperation(3);
    setSize(new Dimension(TRANSLATOR_WIDTH, TRANSLATOR_HEIGHT));
    setVisible(true);
  }
  public NDVIMaskDialog(final ToolAdder ta) {
    setBounds(100, 100, 450, 466);
    getContentPane().setLayout(new BorderLayout());
    this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(this.contentPanel, "Center");
    setAlwaysOnTop(true);
    this.contentPanel.setLayout(null);

    JTextArea txtrUseTheText = new JTextArea();
    txtrUseTheText.setFont(new Font("SansSerif", 0, 13));
    txtrUseTheText.setText(
        "Use the text boxes below to type the minimum and maximum NDVI values to be used to study land cover change over time.\r\n\r\nNDVI values range between -1.00 and 1.00. Type only numbers in the text boxes below.\r\n\r\nThe percent of pixels between these NDVI values will be automatically calculated for the selected area (rectangle or polygon).\r\n\r\nIf an area hasn't been created, click the \"Use Values\" then draw a rectangle or polygon on one of the images.\r\n\r\nIf an area has been created, click the \"Use Values\" to graph the amount of pixels within the new NDVI values.\r\n\r\nTIP: Keep this window open to quickly change NDVI values. Close the window when done.");
    txtrUseTheText.setOpaque(false);
    txtrUseTheText.setWrapStyleWord(true);
    txtrUseTheText.setLineWrap(true);
    txtrUseTheText.setEditable(false);
    txtrUseTheText.setBounds(12, 13, 410, 327);
    this.contentPanel.add(txtrUseTheText);

    this.txtNdviMin = new JTextField();
    this.txtNdviMin.setBorder(null);
    this.txtNdviMin.setEditable(false);
    this.txtNdviMin.setText("NDVI Min");
    this.txtNdviMin.setBounds(22, 353, 86, 20);
    this.contentPanel.add(this.txtNdviMin);
    this.txtNdviMin.setColumns(10);

    this.textField = new NumberField();
    this.textField.setHorizontalAlignment(11);
    this.textField.setText("-1");
    this.textField.setColumns(10);
    this.textField.setBounds(120, 353, 60, 20);
    this.contentPanel.add(this.textField);

    this.txtNdviMax = new JTextField();
    this.txtNdviMax.setEditable(false);
    this.txtNdviMax.setBorder(null);
    this.txtNdviMax.setText("NDVI Max");
    this.txtNdviMax.setColumns(10);
    this.txtNdviMax.setBounds(218, 353, 86, 20);
    this.contentPanel.add(this.txtNdviMax);

    this.textField_2 = new NumberField();
    this.textField_2.setHorizontalAlignment(11);
    this.textField_2.setText("1");
    this.textField_2.setColumns(10);
    this.textField_2.setBounds(316, 353, 60, 20);
    this.contentPanel.add(this.textField_2);
    /*     */
    /*  89 */ JButton btnNewButton = new JButton("Use Values");
    /*  90 */ btnNewButton.addActionListener(
        new ActionListener() {
          /*     */ public void actionPerformed(ActionEvent arg0) {
            /*     */ try {
              ((NDVIMaskRectanglePanel) ta.dataPanel)
                  .setMinMax(
                      new Float(NDVIMaskDialog.this.textField.getText()),
                      /*  93 */ new Float(NDVIMaskDialog.this.textField_2.getText()));
              /*  94 */ ((NDVIMaskRectanglePanel) ta.dataPanel).repaint();
            } catch (Exception localException) {
              /*     */ }
            try {
              ((NDVIMaskPolygonPanel) ta.dataPanel)
                  .setMinMax(
                      new Float(NDVIMaskDialog.this.textField.getText()),
                      /*  96 */ new Float(NDVIMaskDialog.this.textField_2.getText()));
              /*  97 */ ((NDVIMaskRectanglePanel) ta.dataPanel).repaint();
              /*     */ }
            /*     */ catch (Exception localException1)
            /*     */ {
              /*     */ }
            /*     */ }
          /*     */ });
    /* 101 */ btnNewButton.setBounds(32, 386, 148, 25);
    /* 102 */ this.contentPanel.add(btnNewButton);
    /*     */
    /* 104 */ JButton btnClose = new JButton("Close");
    /* 105 */ btnClose.addActionListener(
        new ActionListener() {
          /*     */ public void actionPerformed(ActionEvent arg0) {
            /* 107 */ NDVIMaskDialog.this.me.dispose();
            /*     */ }
          /*     */ });
    /* 110 */ btnClose.setBounds(218, 387, 148, 25);
    /* 111 */ this.contentPanel.add(btnClose);
    /*     */ }
  public static void addComponentsToPane(Container pane) {
    if (RIGHT_TO_LEFT) {
      pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    }

    String sample =
        "Lorem ipsum dolor sit amet, consectetur adipiscing elit, "
            + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
            + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi"
            + " ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit"
            + " in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur "
            + "sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit "
            + "anim id est laborum.";

    JButton button;
    pane.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    if (shouldFill) {
      // natural height, maximum width
      c.fill = GridBagConstraints.HORIZONTAL;
    }

    button = new JButton("Button 1");
    if (shouldWeightX) {
      c.weightx = 0.5;
    }
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    pane.add(button, c);

    button = new JButton("Button 2");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.5;
    c.gridx = 1;
    c.gridy = 0;
    pane.add(button, c);

    /*button = new JButton("Button 3");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.5;
    c.gridx = 2;
    c.gridy = 0;
    pane.add(button, c);*/

    button = new JButton("Long-Named Button 4");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipady = 40; // make this component tall
    c.weightx = 0.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 1;
    pane.add(button, c);

    button = new JButton("5");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipady = 0; // reset to default
    c.weighty = 1.0; // request any extra vertical space
    c.anchor = GridBagConstraints.PAGE_END; // bottom of space
    c.insets = new Insets(10, 0, 0, 0); // top padding
    c.gridx = 1; // aligned with button 2
    c.gridwidth = 2; // 2 columns wide
    c.gridy = 2; // third row
    pane.add(button, c);

    JTextArea twitArea = new JTextArea(sample, 6, 20);
    twitArea.setFont(new Font("Roman", Font.BOLD, 20));
    twitArea.setLineWrap(true);
    twitArea.setWrapStyleWord(true);
    twitArea.setOpaque(false);
    twitArea.setEditable(false);
    twitArea.setForeground(Color.white);
    GridBagConstraints twitc = new GridBagConstraints();
    twitc.gridy = 0;
    twitc.gridx = 2;
    twitc.gridheight = 2;
    pane.add(twitArea, twitc);
  }
 /**
  * Sets a custom style for the given text area.
  *
  * @param textArea the text area to style
  */
 private void setTextAreaStyle(JTextArea textArea) {
   textArea.setOpaque(false);
   textArea.setLineWrap(true);
   textArea.setWrapStyleWord(true);
 }
Esempio n. 17
0
  /**
   * Creates a new PluginManagerPane object.
   *
   * @param manager the plugin mananager
   * @param context context
   */
  public PluginManagerPane(
      PluginManager manager, PluginHostContext context, boolean showBuiltInPlugins) {
    super(new BorderLayout());

    // Initialise
    this.context = context;
    this.showBuiltInPlugins = showBuiltInPlugins;
    this.manager = manager;

    // Connection state
    JPanel sp = new JPanel(new BorderLayout());
    sp.setOpaque(false);
    sp.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Plugin updates"),
            BorderFactory.createEmptyBorder(4, 4, 4, 4)));
    status = new JLabel("Click on Refresh to check for new plugins and updates", JLabel.LEFT);
    status.setIcon(IDLE_ICON);
    sp.add(status, BorderLayout.CENTER);
    refresh = new JButton("Refresh");
    refresh.setMnemonic('r');
    refresh.addActionListener(this);
    sp.add(refresh, BorderLayout.EAST);

    // Create the toolbar
    JToolBar toolBar = new JToolBar("Plugin manager tools");
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
    toolBar.setBorder(null);
    toolBar.setFloatable(false);
    toolBar.add(new ToolButton(installAction = new InstallAction(), false));
    toolBar.add(new ToolButton(updateAction = new UpdateAction(), false));
    toolBar.add(new ToolButton(removeAction = new RemoveAction(), false));
    toolBar.add(new ToolButton(configureAction = new ConfigureAction(), false));

    // Create the text area
    table =
        new PluginManagerTable(model = new PluginManagerTableModel()) {
          public Dimension getPreferredSize() {
            return new Dimension(super.getPreferredSize().width, 180);
          }
        };
    table.setBorder(null);
    table.getSelectionModel().addListSelectionListener(this);

    // Information panel
    JPanel ip = new JPanel(new BorderLayout());
    ip.setOpaque(false);
    // ip.setBorder(BorderFactory.createTitledBorder("Information"));
    ip.add(new JLabel(INFORMATION_ICON), BorderLayout.WEST);
    JPanel tp =
        new JPanel(new BorderLayout()) {
          public Dimension getPreferredSize() {
            return new Dimension(super.getPreferredSize().width, 72);
          }
        };
    tp.setOpaque(false);
    tp.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
    url = new JLabel(" ", JLabel.CENTER);
    url.setFont(url.getFont().deriveFont(Font.BOLD).deriveFont(12f));
    url.setForeground(Color.blue);
    url.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    url.setBorder(BorderFactory.createEmptyBorder(4, 0, 4, 0));
    url.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent evt) {
            try {
              PluginManagerPane.this.context.openURL(new URL(url.getText()));
            } catch (Exception e) {
            }
          }
        });
    tp.add(url, BorderLayout.SOUTH);
    info =
        new JTextArea(" ") {
          public Dimension getPreferredSize() {
            return new Dimension(400, 130);
          }
        };
    info.setOpaque(false);
    info.setWrapStyleWord(true);
    info.setLineWrap(true);
    info.setEditable(false);
    info.setFont(UIManager.getFont("Label.font"));
    tp.add(info, BorderLayout.CENTER);
    ip.add(tp, BorderLayout.CENTER);

    // Build this
    add(sp, BorderLayout.NORTH);
    add(
        new ToolBarTablePane(toolBar, table) {
          public Dimension getPreferredSize() {
            return new Dimension(480, 260);
          }
        },
        BorderLayout.CENTER);
    add(ip, BorderLayout.SOUTH);

    // Create the progress dialog
    JPanel progressPanel = new JPanel(new BorderLayout());
    progressPanel.setOpaque(false);
    Window parentWindow = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
    if (parentWindow instanceof JFrame)
      progressDialog = new JDialog((JFrame) parentWindow, "Downloading", true);
    else if (parentWindow instanceof JDialog)
      progressDialog = new JDialog((JDialog) parentWindow, "Downloading", true);
    else progressDialog = new JDialog((JFrame) null, "Downloading", true);
    JPanel progressDetailPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    jGridBagAdd(progressDetailPanel, status1Text = new JLabel(), gbc, GridBagConstraints.REMAINDER);
    jGridBagAdd(progressDetailPanel, status2Text = new JLabel(), gbc, GridBagConstraints.REMAINDER);
    jGridBagAdd(
        progressDetailPanel, progress = new JProgressBar(), gbc, GridBagConstraints.REMAINDER);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weighty = 1.0;
    jGridBagAdd(
        progressDetailPanel,
        cancelDownload = new JButton("Cancel"),
        gbc,
        GridBagConstraints.REMAINDER);
    cancelDownload.addActionListener(this);
    cancelDownload.setMnemonic('c');
    progressPanel.add(statusIcon = new JLabel(), BorderLayout.WEST);
    progressPanel.add(progressDetailPanel, BorderLayout.CENTER);
    progressDialog.getContentPane().setLayout(new GridLayout(1, 1));
    progressDialog.getContentPane().add(progressPanel);
    progressDialog.setSize(220, 160);
    progressDialog.setResizable(false);
    centerComponent(progressDialog);

    // Set the intially available actions
    setAvailableActions();
  }
Esempio n. 18
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    buttonGroup3 = new javax.swing.ButtonGroup();
    xmlPanel = new javax.swing.JPanel();
    javax.swing.JPanel xmlFilePanel = new javax.swing.JPanel();
    javax.swing.JPanel trainXmlFilePanel = new javax.swing.JPanel();
    trainXmlFileTextField = new javax.swing.JTextField();
    javax.swing.JButton trainXmlFileButton = new javax.swing.JButton();
    javax.swing.JPanel targetPanel = new javax.swing.JPanel();
    javax.swing.JPanel targetFilePanel = new javax.swing.JPanel();
    targetFileTextField = new javax.swing.JTextField();
    javax.swing.JButton targetFileButton = new javax.swing.JButton();
    javax.swing.JPanel ptmPanel = new javax.swing.JPanel();
    ptmComboBox = new javax.swing.JComboBox();
    javax.swing.JPanel aatypePanel1 = new javax.swing.JPanel();
    javax.swing.JPanel aatypeComboPanel = new javax.swing.JPanel();
    javax.swing.JScrollPane noteTypeScrollPane = new javax.swing.JScrollPane();
    javax.swing.JTextArea noteTypeTextArea = new javax.swing.JTextArea();
    typePanel = new javax.swing.JPanel();
    crossValidationRadioButton = new javax.swing.JRadioButton();
    looRadioButton = new javax.swing.JRadioButton();
    selfTrainingRadioButton = new javax.swing.JRadioButton();
    kfoldPanel = new javax.swing.JPanel();
    javax.swing.JLabel kfoldLabel = new javax.swing.JLabel();
    kfoldTextField = new javax.swing.JTextField();
    javax.swing.JLabel repeatLabel = new javax.swing.JLabel();
    repeatTextField = new javax.swing.JTextField();
    javax.swing.JLabel repeatTimesLabel = new javax.swing.JLabel();
    negSizePanel = new javax.swing.JPanel();
    sameSizeNegRadioButton = new javax.swing.JRadioButton();
    samePercentageRadioButton = new javax.swing.JRadioButton();
    negDataPanel = new javax.swing.JPanel();
    javax.swing.JPanel negFromOtherFilePanel = new javax.swing.JPanel();
    negFromTrainFileRadioButton = new javax.swing.JRadioButton();
    negFromValidFileRadioButton = new javax.swing.JRadioButton();
    negFileTextField = new javax.swing.JTextField();
    negFileButton = new javax.swing.JButton();
    javax.swing.JPanel negValidSizePanel = new javax.swing.JPanel();
    negValidSizeTextField = new javax.swing.JTextField();
    javax.swing.JLabel numValidSizeNoteLabel = new javax.swing.JLabel();
    javax.swing.JPanel optionPanel = new javax.swing.JPanel();
    javax.swing.JButton optionBtn = new javax.swing.JButton();
    javax.swing.JPanel OKPanel = new javax.swing.JPanel();
    OKBtn = new javax.swing.JButton();
    javax.swing.JButton cancelBtn = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("PHOSIDE train");
    getContentPane().setLayout(new java.awt.GridBagLayout());

    xmlPanel.setLayout(new java.awt.GridBagLayout());

    xmlFilePanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder("Training file in XML format"));
    xmlFilePanel.setMinimumSize(new java.awt.Dimension(400, 63));
    xmlFilePanel.setPreferredSize(new java.awt.Dimension(500, 63));
    xmlFilePanel.setLayout(new java.awt.GridBagLayout());

    trainXmlFilePanel.setLayout(new java.awt.GridBagLayout());

    trainXmlFileTextField.setToolTipText("Please select a FASTA training file");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    trainXmlFilePanel.add(trainXmlFileTextField, gridBagConstraints);

    trainXmlFileButton.setText("Open");
    trainXmlFileButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            trainXmlFileButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    trainXmlFilePanel.add(trainXmlFileButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.weightx = 1.0;
    xmlFilePanel.add(trainXmlFilePanel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    xmlPanel.add(xmlFilePanel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    getContentPane().add(xmlPanel, gridBagConstraints);

    targetPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Save to "));
    targetPanel.setMinimumSize(new java.awt.Dimension(400, 63));
    targetPanel.setPreferredSize(new java.awt.Dimension(500, 63));
    targetPanel.setLayout(new java.awt.GridBagLayout());

    targetFilePanel.setLayout(new java.awt.GridBagLayout());

    targetFileTextField.setToolTipText("Please select a FASTA training file");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    targetFilePanel.add(targetFileTextField, gridBagConstraints);

    targetFileButton.setText("Open");
    targetFileButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            targetFileButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    targetFilePanel.add(targetFileButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.weightx = 1.0;
    targetPanel.add(targetFilePanel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(targetPanel, gridBagConstraints);

    // ptmPanel.setVisible(false); // TODO: remove this line for other ptm
    ptmPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("PTM type"));
    ptmPanel.setLayout(new java.awt.GridBagLayout());

    ptmComboBox.setModel(new javax.swing.DefaultComboBoxModel(PTM.values()));
    ptmComboBox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ptmComboBoxActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    ptmPanel.add(ptmComboBox, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(ptmPanel, gridBagConstraints);

    aatypePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Residue types"));
    aatypePanel1.setLayout(new java.awt.GridBagLayout());

    aatypeComboPanel.setLayout(
        new javax.swing.BoxLayout(aatypeComboPanel, javax.swing.BoxLayout.LINE_AXIS));

    typesCombo = new CheckComboBox(((PTM) ptmComboBox.getSelectedItem()).getAminoAcids());
    aatypeComboPanel.add(typesCombo);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    aatypePanel1.add(aatypeComboPanel, gridBagConstraints);

    noteTypeScrollPane.setBorder(null);
    noteTypeScrollPane.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

    noteTypeTextArea.setColumns(20);
    noteTypeTextArea.setEditable(false);
    noteTypeTextArea.setFont(
        noteTypeTextArea.getFont().deriveFont(noteTypeTextArea.getFont().getSize() - 2f));
    noteTypeTextArea.setLineWrap(true);
    noteTypeTextArea.setRows(5);
    noteTypeTextArea.setText(
        "Hint: selected amino acids will be trained together. For example, for phosphorylation, it is advisable to train serine and threonine together, but it may not be a good practice to train serine, threonine, and tyrosine together.");
    noteTypeTextArea.setWrapStyleWord(true);
    noteTypeTextArea.setOpaque(false);
    noteTypeScrollPane.setViewportView(noteTypeTextArea);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    aatypePanel1.add(noteTypeScrollPane, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(aatypePanel1, gridBagConstraints);

    // typePanel.setVisible(false);
    typePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

    buttonGroup1.add(crossValidationRadioButton);
    crossValidationRadioButton.setSelected(true);
    crossValidationRadioButton.setText("K Cross Validation");
    crossValidationRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            crossValidationRadioButtonActionPerformed(evt);
          }
        });
    typePanel.add(crossValidationRadioButton);

    buttonGroup1.add(looRadioButton);
    looRadioButton.setText("Leave-one-out Validation");
    looRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            looRadioButtonActionPerformed(evt);
          }
        });
    typePanel.add(looRadioButton);

    buttonGroup1.add(selfTrainingRadioButton);
    selfTrainingRadioButton.setText("Self Training");
    selfTrainingRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            selfTrainingRadioButtonActionPerformed(evt);
          }
        });
    typePanel.add(selfTrainingRadioButton);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    getContentPane().add(typePanel, gridBagConstraints);

    kfoldPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Kfold cross validation"));
    kfoldPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

    kfoldLabel.setText("K: ");
    kfoldPanel.add(kfoldLabel);

    kfoldTextField.setText("10");
    kfoldTextField.setMinimumSize(new java.awt.Dimension(50, 19));
    kfoldTextField.setPreferredSize(new java.awt.Dimension(50, 19));
    kfoldPanel.add(kfoldTextField);

    repeatLabel.setText("Repeat for ");
    kfoldPanel.add(repeatLabel);

    repeatTextField.setText("1");
    repeatTextField.setPreferredSize(new java.awt.Dimension(40, 19));
    kfoldPanel.add(repeatTextField);

    repeatTimesLabel.setText("times");
    kfoldPanel.add(repeatTimesLabel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(kfoldPanel, gridBagConstraints);

    negSizePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Negative test data size"));
    negSizePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

    buttonGroup2.add(sameSizeNegRadioButton);
    sameSizeNegRadioButton.setSelected(true);
    sameSizeNegRadioButton.setText("Same size as positive test data");
    negSizePanel.add(sameSizeNegRadioButton);

    buttonGroup2.add(samePercentageRadioButton);
    samePercentageRadioButton.setText("Same percentage as positive test data");
    negSizePanel.add(samePercentageRadioButton);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(negSizePanel, gridBagConstraints);

    negDataPanel.setVisible(false);
    negDataPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Negative data"));
    negDataPanel.setLayout(new java.awt.GridBagLayout());

    negFromOtherFilePanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder("Select negative validation data from"));
    negFromOtherFilePanel.setLayout(new java.awt.GridBagLayout());

    buttonGroup3.add(negFromTrainFileRadioButton);
    negFromTrainFileRadioButton.setSelected(true);
    negFromTrainFileRadioButton.setText("Training file");
    negFromTrainFileRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            negFromTrainFileRadioButtonActionPerformed(evt);
          }
        });
    negFromOtherFilePanel.add(negFromTrainFileRadioButton, new java.awt.GridBagConstraints());

    buttonGroup3.add(negFromValidFileRadioButton);
    negFromValidFileRadioButton.setText("A validation file");
    negFromValidFileRadioButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            negFromValidFileRadioButtonActionPerformed(evt);
          }
        });
    negFromOtherFilePanel.add(negFromValidFileRadioButton, new java.awt.GridBagConstraints());

    negFileTextField.setVisible(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    negFromOtherFilePanel.add(negFileTextField, gridBagConstraints);

    negFileButton.setVisible(false);
    negFileButton.setText("Open");
    negFileButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            negFileButtonActionPerformed(evt);
          }
        });
    negFromOtherFilePanel.add(negFileButton, new java.awt.GridBagConstraints());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    negDataPanel.add(negFromOtherFilePanel, gridBagConstraints);

    negValidSizePanel.setBorder(
        javax.swing.BorderFactory.createTitledBorder("No. of negarive validation sites"));
    negValidSizePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

    negValidSizeTextField.setText("1000");
    negValidSizeTextField.setPreferredSize(new java.awt.Dimension(60, 19));
    negValidSizePanel.add(negValidSizeTextField);

    numValidSizeNoteLabel.setText("Put -1 to use all");
    negValidSizePanel.add(numValidSizeNoteLabel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    negDataPanel.add(negValidSizePanel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(negDataPanel, gridBagConstraints);

    optionBtn.setText("Advanced options");
    optionBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            optionBtnActionPerformed(evt);
          }
        });
    optionPanel.add(optionBtn);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(optionPanel, gridBagConstraints);

    OKBtn.setText("   OK   ");
    OKBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKBtnActionPerformed(evt);
          }
        });
    OKPanel.add(OKBtn);

    cancelBtn.setText("Cancel");
    cancelBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelBtnActionPerformed(evt);
          }
        });
    OKPanel.add(cancelBtn);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(OKPanel, gridBagConstraints);

    pack();
  } // </editor-fold>//GEN-END:initComponents
Esempio n. 19
0
  /** initiate panel */
  private void init() {

    txaHint = new JTextArea();
    txaHint.setBorder(null);
    txaHint.setFocusable(false);
    txaHint.setLineWrap(true);
    txaHint.setWrapStyleWord(true);
    txaHint.setOpaque(false);
    btnHint = new JButton("Hint >>");
    btnHint.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
    txtClassDir = new JTextField();
    butSelect = new JButton("Browse..");
    chkBoxIncludeClass = new JCheckBox("include .class file only");
    chkBoxArchiveType = new JCheckBox("Select for Service Group Archive");

    setBackButtonEnabled(true);
    setFinishButtonEnabled(false);
    setPageComplete(false);

    this.setLayout(new GridBagLayout());

    this.add(
        new JLabel("Class file location"),
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.1,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 10, 0, 0),
            0,
            0));

    this.add(
        txtClassDir,
        new GridBagConstraints(
            1,
            0,
            GridBagConstraints.RELATIVE,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 1, 1, 1),
            0,
            0));

    txtClassDir.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            update();
          }
        });

    this.add(
        butSelect,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.1,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(5, 1, 1, 10),
            0,
            0));

    butSelect.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            int returnVal = fileChooser.showOpenDialog(butSelect);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              file = fileChooser.getSelectedFile();
              fileChooser.setCurrentDirectory(file);
              txtClassDir.setText(file.getAbsolutePath());
              setPageComplete(true);
              setNextButtonEnabled(true);
            } else {
              txtClassDir.setText("");
            }

            update();
          }
        });

    this.add(
        chkBoxIncludeClass,
        new GridBagConstraints(
            0,
            1,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 10, 1, 1),
            0,
            0));
    chkBoxIncludeClass.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            update();
          }
        });

    //             this.add(chkBoxArchiveType
    //                    , new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
    //                    , GridBagConstraints.WEST  , GridBagConstraints.HORIZONTAL
    //                    , new Insets(5, 10, 1,1), 0, 0));
    //            chkBoxArchiveType .addActionListener(new ActionListener()  {
    //                public void actionPerformed(ActionEvent e) {
    //                    update();
    //                }
    //            });
    this.add(
        btnHint,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 10, 0, 10),
            0,
            0));
    btnHint.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (flag) {
              btnHint.setText("Hint >>");
              txaHint.setText("");
              flag = false;
            } else {
              btnHint.setText("Hint <<");
              txaHint.setText(hint);
              flag = true;
            }
            update();
          }
        });

    this.add(
        txaHint,
        new GridBagConstraints(
            0,
            3,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(5, 10, 10, 10),
            0,
            0));
  }
  private void setup() {
    /* 217 */ JTextArea txtrManuallyCalibrateThe = new JTextArea();
    /* 218 */ txtrManuallyCalibrateThe.setOpaque(false);
    /* 219 */ txtrManuallyCalibrateThe.setEditable(false);
    /* 220 */ txtrManuallyCalibrateThe.setFont(new Font("SansSerif", 0, 13));
    /* 221 */ txtrManuallyCalibrateThe.setWrapStyleWord(true);
    /* 222 */ txtrManuallyCalibrateThe.setLineWrap(true);
    /* 223 */ txtrManuallyCalibrateThe.setText(
        "Manually Calibrate The Pixel Size\r\n\r\n1) Click on the beginning of an object of known length visible in the image.  \r\n\r\n2) Drag to the end of the scale.  Release the mouse.  \r\n\r\nTIP: Draw along as much of the scale as possible.  The longer the line, the more precise the measurement.\r\n\r\nA colored line is drawn on the image.  If the line does not match the scale, either redraw the line or fine tune the start and stop positions of the line with the small arrows next to the x and y positons of the line end points, which are located below the image.\r\n\r\n3) When satisfied with the fit of the line to the scale, enter the length of the scale used in the labeled white box below.  \r\n\r\n4) Enter two letters that represent the unit of the scale being used in the labeled white box below.  For example, type \"in\" for inches and \"cm\" for centimeters.\r\n\r\n5) Click 'Done' when finished.  To re-run the calibration method  click 'Calibrate Length' in the File menu.\r\n\r\nTo cancel, close this window by right-clicking the 'close' icon in the upper left corner.");
    /* 224 */ txtrManuallyCalibrateThe.setBounds(10, 11, 402, 500);
    /* 225 */ this.contentPanel.add(txtrManuallyCalibrateThe);

    /* 227 */ this.picTitle = new JTextField();
    /* 228 */ this.picTitle.setBorder(null);
    /* 229 */ this.picTitle.setOpaque(false);
    /* 230 */ this.picTitle.setEditable(false);
    /* 231 */ this.picTitle.setText("Untitled");
    /* 232 */ this.picTitle.setBounds(422, 494, 442, 20);
    /* 233 */ this.contentPanel.add(this.picTitle);
    /* 234 */ this.picTitle.setColumns(10);

    /* 236 */ this.txtLengthOfDrawn = new JTextField();
    /* 237 */ this.txtLengthOfDrawn.setHorizontalAlignment(11);
    /* 238 */ this.txtLengthOfDrawn.setBorder(null);
    /* 239 */ this.txtLengthOfDrawn.setEditable(false);
    /* 240 */ this.txtLengthOfDrawn.setOpaque(false);
    /* 241 */ this.txtLengthOfDrawn.setText("Length of Drawn Line");
    /* 242 */ this.txtLengthOfDrawn.setBounds(790, 524, 151, 20);
    /* 243 */ this.contentPanel.add(this.txtLengthOfDrawn);
    /* 244 */ this.txtLengthOfDrawn.setColumns(10);

    /* 246 */ this.lengthOfLine = new NumberField();
    /* 247 */ this.lengthOfLine.setBounds(945, 524, 86, 20);
    /* 248 */ this.contentPanel.add(this.lengthOfLine);
    /* 249 */ this.lengthOfLine.setColumns(10);

    /* 251 */ this.unitOfLength = new JTextField();
    /* 252 */ this.unitOfLength.setBounds(945, 555, 86, 20);
    /* 253 */ this.contentPanel.add(this.unitOfLength);
    /* 254 */ this.unitOfLength.setColumns(10);

    /* 256 */ this.txtUnitOfLength = new JTextField();
    /* 257 */ this.txtUnitOfLength.setHorizontalAlignment(11);
    /* 258 */ this.txtUnitOfLength.setText("Unit of Length");
    /* 259 */ this.txtUnitOfLength.setOpaque(false);
    /* 260 */ this.txtUnitOfLength.setEditable(false);
    /* 261 */ this.txtUnitOfLength.setColumns(10);
    /* 262 */ this.txtUnitOfLength.setBorder(null);
    /* 263 */ this.txtUnitOfLength.setBounds(790, 555, 151, 20);
    /* 264 */ this.contentPanel.add(this.txtUnitOfLength);

    /* 266 */ this.txtX = new JTextField();
    /* 267 */ this.txtX.setText("X");
    /* 268 */ this.txtX.setOpaque(false);
    /* 269 */ this.txtX.setHorizontalAlignment(0);
    /* 270 */ this.txtX.setEditable(false);
    /* 271 */ this.txtX.setColumns(10);
    /* 272 */ this.txtX.setBorder(null);
    /* 273 */ this.txtX.setBounds(432, 524, 20, 20);
    /* 274 */ this.contentPanel.add(this.txtX);

    /* 276 */ this.txtY = new JTextField();
    /* 277 */ this.txtY.setText("Y");
    /* 278 */ this.txtY.setOpaque(false);
    /* 279 */ this.txtY.setHorizontalAlignment(0);
    /* 280 */ this.txtY.setEditable(false);
    /* 281 */ this.txtY.setColumns(10);
    /* 282 */ this.txtY.setBorder(null);
    /* 283 */ this.txtY.setBounds(476, 524, 20, 20);
    /* 284 */ this.contentPanel.add(this.txtY);
    /*
    286      this.startX = new JSpinner();
    287      this.startX.setFont(new Font("Tahoma", 0, 10));
    288      this.startX.setOpaque(false);
    289      this.startX.setBorder(null);
    290      this.startX.setBounds(400, 546, 63, 20);
    291      this.startX.addChangeListener(new ChangeListener()
        {
          public void stateChanged(ChangeEvent e) {
    294          int t = ((Integer)ManualCalibrationDialog.this.startX.getValue()).intValue();
    295          if ((t < ManualCalibrationDialog.this.label.getOriginal().getWidth()) && (t >= 0)) {
    296            ManualCalibrationDialog.this.x[0] = Integer.valueOf(t);
    297            ManualCalibrationDialog.this.label.toolImage(ManualCalibrationDialog.this.x, ManualCalibrationDialog.this.y, ManualCalibrationDialog.this.entrance.getColor(), "Line", ManualCalibrationDialog.this.entrance.getLineWidth(), ManualCalibrationDialog.this.entrance.getCursorStyle());
            } else {
    299            ManualCalibrationDialog.this.startX.setValue(ManualCalibrationDialog.this.x[0]);
            }
          }
        });
    303      this.contentPanel.add(this.startX);

    305      this.startY = new JSpinner();
    306      this.startY.setFont(new Font("Tahoma", 0, 10));
    307      this.startY.setOpaque(false);
    308      this.startY.setBorder(null);
    309      this.startY.setBounds(465, 546, 63, 20);
    310      this.startY.addChangeListener(new ChangeListener()
        {
          public void stateChanged(ChangeEvent e) {
    313          int t = ((Integer)ManualCalibrationDialog.this.startY.getValue()).intValue();
    314          if ((t < ManualCalibrationDialog.this.label.getOriginal().getHeight()) && (t >= 0)) {
    315            ManualCalibrationDialog.this.y[0] = Integer.valueOf(t);
    316            ManualCalibrationDialog.this.label.toolImage(ManualCalibrationDialog.this.x, ManualCalibrationDialog.this.y, ManualCalibrationDialog.this.entrance.getColor(), "Line", ManualCalibrationDialog.this.entrance.getLineWidth(), ManualCalibrationDialog.this.entrance.getCursorStyle());
            } else {
    318            ManualCalibrationDialog.this.startY.setValue(ManualCalibrationDialog.this.y[0]);
            }
          }
        });
    322      this.contentPanel.add(this.startY);

    324      this.txtStartOfLine = new JTextField();
    325      this.txtStartOfLine.setFont(new Font("Tahoma", 0, 10));
    326      this.txtStartOfLine.setHorizontalAlignment(11);
    327      this.txtStartOfLine.setBorder(null);
    328      this.txtStartOfLine.setEditable(false);
    329      this.txtStartOfLine.setOpaque(false);
    330      this.txtStartOfLine.setText("Start of Line");
    331      this.txtStartOfLine.setBounds(312, 546, 86, 20);
    332      this.contentPanel.add(this.txtStartOfLine);
    333      this.txtStartOfLine.setColumns(10);

    335      this.txtEndOfLine = new JTextField();
    336      this.txtEndOfLine.setFont(new Font("Tahoma", 0, 10));
    337      this.txtEndOfLine.setText("End of Line");
    338      this.txtEndOfLine.setOpaque(false);
    339      this.txtEndOfLine.setHorizontalAlignment(11);
    340      this.txtEndOfLine.setEditable(false);
    341      this.txtEndOfLine.setColumns(10);
    342      this.txtEndOfLine.setBorder(null);
    343      this.txtEndOfLine.setBounds(312, 572, 86, 20);
    344      this.contentPanel.add(this.txtEndOfLine);
    */
    this.endX = new JTextField();
    this.endX.setFont(new Font("Tahoma", 0, 14));
    this.endX.setOpaque(false);
    this.endX.setBorder(null);
    this.endX.setText("0");
    this.endX.setBounds(430, 610, 33, 20);
    this.contentPanel.add(this.endX);

    this.startX = new JTextField();
    this.startX.setFont(new Font("Tahoma", 0, 14));
    this.startX.setOpaque(false);
    this.startX.setBorder(null);
    this.startX.setText("0");
    this.startX.setBounds(430, 559, 33, 20);
    this.contentPanel.add(this.startX);

    this.endY = new JTextField();
    this.endY.setFont(new Font("Tahoma", 0, 14));
    this.endY.setOpaque(false);
    this.endY.setBorder(null);
    this.endY.setText("0");
    this.endY.setBounds(476, 610, 33, 20);
    this.contentPanel.add(this.endY);

    this.startY = new JTextField();
    this.startY.setFont(new Font("Tahoma", 0, 14));
    this.startY.setOpaque(false);
    this.startY.setBorder(null);
    this.startY.setText("0");
    this.startY.setBounds(476, 559, 33, 20);
    this.contentPanel.add(this.startY);

    this.sXP =
        new BasicArrowButton(
            BasicArrowButton.EAST,
            new Color(0xFF8C00),
            new Color(0x9F4C00),
            new Color(0x8F3C00),
            new Color(0xFF9C10));
    sXP.setBounds(382, 562, 16, 16);
    sXP.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.x[0]
                < ManualCalibrationDialog.this.label.getOriginal().getWidth()) {
              ManualCalibrationDialog.this.x[0]++;
              ManualCalibrationDialog.this.startX.setText("" + ManualCalibrationDialog.this.x[0]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(sXP);
    this.sXM =
        new BasicArrowButton(
            BasicArrowButton.WEST,
            new Color(0xFF8C00),
            new Color(0x9F4C00),
            new Color(0x8F3C00),
            new Color(0xFF9C10));
    sXM.setBounds(350, 562, 16, 16);
    sXM.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.x[0] > 0) {
              ManualCalibrationDialog.this.x[0]--;
              ManualCalibrationDialog.this.startX.setText("" + ManualCalibrationDialog.this.x[0]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(sXM);
    this.sYP =
        new BasicArrowButton(
            BasicArrowButton.SOUTH,
            new Color(0xFF8C00),
            new Color(0x9F4C00),
            new Color(0x8F3C00),
            new Color(0xFF9C10));
    sYP.setBounds(366, 578, 16, 16);
    sYP.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.y[0]
                < ManualCalibrationDialog.this.label.getOriginal().getHeight()) {
              ManualCalibrationDialog.this.y[0]++;
              ManualCalibrationDialog.this.startY.setText("" + ManualCalibrationDialog.this.y[0]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(sYP);
    this.sYM =
        new BasicArrowButton(
            BasicArrowButton.NORTH,
            new Color(0xFF8C00),
            new Color(0x9F4C00),
            new Color(0x8F3C00),
            new Color(0xFF9C10));
    sYM.setBounds(366, 546, 16, 16);
    sYM.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.y[0] > 0) {
              ManualCalibrationDialog.this.y[0]--;
              ManualCalibrationDialog.this.startY.setText("" + ManualCalibrationDialog.this.y[0]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(sYM);

    this.eXP =
        new BasicArrowButton(
            BasicArrowButton.EAST,
            new Color(0x8A309F),
            new Color(0x2A0030),
            new Color(0x10000F),
            new Color(0xAA50BF));
    eXP.setBounds(382, 616, 16, 16);
    eXP.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.x[1]
                < ManualCalibrationDialog.this.label.getOriginal().getWidth()) {
              ManualCalibrationDialog.this.x[1]++;
              ManualCalibrationDialog.this.endX.setText("" + ManualCalibrationDialog.this.x[1]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(eXP);
    this.eXM =
        new BasicArrowButton(
            BasicArrowButton.WEST,
            new Color(0x8A309F),
            new Color(0x2A0030),
            new Color(0x10000F),
            new Color(0xAA50BF));
    eXM.setBounds(350, 616, 16, 16);
    eXM.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.x[1] > 0) {
              ManualCalibrationDialog.this.x[1]--;
              ManualCalibrationDialog.this.endX.setText("" + ManualCalibrationDialog.this.x[1]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(eXM);
    this.eYP =
        new BasicArrowButton(
            BasicArrowButton.SOUTH,
            new Color(0x8A309F),
            new Color(0x2A0030),
            new Color(0x10000F),
            new Color(0xAA50BF));
    eYP.setBounds(366, 632, 16, 16);
    eYP.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.y[1]
                < ManualCalibrationDialog.this.label.getOriginal().getHeight()) {
              ManualCalibrationDialog.this.y[1]++;
              ManualCalibrationDialog.this.endY.setText("" + ManualCalibrationDialog.this.y[1]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(eYP);
    this.eYM =
        new BasicArrowButton(
            BasicArrowButton.NORTH,
            new Color(0x8A309F),
            new Color(0x2A0030),
            new Color(0x10000F),
            new Color(0xAA50BF));
    eYM.setBounds(366, 600, 16, 16);
    eYM.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ManualCalibrationDialog.this.y[1] > 0) {
              ManualCalibrationDialog.this.y[1]--;
              ManualCalibrationDialog.this.endY.setText("" + ManualCalibrationDialog.this.y[1]);
              ManualCalibrationDialog.this.label.toolImage(
                  ManualCalibrationDialog.this.x,
                  ManualCalibrationDialog.this.y,
                  ManualCalibrationDialog.this.entrance.getColor(),
                  "Line",
                  ManualCalibrationDialog.this.entrance.getLineWidth(),
                  ManualCalibrationDialog.this.entrance.getCursorStyle());
            }
          }
        });
    this.contentPanel.add(eYM);

    /* 365      this.endY = new JSpinner();
    366      this.endY.setFont(new Font("Tahoma", 0, 10));
    367      this.endY.setOpaque(false);
    368      this.endY.setBorder(null);
    369      this.endY.setBounds(465, 572, 63, 20);
    370      this.endY.addChangeListener(new ChangeListener()
        {
          public void stateChanged(ChangeEvent e) {
    373          int t = ((Integer)ManualCalibrationDialog.this.endY.getValue()).intValue();
    374          if ((t < ManualCalibrationDialog.this.label.getOriginal().getHeight()) && (t >= 0)) {
    375            ManualCalibrationDialog.this.y[1] = Integer.valueOf(t);
    376            ManualCalibrationDialog.this.label.toolImage(ManualCalibrationDialog.this.x, ManualCalibrationDialog.this.y, ManualCalibrationDialog.this.entrance.getColor(), "Line", ManualCalibrationDialog.this.entrance.getLineWidth(), ManualCalibrationDialog.this.entrance.getCursorStyle());
            } else {
    378            ManualCalibrationDialog.this.endY.setValue(ManualCalibrationDialog.this.y[1]);
            }
          }
        });
    382      this.contentPanel.add(this.endY);*/

    /* 384 */ JTextArea txtrZoomOut_1 = new JTextArea();
    /* 385 */ txtrZoomOut_1.setWrapStyleWord(true);
    /* 386 */ txtrZoomOut_1.setText("Zoom in");
    /* 387 */ txtrZoomOut_1.setOpaque(false);
    /* 388 */ txtrZoomOut_1.setLineWrap(true);
    /* 389 */ txtrZoomOut_1.setFont(new Font("SansSerif", 0, 12));
    /* 390 */ txtrZoomOut_1.setEditable(false);
    /* 391 */ txtrZoomOut_1.setBounds(757, 544, 100, 45);
    /* 392 */ this.contentPanel.add(txtrZoomOut_1);

    /* 394 */ this.textArea_1 = new JTextArea();
    /* 395 */ this.textArea_1.setWrapStyleWord(true);
    /* 396 */ this.textArea_1.setText("Magnification: 100%");
    /* 397 */ this.textArea_1.setOpaque(false);
    /* 398 */ this.textArea_1.setLineWrap(true);
    /* 399 */ this.textArea_1.setFont(new Font("SansSerif", 0, 12));
    /* 400 */ this.textArea_1.setEditable(false);
    /* 401 */ this.textArea_1.setBounds(617, 544, 130, 22);
    /* 402 */ this.contentPanel.add(this.textArea_1);

    /* 404 */ JTextArea txtrZoomOut = new JTextArea();
    /* 405 */ txtrZoomOut.setWrapStyleWord(true);
    /* 406 */ txtrZoomOut.setText("Zoom out");
    /* 407 */ txtrZoomOut.setOpaque(false);
    /* 408 */ txtrZoomOut.setLineWrap(true);
    /* 409 */ txtrZoomOut.setFont(new Font("SansSerif", 0, 12));
    /* 410 */ txtrZoomOut.setEditable(false);
    /* 411 */ txtrZoomOut.setBounds(533, 544, 86, 45);
    /* 412 */ this.contentPanel.add(txtrZoomOut);

    /* 414 */ JTextArea txtrWhenZoomedIn = new JTextArea();
    /* 415 */ txtrWhenZoomedIn.setForeground(Color.BLUE);
    /* 416 */ txtrWhenZoomedIn.setOpaque(false);
    /* 417 */ txtrWhenZoomedIn.setEditable(false);
    /* 418 */ txtrWhenZoomedIn.setFont(new Font("SansSerif", 0, 13));
    /* 419 */ txtrWhenZoomedIn.setWrapStyleWord(true);
    /* 420 */ txtrWhenZoomedIn.setLineWrap(true);
    /* 421 */ txtrWhenZoomedIn.setText(
        "When zoomed in, pan around the image by right-clicking and dragging the image.  Because of the text fields, the keyboard cannot be used to zoom and pan the image.");
    /* 422 */ txtrWhenZoomedIn.setBounds(10, 513, 304, 85);
    /* 423 */ this.contentPanel.add(txtrWhenZoomedIn);

    /* 425 */ JButton btnDone = new JButton("Done");
    /* 426 */ btnDone.setBounds(945, 614, 100, 30);
    /* 427 */ this.contentPanel.add(btnDone);
    /* 428 */ btnDone.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            /* 430 */ if (ManualCalibrationDialog.this.unitOfLength.getText().length() == 0) {
              /* 431 */ JOptionPane.showMessageDialog(null, "You must input a unit of measure.");
              /* 432 */ } else if (ManualCalibrationDialog.this.unitOfLength.getText().length()
                > 2) {
              /* 433 */ JOptionPane.showMessageDialog(
                  null, "The unit of lanegth must be one or two characters");
              /* 434 */ } else if (ManualCalibrationDialog.this.lengthOfLine.getText().length()
                == 0) {
              /* 435 */ JOptionPane.showMessageDialog(
                  null, "You must enter the length of the drawn line.");
              /* 436 */ } else if ((ManualCalibrationDialog.this.x[0] == null)
                || (ManualCalibrationDialog.this.x[1] == null)) {
              /* 437 */ JOptionPane.showMessageDialog(null, "You must draw a line to measure.");
            } else {
              /* 439 */ if (ManualCalibrationDialog.this.TimeSeries)
                /* 440 */ ManualCalibrationDialog.this.entrance.setTimeSeriesMeasurement(
                    new Measurement(
                        ColorTools.getLinePixels(
                                ManualCalibrationDialog.this.x, ManualCalibrationDialog.this.y)
                            .size(),
                        /* 441 */ new Double(ManualCalibrationDialog.this.lengthOfLine.getText()),
                        ManualCalibrationDialog.this.unitOfLength.getText()));
              else
                /* 443 */ ManualCalibrationDialog.this.entrance.setMeasurement(
                    new Measurement(
                        ColorTools.getLinePixels(
                                ManualCalibrationDialog.this.x, ManualCalibrationDialog.this.y)
                            .size(),
                        /* 444 */ new Double(ManualCalibrationDialog.this.lengthOfLine.getText()),
                        ManualCalibrationDialog.this.unitOfLength.getText()));
              /* 445 */ ManualCalibrationDialog.this.me.dispose();
            }
          }
        });
    /* 449 */ JButton cancelButton = new JButton("Cancel");
    /* 450 */ cancelButton.setBounds(834, 614, 100, 30);
    /* 451 */ this.contentPanel.add(cancelButton);
    /* 452 */ cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            /* 454 */ ManualCalibrationDialog.this.me.dispose();
          }
        });
  }
Esempio n. 21
0
  public AboutPanel(Gui aFrame) {
    super(new BorderLayout());
    buttons = new JPanel();
    linkPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    linkPanel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    linkPanel.setOpaque(false);
    top = new JPanel();
    top.setBackground(GUIConstants.BACKGROUND_COLOR);
    center =
        new JPanel() {
          @Override
          public void paintComponent(Graphics g) {

            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            GradientPaint gp =
                new GradientPaint(
                    0, 0, GUIConstants.BACKGROUND_COLOR, 0, getHeight(), getBackground());
            Paint p = g2.getPaint();
            g2.setPaint(gp);
            g2.fillRect(0, 0, getWidth(), getHeight());
            g2.setPaint(p);
          }
        };
    center.setLayout(new BoxLayout(center, BoxLayout.PAGE_AXIS));
    frame = aFrame;
    textBottom = new JTextArea();
    textBottom.setOpaque(false);
    textBottom.setWrapStyleWord(true);
    textBottom.setEditable(false);
    textBottom.setLineWrap(true);
    textBottom.setFont(new Font("Sans/Serif", Font.PLAIN, 17));
    textBottom.setMargin(new Insets(10, 10, 0, 0));
    textBottom.setBackground(new Color(255, 255, 255, 0));
    textBottom.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 50, 50, 50));

    textTop = new JTextArea();
    textTop.setOpaque(false);
    textTop.setWrapStyleWord(true);
    textTop.setEditable(false);
    textTop.setLineWrap(true);
    textTop.setFont(new Font("Sans-Serif", Font.PLAIN, 17));
    textTop.setMargin(new Insets(10, 10, 0, 0));
    textTop.setBackground(new Color(255, 255, 255, 0));
    textTop.setBorder(javax.swing.BorderFactory.createEmptyBorder(50, 50, 5, 50));

    title = new JLabel();
    title.setFont(new Font("Sans-Serif", Font.PLAIN, 25));
    back = new JButton("Back to Main");
    back.setBackground(new Color(103, 180, 181));
    back.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (e.getSource() == back) {
              frame.ToMatrixScreen();
            }
          }
        });
    link = new JButton();
    link.setText(
        "<HTML><FONT color=\"#000099\"><U>http://www.businessballs.com/timemanagement.htm</U></FONT>"
            + "</HTML>");
    // link.setHorizontalAlignment(SwingConstants.LEFT);
    link.setBorderPainted(false);
    link.setOpaque(false);
    link.setBackground(Color.WHITE);
    link.setToolTipText("http://www.businessballs.com/timemanagement.htm");
    link.addActionListener(new URLOpener());
    buttons.add(back);
    linkPanel.add(link);
    top.add(title);
    center.add(textTop);
    center.add(linkPanel);
    center.add(textBottom);

    try {
      readFile();
    } catch (FileNotFoundException ex) {
      Logger.getLogger(AboutPanel.class.getName()).log(Level.SEVERE, null, ex);
      System.out.println(ex.getMessage());
    } catch (IOException ex) {
      Logger.getLogger(HelpPanel.class.getName()).log(Level.SEVERE, null, ex);
      System.out.println(ex.getMessage());
    }

    this.add(top, BorderLayout.NORTH);
    this.add(center, BorderLayout.CENTER);
    this.add(buttons, BorderLayout.SOUTH);
  }
Esempio n. 22
0
  /** Populate the popup menu */
  private static void populateStatusMenu() {
    statusMenu.removeAll();
    JMenuItem menuItem = null;
    statusMenu.add(new JMenuItem(I18N.gettext("main.main.statusmenu.Status_message:")));

    txtStatus.setEditable(false);
    txtStatus.setBorder(
        BorderFactory.createBevelBorder(
            BevelBorder.LOWERED,
            Color.white,
            Color.white,
            new Color(134, 134, 134),
            new Color(93, 93, 93)));
    txtStatus.setOpaque(false);
    txtStatus.setLineWrap(true);
    txtStatus.setWrapStyleWord(true);
    statusMenu.add(txtStatus);

    menuItem = new JMenuItem();
    I18N.setTextAndMnemonic("main.main.statusmenu.Change_message", menuItem, true);
    menuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            currentParent.message =
                JOptionPane.showInputDialog(
                    currentParent,
                    I18N.gettext("main.main.statusmenu.Status_message:"),
                    currentParent.message);
            if (currentParent.message == null) return;
            changeStatus(currentParent.status, currentParent.message);
          }
        });
    statusMenu.add(menuItem);

    menuItem = new JMenuItem();
    I18N.setTextAndMnemonic("main.main.statusmenu.Manage_messages", menuItem, true);
    menuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new StatusMessagesWindow().show();
          }
        });
    statusMenu.add(menuItem);

    statusMenu.add(createSubMenu(Presence.FREE_FOR_CHAT));
    statusMenu.add(createSubMenu(Presence.AVAILABLE));
    statusMenu.add(createSubMenu(Presence.DND));
    statusMenu.add(createSubMenu(Presence.AWAY));
    statusMenu.add(createSubMenu(Presence.XA));

    menuItem = new JMenuItem(StatusIcons.getStatusIcon(Presence.INVISIBLE));
    I18N.setTextAndMnemonic("main.main.presencebutton.Invisible", menuItem);
    menuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeStatus(Presence.INVISIBLE, null);
          }
        });
    statusMenu.add(menuItem);

    menuItem = new JMenuItem(StatusIcons.getOfflineIcon());
    I18N.setTextAndMnemonic("main.main.presencebutton.Offline", menuItem);
    menuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeStatus(Presence.UNAVAILABLE, null);
          }
        });
    statusMenu.add(menuItem);

    heightInvalid = true;
  }
  public static void main(String[] args) {
    try {
      System.setProperty("sun.java2d.noddraw", "true");
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    }
    JFrame f = new JFrame("Balloon Test");
    final String BALLOON_TEXT =
        "<html><center>"
            + "This is some sample balloon text<br>"
            + "which has been formatted with html.<br>"
            + "Click to dismiss.</center></html>";
    final JLabel content = new JLabel(BALLOON_TEXT);
    content.setIconTextGap(10);
    content.setBorder(new EmptyBorder(0, 8, 0, 8));
    content.setSize(content.getPreferredSize());
    content.setIcon(new InfoIcon());
    JLabel label = new JLabel("Click anywhere for more information");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.addMouseListener(
        new MouseAdapter() {
          private MouseListener listener =
              new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                  hidePopup(e);
                }
              };
          private Popup popup;

          private void hidePopup(MouseEvent e) {
            e.getComponent().removeMouseListener(listener);
            if (popup != null) popup.hide();
          }

          public void mousePressed(MouseEvent e) {
            hidePopup(e);
            popup = BalloonManager.getBalloon(e.getComponent(), content, e.getX(), e.getY());
            popup.show();
            content.getParent().addMouseListener(listener);
          }
        });
    f.getContentPane().add(label);
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.setLocation(100, 100);
    try {
      // Force a load of JNA
      WindowUtils.setWindowMask(f, WindowUtils.MASK_NONE);
      f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } catch (UnsatisfiedLinkError e) {
      e.printStackTrace();
      String msg = e.getMessage() + "\nError loading the JNA library";
      JTextArea area = new JTextArea(msg);
      area.setOpaque(false);
      area.setFont(UIManager.getFont("Label.font"));
      area.setEditable(false);
      area.setColumns(80);
      area.setRows(8);
      area.setWrapStyleWord(true);
      area.setLineWrap(true);
      JOptionPane.showMessageDialog(
          null,
          new JScrollPane(area),
          "Library Load Error: "
              + System.getProperty("os.name")
              + "/"
              + System.getProperty("os.arch"),
          JOptionPane.ERROR_MESSAGE);
      System.exit(1);
    }
  }
Esempio n. 24
0
  public PartitionModelPanel(final PartitionSubstitutionModel partitionModel) {

    super(12, (OSType.isMac() ? 6 : 24));

    this.model = partitionModel;

    initCodonPartitionComponents();

    PanelUtils.setupComponent(nucSubstCombo);
    nucSubstCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setNucSubstitutionModel((NucModelType) nucSubstCombo.getSelectedItem());
          }
        });
    nucSubstCombo.setToolTipText("<html>Select the type of nucleotide substitution model.</html>");

    PanelUtils.setupComponent(aaSubstCombo);
    aaSubstCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            AminoAcidModelType type = (AminoAcidModelType) aaSubstCombo.getSelectedItem();
            model.setAaSubstitutionModel(type);
            citationText.setText(type.getCitation().toString());
          }
        });
    aaSubstCombo.setToolTipText("<html>Select the type of amino acid substitution model.</html>");

    PanelUtils.setupComponent(binarySubstCombo);
    binarySubstCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setBinarySubstitutionModel((BinaryModelType) binarySubstCombo.getSelectedItem());
            useAmbiguitiesTreeLikelihoodCheck.setSelected(
                binarySubstCombo.getSelectedItem() == BinaryModelType.BIN_COVARION);
            useAmbiguitiesTreeLikelihoodCheck.setEnabled(
                binarySubstCombo.getSelectedItem() != BinaryModelType.BIN_COVARION);
          }
        });
    binarySubstCombo.setToolTipText("<html>Select the type of binary substitution model.</html>");

    PanelUtils.setupComponent(useAmbiguitiesTreeLikelihoodCheck);
    useAmbiguitiesTreeLikelihoodCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setUseAmbiguitiesTreeLikelihood(useAmbiguitiesTreeLikelihoodCheck.isSelected());
          }
        });
    useAmbiguitiesTreeLikelihoodCheck.setToolTipText(
        "<html>Detemine useAmbiguities in &lt treeLikelihood &gt .</html>");

    PanelUtils.setupComponent(frequencyCombo);
    frequencyCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setFrequencyPolicy((FrequencyPolicyType) frequencyCombo.getSelectedItem());
          }
        });
    frequencyCombo.setToolTipText(
        "<html>Select the policy for determining the base frequencies.</html>");

    PanelUtils.setupComponent(heteroCombo);
    heteroCombo.setToolTipText(
        "<html>Select the type of site-specific rate<br>heterogeneity model.</html>");
    heteroCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {

            boolean gammaHetero =
                heteroCombo.getSelectedIndex() == 1 || heteroCombo.getSelectedIndex() == 3;

            model.setGammaHetero(gammaHetero);
            model.setInvarHetero(
                heteroCombo.getSelectedIndex() == 2 || heteroCombo.getSelectedIndex() == 3);

            if (gammaHetero) {
              gammaCatLabel.setEnabled(true);
              gammaCatCombo.setEnabled(true);
            } else {
              gammaCatLabel.setEnabled(false);
              gammaCatCombo.setEnabled(false);
            }

            if (codingCombo.getSelectedIndex() != 0) {
              heteroUnlinkCheck.setEnabled(heteroCombo.getSelectedIndex() != 0);
              heteroUnlinkCheck.setSelected(heteroCombo.getSelectedIndex() != 0);
            }
          }
        });

    PanelUtils.setupComponent(gammaCatCombo);
    gammaCatCombo.setToolTipText(
        "<html>Select the number of categories to use for<br>the discrete gamma rate heterogeneity model.</html>");
    gammaCatCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {

            model.setGammaCategories(gammaCatCombo.getSelectedIndex() + 4);
          }
        });

    setYang96Button = new JButton("Use Yang96 model");
    setYang96Button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            setYang96Model();
          }
        });
    PanelUtils.setupComponent(setYang96Button);
    setYang96Button.setToolTipText(
        "<html>Sets a 3 codon-position model with independent GTR and Gamma as described in<br>"
            + "Yang (1996) <i>J Mol Evol</i> <b>42</b>: 587–596. This model is named 3' in this paper.</html>");

    setSRD06Button = new JButton("Use SRD06 model");
    setSRD06Button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            setSRD06Model();
          }
        });
    PanelUtils.setupComponent(setSRD06Button);
    setSRD06Button.setToolTipText(
        "<html>Sets the SRD06 model as described in<br>"
            + "Shapiro, Rambaut & Drummond (2006) <i>MBE</i> <b>23</b>: 7-9.</html>");

    citationText = new JTextArea(1, 40);
    citationText.setLineWrap(true);
    citationText.setWrapStyleWord(true);
    citationText.setEditable(false);
    citationText.setFont(this.getFont());
    citationText.setOpaque(false);
    AminoAcidModelType type = (AminoAcidModelType) aaSubstCombo.getSelectedItem();
    citationText.setText(type.getCitation().toString());

    dolloCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (dolloCheck.isSelected()) {
              binarySubstCombo.setSelectedIndex(0);
              binarySubstCombo.setEnabled(false);
              useAmbiguitiesTreeLikelihoodCheck.setSelected(true);
              useAmbiguitiesTreeLikelihoodCheck.setEnabled(false);
              frequencyCombo.setEnabled(false);
              frequencyCombo.setSelectedItem(FrequencyPolicyType.EMPIRICAL);
              heteroCombo.setSelectedIndex(0);
              heteroCombo.setEnabled(false);
              model.setBinarySubstitutionModel(BinaryModelType.BIN_DOLLO);
              model.setDolloModel(true);
              DolloComponentOptions comp =
                  (DolloComponentOptions)
                      model.getOptions().getComponentOptions(DolloComponentOptions.class);
              comp.createParameters(model.getOptions());
              comp.setActive(true);

            } else {
              binarySubstCombo.setEnabled(true);
              useAmbiguitiesTreeLikelihoodCheck.setEnabled(true);
              frequencyCombo.setEnabled(true);
              heteroCombo.setEnabled(true);
              model.setBinarySubstitutionModel(
                  (BinaryModelType) binarySubstCombo.getSelectedItem());
              model.setDolloModel(false);
            }
          }
        });

    PanelUtils.setupComponent(dolloCheck);
    //        dolloCheck.addChangeListener(new ChangeListener() {
    //            public void stateChanged(ChangeEvent e) {
    //                model.setDolloModel(true);
    //            }
    //        });
    dolloCheck.setEnabled(true);
    dolloCheck.setToolTipText(
        "<html>Activates a Stochastic Dollo model as described in<br>"
            + "Alekseyenko, Lee & Suchard (2008) <i>Syst Biol</i> <b>57</b>: 772-784.</html>");

    PanelUtils.setupComponent(discreteTraitSiteModelCombo);
    discreteTraitSiteModelCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setDiscreteSubstType(
                (DiscreteSubstModelType) discreteTraitSiteModelCombo.getSelectedItem());
          }
        });

    PanelUtils.setupComponent(continuousTraitSiteModelCombo);
    continuousTraitSiteModelCombo.setToolTipText(
        "<html>Select the model of continuous random walk, either homogenous<br>"
            + "or relaxed random walk (RRW) with a choice of distributions.</html>");
    continuousTraitSiteModelCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setContinuousSubstModelType(
                (ContinuousSubstModelType) continuousTraitSiteModelCombo.getSelectedItem());
          }
        });

    PanelUtils.setupComponent(latLongCheck);
    latLongCheck.setToolTipText(
        "<html>Specify whether this is a geographical trait representing <br>"
            + "latitude and longitude. Provides appropriate statistics to log file.</html>");

    latLongCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setIsLatitudeLongitude(latLongCheck.isSelected());
          }
        });
    latLongCheck.setEnabled(false);

    PanelUtils.setupComponent(useLambdaCheck);
    useLambdaCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            ContinuousComponentOptions component =
                (ContinuousComponentOptions)
                    model.getOptions().getComponentOptions(ContinuousComponentOptions.class);
            component.setUseLambda(model, useLambdaCheck.isSelected());
          }
        });
    useLambdaCheck.setToolTipText(
        "<html>Estimate degree of phylogenetic correlation in continuous traits using <br>"
            + "a tree transform. Inspired by Pagel (1999), described in Lemey et al (2013) <i>in prep</i></html>");

    PanelUtils.setupComponent(activateBSSVS);
    activateBSSVS.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setActivateBSSVS(activateBSSVS.isSelected());
          }
        });
    activateBSSVS.setToolTipText(
        "<html>Activates Bayesian stochastic search variable selection on the rates as described in<br>"
            + "Lemey, Rambaut, Drummond & Suchard (2009) <i>PLoS Computational Biology</i> <b>5</b>: e1000520</html>");

    // ============ micro-sat ================
    microsatName.setColumns(30);
    microsatName.addKeyListener(
        new java.awt.event.KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            model.getMicrosatellite().setName(microsatName.getText());
          }
        });
    microsatMax.setColumns(10);
    microsatMax.addKeyListener(
        new java.awt.event.KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            model.getMicrosatellite().setMax(Integer.parseInt(microsatMax.getText()));
          }
        });
    microsatMin.setColumns(10);
    microsatMin.addKeyListener(
        new java.awt.event.KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            model.getMicrosatellite().setMin(Integer.parseInt(microsatMin.getText()));
          }
        });

    PanelUtils.setupComponent(shareMicroSatCheck);
    shareMicroSatCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            model.getOptions().shareMicroSat = shareMicroSatCheck.isSelected();
            if (shareMicroSatCheck.isSelected()) {
              model.getOptions().shareMicroSat();
            } else {
              model.getOptions().unshareMicroSat();
            }
            setOptions();
          }
        });

    PanelUtils.setupComponent(rateProportionCombo);
    rateProportionCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setRatePorportion(
                (MicroSatModelType.RateProportionality) rateProportionCombo.getSelectedItem());
          }
        });
    // rateProportionCombo.setToolTipText("<html>Select the type of microsatellite substitution
    // model.</html>");
    PanelUtils.setupComponent(mutationBiasCombo);
    mutationBiasCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setMutationBias(
                (MicroSatModelType.MutationalBias) mutationBiasCombo.getSelectedItem());
          }
        });
    PanelUtils.setupComponent(phaseCombo);
    phaseCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setPhase((MicroSatModelType.Phase) phaseCombo.getSelectedItem());
          }
        });

    setupPanel();
    setOpaque(false);
  }
Esempio n. 25
0
  /** Initializes the <tt>NewStatusMessageDialog</tt> by adding the buttons, fields, etc. */
  private void init() {
    JLabel messageLabel =
        new JLabel(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE"));

    JPanel dataPanel = new TransparentPanel(new BorderLayout(5, 5));

    JTextArea infoArea =
        new JTextArea(GuiActivator.getResources().getI18NString("service.gui.STATUS_MESSAGE_INFO"));

    JLabel infoTitleLabel =
        new JLabel(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE"));

    JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1));

    JButton okButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.OK"));

    JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));

    this.setTitle(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE"));

    this.getRootPane().setDefaultButton(okButton);

    this.setPreferredSize(new Dimension(500, 200));

    infoArea.setEditable(false);
    infoArea.setLineWrap(true);
    infoArea.setWrapStyleWord(true);
    infoArea.setOpaque(false);

    dataPanel.add(messageLabel, BorderLayout.WEST);

    messageTextField.setText(presenceOpSet.getCurrentStatusMessage());
    dataPanel.add(messageTextField, BorderLayout.CENTER);

    infoTitleLabel.setHorizontalAlignment(JLabel.CENTER);
    infoTitleLabel.setFont(infoTitleLabel.getFont().deriveFont(Font.BOLD, 18.0f));

    labelsPanel.add(infoTitleLabel);
    labelsPanel.add(infoArea);
    labelsPanel.add(dataPanel);

    messagePanel = new TransparentPanel(new GridBagLayout());
    GridBagConstraints messagePanelConstraints = new GridBagConstraints();
    messagePanelConstraints.anchor = GridBagConstraints.NORTHWEST;
    messagePanelConstraints.fill = GridBagConstraints.NONE;
    messagePanelConstraints.gridx = 0;
    messagePanelConstraints.gridy = 0;
    messagePanelConstraints.insets = new Insets(5, 0, 5, 10);
    messagePanelConstraints.weightx = 0;
    messagePanelConstraints.weighty = 0;
    messagePanel.add(
        new ImageCanvas(ImageLoader.getImage(ImageLoader.RENAME_DIALOG_ICON)),
        messagePanelConstraints);

    messagePanelConstraints.anchor = GridBagConstraints.NORTH;
    messagePanelConstraints.fill = GridBagConstraints.HORIZONTAL;
    messagePanelConstraints.gridx = 1;
    messagePanelConstraints.insets = new Insets(0, 0, 0, 0);
    messagePanelConstraints.weightx = 1;
    messagePanel.add(labelsPanel, messagePanelConstraints);

    okButton.setName("ok");
    cancelButton.setName("cancel");

    okButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.OK"));
    cancelButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));

    okButton.addActionListener(this);
    cancelButton.addActionListener(this);

    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);

    JPanel mainPanel = new TransparentPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));

    GridBagConstraints mainPanelConstraints = new GridBagConstraints();
    mainPanelConstraints.anchor = GridBagConstraints.NORTH;
    mainPanelConstraints.fill = GridBagConstraints.BOTH;
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.weightx = 1;
    mainPanelConstraints.weighty = 1;
    mainPanel.add(messagePanel, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.SOUTHEAST;
    mainPanelConstraints.fill = GridBagConstraints.NONE;
    mainPanelConstraints.gridy = 1;
    mainPanelConstraints.weightx = 0;
    mainPanelConstraints.weighty = 0;
    mainPanel.add(buttonsPanel, mainPanelConstraints);

    this.getContentPane().add(mainPanel);
  }
 public void setBackgroundImage() {
   imageField.setIcon(new ImageIcon(getResizedBackgroundImage()));
   textArea.setOpaque(false);
   if (Quick.isSelected()) tweet();
 }
Esempio n. 27
0
  /** Constructs the <tt>LoginWindow</tt>. */
  private void init() {
    String title;

    if (windowTitle != null) title = windowTitle;
    else
      title =
          DesktopUtilActivator.getResources()
              .getI18NString("service.gui.AUTHENTICATION_WINDOW_TITLE", new String[] {server});

    String text;
    if (windowText != null) text = windowText;
    else
      text =
          DesktopUtilActivator.getResources()
              .getI18NString("service.gui.AUTHENTICATION_REQUESTED_SERVER", new String[] {server});

    String uinText;
    if (usernameLabelText != null) uinText = usernameLabelText;
    else uinText = DesktopUtilActivator.getResources().getI18NString("service.gui.IDENTIFIER");

    String passText;
    if (passwordLabelText != null) passText = passwordLabelText;
    else passText = DesktopUtilActivator.getResources().getI18NString("service.gui.PASSWORD");

    setTitle(title);

    infoTextArea.setEditable(false);
    infoTextArea.setOpaque(false);
    infoTextArea.setLineWrap(true);
    infoTextArea.setWrapStyleWord(true);
    infoTextArea.setFont(infoTextArea.getFont().deriveFont(Font.BOLD));
    infoTextArea.setText(text);
    infoTextArea.setAlignmentX(0.5f);

    JLabel uinLabel = new JLabel(uinText);
    uinLabel.setFont(uinLabel.getFont().deriveFont(Font.BOLD));

    JLabel passwdLabel = new JLabel(passText);
    passwdLabel.setFont(passwdLabel.getFont().deriveFont(Font.BOLD));

    TransparentPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8));

    labelsPanel.add(uinLabel);
    labelsPanel.add(passwdLabel);

    TransparentPanel textFieldsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8));

    textFieldsPanel.add(uinValue);
    textFieldsPanel.add(passwdField);

    JPanel southFieldsPanel = new TransparentPanel(new GridLayout(1, 2));

    this.rememberPassCheckBox.setOpaque(false);
    this.rememberPassCheckBox.setBorder(null);

    southFieldsPanel.add(rememberPassCheckBox);
    if (signupLink != null && signupLink.length() > 0)
      southFieldsPanel.add(
          createWebSignupLabel(
              DesktopUtilActivator.getResources().getI18NString("plugin.simpleaccregwizz.SIGNUP"),
              signupLink));
    else southFieldsPanel.add(new JLabel());

    boolean allowRememberPassword = true;

    String allowRemPassStr =
        DesktopUtilActivator.getResources().getSettingsString(PNAME_ALLOW_SAVE_PASSWORD);
    if (allowRemPassStr != null) {
      allowRememberPassword = Boolean.parseBoolean(allowRemPassStr);
    }
    allowRememberPassword =
        DesktopUtilActivator.getConfigurationService()
            .getBoolean(PNAME_ALLOW_SAVE_PASSWORD, allowRememberPassword);

    setAllowSavePassword(allowRememberPassword);

    JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));

    buttonPanel.add(loginButton);
    buttonPanel.add(cancelButton);

    JPanel southEastPanel = new TransparentPanel(new BorderLayout());
    southEastPanel.add(buttonPanel, BorderLayout.EAST);

    TransparentPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10));

    mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 20));

    JPanel mainFieldsPanel = new TransparentPanel(new BorderLayout(0, 10));
    mainFieldsPanel.add(labelsPanel, BorderLayout.WEST);
    mainFieldsPanel.add(textFieldsPanel, BorderLayout.CENTER);
    mainFieldsPanel.add(southFieldsPanel, BorderLayout.SOUTH);

    mainPanel.add(infoTextArea, BorderLayout.NORTH);
    mainPanel.add(mainFieldsPanel, BorderLayout.CENTER);
    mainPanel.add(southEastPanel, BorderLayout.SOUTH);

    this.getContentPane().add(mainPanel, BorderLayout.EAST);

    this.loginButton.setName("ok");
    this.cancelButton.setName("cancel");
    if (loginButton.getPreferredSize().width > cancelButton.getPreferredSize().width)
      cancelButton.setPreferredSize(loginButton.getPreferredSize());
    else loginButton.setPreferredSize(cancelButton.getPreferredSize());

    this.loginButton.setMnemonic(
        DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.OK"));
    this.cancelButton.setMnemonic(
        DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));

    this.loginButton.addActionListener(this);
    this.cancelButton.addActionListener(this);

    this.getRootPane().setDefaultButton(loginButton);
  }
  public BaseGoogleLoginUI(@NotNull String signinText) {
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT));
    setOpaque(false);

    JLabel googleIcon = new JBLabel();

    setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15));
    googleIcon.setHorizontalAlignment(SwingConstants.CENTER);
    googleIcon.setVerticalAlignment(SwingConstants.CENTER);
    googleIcon.setOpaque(false);
    googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO);
    googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 0;
    add(googleIcon, c);

    JTextArea signinTextArea = new JTextArea();
    signinTextArea.setFont(UIUtil.getLabelFont());
    signinTextArea.setLineWrap(true);
    signinTextArea.setWrapStyleWord(true);
    signinTextArea.setOpaque(false);
    signinTextArea.setText(signinText);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    add(signinTextArea, c);
  }