コード例 #1
0
ファイル: SendMessage.java プロジェクト: FRA-UAS/Mailer
  /**
   * This constructor creates a new message window with the information of an email on which the
   * user wants to respond
   *
   * @param message : stores information of an email on which we want to respond
   * @throws MessagingException : Throws exception to the the function where an object of type
   *     SendMessage has been instantiate
   * @throws IOException : Throws exception to the the function where an object of type SendMessage
   *     has been instantiate
   */
  public SendMessage(Message message) throws MessagingException, IOException {
    this.message = message;
    textArea = new JTextArea();
    scrollPane = new JScrollPane(textArea);
    wrongMailsStringBuilder = new StringBuilder();
    window = new JDialog();
    username = "******";
    userPassword = "******";
    width = 800;
    height = 500;
    messageHandler = new MessageHandler(message);
    window.setSize(width, height);
    window.setName("send a new E-Mail");
    window.setVisible(true);

    setTextArea();
    createToLabel();
    createCcLabel();
    createBccLabel();
    createSubjectLabel();
    createCcField();
    createBccField();
    createSendButton();
    createCancelButton();
    createSaveButton();
    createFormular(messageHandler, message);
    createContainer();
    setWindowConfiguration();
  }
コード例 #2
0
 private void createJDlg() {
   JDialog dlg;
   if (vsr instanceof JDialog) {
     dlg = (JDialog) vsr;
   } else {
     // jcv2.0.1
     if (pst.isEmbeddedView()) {
       parentContainer = vsr;
     } else {
       dlg = assembleDialog();
       dlg.setName(getDlgName(vsr.getClass().getName()));
       parentContainer = dlg;
     }
   }
 }
コード例 #3
0
 /**
  * Create a simple about box JDialog that displays the standard Application resources, like
  * {@code Application.title} and {@code Application.description}. The about box's labels and
  * fields are configured by resources that are injected when the about box is shown (see
  * SingleFrameApplication#show). The resources are defined in the application resource file:
  * resources/DocumentExample.properties.
  *
  * <p>From: https://appframework.dev.java.net/downloads/AppFramework-1.03-src.zip
  * DocumentExample
  */
 private JDialog createAboutBox(final Frame owner) {
   final JPanel panel = new JPanel(new GridBagLayout());
   panel.setBorder(new EmptyBorder(0, 28, 16, 28)); // top, left,
   // bottom, right
   final JLabel titleLabel = new JLabel();
   titleLabel.setName("aboutTitleLabel");
   final GridBagConstraints c = new GridBagConstraints();
   initGridBagConstraints(c);
   c.anchor = GridBagConstraints.WEST;
   c.gridwidth = GridBagConstraints.REMAINDER;
   c.fill = GridBagConstraints.HORIZONTAL;
   c.ipady = 32;
   c.weightx = 1.0;
   panel.add(titleLabel, c);
   final String[] fields = {"description", "version", "vendor", "home"};
   for (final String field : fields) {
     final JLabel label = new JLabel();
     label.setName(field + "Label");
     initGridBagConstraints(c);
     // c.anchor = GridBagConstraints.BASELINE_TRAILING; 1.6 ONLY
     c.anchor = GridBagConstraints.EAST;
     panel.add(label, c);
     initGridBagConstraints(c);
     c.weightx = 1.0;
     c.gridwidth = GridBagConstraints.REMAINDER;
     c.fill = GridBagConstraints.HORIZONTAL;
     final JTextField textField = new JTextField();
     textField.setName(field + "TextField");
     textField.setEditable(false);
     textField.setBorder(null);
     panel.add(textField, c);
   }
   final JButton closeAboutButton = new JButton();
   closeAboutButton.setAction(findAction("closeAboutBox"));
   initGridBagConstraints(c);
   c.anchor = GridBagConstraints.EAST;
   c.gridx = 1;
   panel.add(closeAboutButton, c);
   final JDialog dialog = new JDialog(owner);
   dialog.setName("aboutDialog");
   dialog.add(panel, BorderLayout.CENTER);
   return dialog;
 }