Package javax.swing

Examples of javax.swing.Box


      });

      if (morePanel == null) {
        friendPanel.add(advancedButton, BorderLayout.EAST);
      } else {
        final Box box = Box.createVerticalBox();
        box.add(advancedButton);
        box.add(Box.createVerticalGlue());
        morePanel.add(box, BorderLayout.EAST);
      }

      final StringBuffer buf = new StringBuffer(200);
      Throwable cause = t;
View Full Code Here


   * Creates the panel in which the addressing will be done, such as
   * the To: field, Subject: field, etc.
   */
  public Container createHeaderInputPanel(MessageProxy pProxy, Hashtable proptDict) {

    Box inputPanel = new Box(BoxLayout.Y_AXIS);

    Box inputRow = new Box(BoxLayout.X_AXIS);

    // Create UserProfile DropDown
    JLabel userProfileLabel = new JLabel(Pooka.getProperty("UserProfile.label","User:"), SwingConstants.RIGHT);
    userProfileLabel.setPreferredSize(new Dimension(75,userProfileLabel.getPreferredSize().height));
    JComboBox profileCombo = new JComboBox(new Vector(Pooka.getPookaManager().getUserProfileManager().getUserProfileList()));


    IconManager iconManager = Pooka.getUIFactory().getIconManager();

    ImageIcon headerIcon = iconManager.getIcon(Pooka.getProperty("NewMessage.customHeader.button", "Hammer"));
    if (headerIcon != null) {
      java.awt.Image headerImage = headerIcon.getImage();
      headerImage = headerImage.getScaledInstance(15, 15, java.awt.Image.SCALE_SMOOTH);
      headerIcon.setImage(headerImage);
      customHeaderButton = new JToggleButton(headerIcon);
      customHeaderButton.setMargin(new java.awt.Insets(1,1,1,1));
      customHeaderButton.setSize(15,15);
    } else {
      customHeaderButton = new JToggleButton();
    }

    customHeaderButton.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
          if (customHeaderButton.isSelected()) {
            selectCustomHeaderPane();
          } else {
            removeCustomHeaderPane();
          }
        }

      });

    customHeaderButton.setToolTipText(Pooka.getProperty("NewMessage.customHeaders.button.Tooltip", "Edit Headers"));

    inputRow.add(userProfileLabel);
    inputRow.add(profileCombo);
    inputRow.add(customHeaderButton);

    UserProfile selectedProfile = null;
    selectedProfile = pProxy.getDefaultProfile();
    if (selectedProfile == null)
      if (Pooka.getMainPanel() != null)
        selectedProfile = Pooka.getMainPanel().getCurrentUser();

    if (selectedProfile == null)
      selectedProfile = Pooka.getPookaManager().getUserProfileManager().getDefaultProfile();

    if (selectedProfile != null)
      profileCombo.setSelectedItem(selectedProfile);

    profileCombo.addItemListener(this);

    proptDict.put("UserProfile", profileCombo);

    inputPanel.add(inputRow);

    // Create Address panel

    StringTokenizer tokens = new StringTokenizer(Pooka.getProperty("MessageWindow.Input.DefaultFields", "To:CC:BCC:Subject"), ":");
    String currentHeader = null;
    JLabel hdrLabel = null;
    EntryTextArea inputField = null;

    while (tokens.hasMoreTokens()) {
      inputRow = new Box(BoxLayout.X_AXIS);
      currentHeader=tokens.nextToken();
      hdrLabel = new JLabel(Pooka.getProperty("MessageWindow.Input.." + currentHeader + ".label", currentHeader) + ":", SwingConstants.RIGHT);
      hdrLabel.setPreferredSize(new Dimension(75,hdrLabel.getPreferredSize().height));
      inputRow.add(hdrLabel);

      if (currentHeader.equalsIgnoreCase("To") || currentHeader.equalsIgnoreCase("CC") || currentHeader.equalsIgnoreCase("BCC") ) {
        try {
          inputField = new AddressEntryTextArea(getNewMessageUI(), getNewMessageProxy().getNewMessageInfo().getHeader(Pooka.getProperty("MessageWindow.Input." + currentHeader + ".MIMEHeader", "") , ","), 1, 30);
        } catch (MessagingException me) {
          inputField = new net.suberic.util.swing.EntryTextArea(1, 30);
        }
      } else {
        try {
          inputField = new net.suberic.util.swing.EntryTextArea(getNewMessageProxy().getNewMessageInfo().getHeader(Pooka.getProperty("MessageWindow.Input." + currentHeader + ".MIMEHeader", "") , ","), 1, 30);
        } catch (MessagingException me) {
          inputField = new net.suberic.util.swing.EntryTextArea(1, 30);
        }
      }

      inputField.setLineWrap(true);
      inputField.setWrapStyleWord(true);
      inputField.setBorder(BorderFactory.createEtchedBorder());
      inputField.addKeyListener(new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            setModified(true);
          }
        });


      inputRow.add(inputField);
      if (inputField instanceof AddressEntryTextArea) {
        //int height = inputField.getPreferredSize().height;
        JButton addressButton = ((AddressEntryTextArea)inputField).createAddressButton(10, 10);
        inputRow.add(Box.createHorizontalGlue());
        inputRow.add(addressButton);
      }
      inputPanel.add(inputRow);

      proptDict.put(Pooka.getProperty("MessageWindow.Input." + currentHeader + ".value", currentHeader), inputField);
    }
View Full Code Here

  public Container createCustomHeaderPane() {

    JPanel returnValue = new JPanel();
    returnValue.setLayout(new BorderLayout());

    Box customInputPanel = new Box(BoxLayout.Y_AXIS);

    Vector headerNames = new Vector();
    headerNames.add(Pooka.getProperty("NewMessage.customHeaders.header", "Header"));
    headerNames.add(Pooka.getProperty("NewMessage.customHeaders.value", "Value"));

    CustomHeaderTableModel dtm = new CustomHeaderTableModel(headerNames, 4);

    customHeaderTable = new JTable(dtm);

    // get the preconfigured properties

    Properties headers = new Properties();

    Properties mailProperties = getSelectedProfile().getMailProperties();
    Enumeration keys = mailProperties.propertyNames();

    String fromAddr = null, fromPersonal = null, replyAddr = null, replyPersonal = null;

    // we want to put From and Reply-To first.
    java.util.List otherProps = new ArrayList();

    while (keys.hasMoreElements()) {
      String key = (String)(keys.nextElement());

      if (key.equals("FromPersonal")) {
        fromPersonal = mailProperties.getProperty(key);
      } else if (key.equals("From")) {
        fromAddr = mailProperties.getProperty(key);
      } else if (key.equals("ReplyTo")) {
        replyAddr = mailProperties.getProperty(key);
      } else if (key.equals("ReplyToPersonal")) {
        replyPersonal = mailProperties.getProperty(key);
      } else {
        otherProps.add(key);
      }
    }

    try {
      if (fromAddr != null) {
        if (fromPersonal != null && !(fromPersonal.equals("")))
          headers.setProperty("From", new InternetAddress(fromAddr, fromPersonal).toString());
        else
          headers.setProperty("From", new InternetAddress(fromAddr).toString());
      } else {
        headers.setProperty("From", "");
      }

      if (replyAddr != null && !(replyAddr.equals(""))) {
        if (replyPersonal != null)
          headers.setProperty("Reply-To", new InternetAddress(replyAddr, replyPersonal).toString());
        else
          headers.setProperty("Reply-To", new InternetAddress(replyAddr).toString());
      } else {
        headers.setProperty("Reply-To", "");
      }
    } catch (java.io.UnsupportedEncodingException uee) {
      //don't bother
    } catch (javax.mail.MessagingException me) {
      //don't bother
    }

    String currentHeader = null;
    String currentValue = null;
    JLabel hdrLabel = null;

    javax.swing.table.DefaultTableModel model = (javax.swing.table.DefaultTableModel) customHeaderTable.getModel();

    model.setValueAt("From", 0, 0);
    model.setValueAt(headers.getProperty("From", ""), 0, 1);

    model.setValueAt("Reply-To", 1, 0);
    model.setValueAt(headers.getProperty("Reply-To", ""), 1, 1);

    int row = 2;
    Iterator it = otherProps.iterator();
    while(it.hasNext()) {
      currentHeader=(String) it.next();
      currentValue = (String) headers.get(currentHeader);
      if (currentValue == null)
        currentValue = "";

      if (model.getRowCount() <= row) {
        model.addRow(new Vector());
      }

      model.setValueAt(currentHeader, row, 0);
      model.setValueAt(currentValue, row, 1);

      row++;
    }

    dtm.setUneditableRows(2 + otherProps.size());

    customInputPanel.add(new JScrollPane(customHeaderTable));

    returnValue.add(customInputPanel, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
View Full Code Here

        this.add(makeTitlePanel(), BorderLayout.NORTH);

        // TEXTAREA LABEL
        JLabel textAreaLabel =
            new JLabel(JMeterUtils.getResString("assertion_textarea_label")); // $NON-NLS-1$
        Box mainPanel = Box.createVerticalBox();
        mainPanel.add(textAreaLabel);

        // TEXTAREA
        textArea = new JTextArea();
        textArea.setEditable(false);
        textArea.setLineWrap(false);
        JScrollPane areaScrollPane = new JScrollPane(textArea);

        areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        areaScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

        areaScrollPane.setPreferredSize(new Dimension(mainPanel.getWidth(),mainPanel.getHeight()));
        mainPanel.add(areaScrollPane);
        this.add(mainPanel, BorderLayout.CENTER);
    }
View Full Code Here

     * Creates the information Panel at the bottom
     *
     * @return
     */
    private Box createGraphInfoPanel() {
        Box graphInfoPanel = Box.createHorizontalBox();
        this.noteField = new JTextField();
        graphInfoPanel.add(this.createInfoLabel("distribution_note1", this.noteField)); // $NON-NLS-1$
        return graphInfoPanel;
    }
View Full Code Here

     * Creates a panel which numerically displays the current graph values.
     *
     * @return a panel showing the current graph values
     */
    private Box createGraphInfoPanel() {
        Box graphInfoPanel = Box.createHorizontalBox();

        noSamplesField = createInfoField(Color.black, 6);
        dataField = createInfoField(Color.black, 5);
        averageField = createInfoField(Color.blue, 5);
        deviationField = createInfoField(Color.red, 5);
        throughputField = createInfoField(JMeterColor.dark_green, 15);
        medianField = createInfoField(JMeterColor.purple, 5);

        graphInfoPanel.add(createInfoColumn(createInfoLabel("graph_results_no_samples", noSamplesField), // $NON-NLS-1$
                noSamplesField, createInfoLabel("graph_results_deviation", deviationField), deviationField)); // $NON-NLS-1$
        graphInfoPanel.add(Box.createHorizontalGlue());

        graphInfoPanel.add(createInfoColumn(createInfoLabel("graph_results_latest_sample", dataField), dataField, // $NON-NLS-1$
                createInfoLabel("graph_results_throughput", throughputField), throughputField)); // $NON-NLS-1$
        graphInfoPanel.add(Box.createHorizontalGlue());

        graphInfoPanel.add(createInfoColumn(createInfoLabel("graph_results_average", averageField), averageField, // $NON-NLS-1$
                createInfoLabel("graph_results_median", medianField), medianField)); // $NON-NLS-1$
        graphInfoPanel.add(Box.createHorizontalGlue());
        return graphInfoPanel;
    }
View Full Code Here

     */
    private Box createInfoColumn(JLabel label1, JTextField field1, JLabel label2, JTextField field2) {
        // This column actually consists of a row with two sub-columns
        // The first column contains the labels, and the second
        // column contains the fields.
        Box row = Box.createHorizontalBox();
        Box col = Box.createVerticalBox();
        col.add(label1 != null ? label1 : Box.createVerticalGlue());
        col.add(label2 != null ? label2 : Box.createVerticalGlue());
        row.add(col);

        row.add(Box.createHorizontalStrut(5));

        col = Box.createVerticalBox();
        col.add(field1 != null ? field1 : Box.createVerticalGlue());
        col.add(field2 != null ? field2 : Box.createVerticalGlue());
        row.add(col);

        row.add(Box.createHorizontalStrut(5));

        return row;
View Full Code Here

        equalButton.setSelected(true);
        execState = Integer.parseInt(equalButton.getActionCommand());

        // Put the check boxes in a column in a panel
        Box checkPanel = Box.createVerticalBox();
        JLabel compareLabel = new JLabel(JMeterUtils.getResString("size_assertion_comparator_label")); //$NON-NLS-1$
        checkPanel.add(compareLabel);
        checkPanel.add(equalButton);
        checkPanel.add(notequalButton);
        checkPanel.add(greaterthanButton);
        checkPanel.add(lessthanButton);
        checkPanel.add(greaterthanequalButton);
        checkPanel.add(lessthanequalButton);
        return checkPanel;
    }
View Full Code Here

    private void init() {
        setLayout(new BorderLayout());
        setBorder(makeBorder());
        Box box = Box.createVerticalBox();
        box.add(makeTitlePanel());
        box.add(createSignaturePanel());
        box.add(createSignerPanel());
        box.add(createMessagePositionPanel());
        add(box, BorderLayout.NORTH);
    }
View Full Code Here

                signerSerialNumberField.setEnabled(signerCheckConstraints.isSelected());
                signerEmailField.setEnabled(signerCheckConstraints.isSelected());
                issuerDnField.setEnabled(signerCheckConstraints.isSelected());
            }
        });
        Box box = Box.createHorizontalBox();
        box.add(new JLabel(JMeterUtils.getResString("smime_assertion_signer_dn"))); // $NON-NLS-1$
        box.add(Box.createHorizontalStrut(5));
        box.add(signerDnField);
        panel.add(box);
        box = Box.createHorizontalBox();
        box.add(new JLabel(JMeterUtils.getResString("smime_assertion_signer_email"))); // $NON-NLS-1$
        box.add(Box.createHorizontalStrut(5));
        box.add(signerEmailField);
        panel.add(box);
        box = Box.createHorizontalBox();
        box.add(new JLabel(JMeterUtils.getResString("smime_assertion_issuer_dn"))); // $NON-NLS-1$
        box.add(Box.createHorizontalStrut(5));
        box.add(issuerDnField);
        panel.add(box);
        box = Box.createHorizontalBox();
        box.add(new JLabel(JMeterUtils.getResString("smime_assertion_signer_serial"))); // $NON-NLS-1$
        box.add(Box.createHorizontalStrut(5));
        box.add(signerSerialNumberField);
        panel.add(box);
        // panel.add(signerCheckByFile);
        signerCheckByFile.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                signerCertFile.setEnabled(signerCheckByFile.isSelected());
            }
        });
        box = Box.createHorizontalBox();
        box.add(signerCheckByFile);
        box.add(Box.createHorizontalStrut(5));
        box.add(signerCertFile);
        panel.add(box);
        return panel;
    }
View Full Code Here

TOP

Related Classes of javax.swing.Box

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.