Example usage for javax.swing JTextArea JTextArea

List of usage examples for javax.swing JTextArea JTextArea

Introduction

In this page you can find the example usage for javax.swing JTextArea JTextArea.

Prototype

public JTextArea() 

Source Link

Document

Constructs a new TextArea.

Usage

From source file:eu.apenet.dpt.standalone.gui.APETabbedPane.java

private void create() {
    validationErrors = new JTextArea();
    validationReportBtn = new JButton();
    JPanel validationPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel(new GridLayout(1, 5));
    buttonPanel.add(new JLabel(""));
    buttonPanel.add(new JLabel(""));
    buttonPanel.add(validationReportBtn);
    buttonPanel.add(new JLabel(""));
    buttonPanel.add(new JLabel(""));
    validationPanel.add(buttonPanel, BorderLayout.NORTH);
    validationPanel.add(validationErrors, BorderLayout.CENTER);
    conversionErrors = new JTextArea();
    edmConversionErrors = new JTextArea();
    validationPane = new JScrollPane(validationPanel);
    conversionPane = new JScrollPane(conversionErrors);
    edmConversionPane = new JScrollPane(edmConversionErrors);
    editionPane = new JScrollPane();

    convertBtn = new JButton();
    validateBtn = new JButton();
    convertAndValidateBtn = new JButton();
    convertEdmBtn = new JButton();

    stylesheetLabel = new JLabel(labels.getString("summary.stylesheets.label") + ":");
    schemaLabel = new JLabel(labels.getString("summary.schemas.label") + ":");

    xsltPanel = new JPanel();
    xsdPanel = new JPanel();
}

From source file:dk.dma.epd.common.prototype.gui.voct.VOCTAdditionalInfoPanel.java

/**
 * Constructor/*  w ww.  j  a  v  a 2s  . c om*/
 * 
 * @param compactLayout
 *            if false, there will be message type selectors in the panel
 */
public VOCTAdditionalInfoPanel(boolean compactLayout) {
    super(new BorderLayout());

    EPD.getInstance().getVoctHandler().addVoctSarInfoListener(this);

    // Prepare the title header
    titleHeader.setBackground(getBackground().darker());
    titleHeader.setOpaque(true);
    titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    titleHeader.setHorizontalAlignment(SwingConstants.CENTER);
    add(titleHeader, BorderLayout.NORTH);

    // Add messages panel
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    messagesPanel.setBackground(UIManager.getColor("List.background"));
    messagesPanel.setOpaque(false);
    messagesPanel.setLayout(new GridBagLayout());
    messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(scrollPane, BorderLayout.CENTER);

    JPanel sendPanel = new JPanel(new GridBagLayout());
    add(sendPanel, BorderLayout.SOUTH);
    Insets insets = new Insets(2, 2, 2, 2);

    // Add text area
    // if (false) {
    // messageText = new JTextField();
    // ((JTextField) messageText).addActionListener(this);
    // sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));
    //
    // } else {
    messageText = new JTextArea();
    JScrollPane scrollPane2 = new JScrollPane(messageText);
    scrollPane2.setPreferredSize(new Dimension(100, 50));
    scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));
    // }

    // Add buttons
    // ButtonGroup group = new ButtonGroup();

    if (!compactLayout) {
        JToolBar msgTypePanel = new JToolBar();
        msgTypePanel.setBorderPainted(false);
        msgTypePanel.setOpaque(true);
        msgTypePanel.setFloatable(false);
        sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));

    }

    if (compactLayout) {
        addBtn = new JButton("Add to Log");
        sendPanel.add(addBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    }
    // addBtn.setEnabled(false);
    // messageText.setEditable(false);
    addBtn.addActionListener(this);
}

From source file:com.eviware.soapui.impl.wsdl.panels.teststeps.WsdlTestRequestDesktopPanel.java

private Component buildLogPanel() {
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.RIGHT);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    logArea = new JTextArea();
    logArea.setEditable(false);/*ww w. j a v  a 2 s  . c  o  m*/
    logArea.setToolTipText("Request Log");

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JScrollPane(logArea), BorderLayout.CENTER);

    tabbedPane.addTab("Assertions", buildAssertionsPanel());
    tabbedPane.addTab("Request Log", panel);
    return UISupport.createTabPanel(tabbedPane, true);
}

From source file:gtu._work.ui.SqlCreaterUI.java

private void initGUI() {
    try {//  ww  w.j a  v a 2  s .  c o  m
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    jPanel2 = new JPanel();
                    jPanel1.add(jPanel2, BorderLayout.NORTH);
                    jPanel2.setPreferredSize(new java.awt.Dimension(582, 112));
                    {
                        jLabel1 = new JLabel();
                        jPanel2.add(jLabel1);
                        jLabel1.setText("SQL");
                    }
                    {
                        JScrollPane jScrollPane2 = new JScrollPane();
                        jPanel2.add(jScrollPane2);
                        jScrollPane2.setPreferredSize(new java.awt.Dimension(524, 57));
                        {
                            sqlArea = new JTextArea();
                            jScrollPane2.setViewportView(sqlArea);
                        }
                    }
                    {
                        jLabel2 = new JLabel();
                        jPanel2.add(jLabel2);
                        jLabel2.setText("\u4f86\u6e90\u6a94\u8def\u5f91");
                    }
                    {
                        excelFilePathText = new JTextField();
                        JCommonUtil.jTextFieldSetFilePathMouseEvent(excelFilePathText, false);
                        jPanel2.add(excelFilePathText);
                        excelFilePathText.setPreferredSize(new java.awt.Dimension(455, 22));
                    }
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn, BorderLayout.SOUTH);
                    executeBtn.setText("\u7522\u751f");
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnPreformed();
                        }
                    });
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(582, 221));
                    {
                        JScrollPane jScrollPane3 = new JScrollPane();
                        jScrollPane1.setViewportView(jScrollPane3);
                        {
                            logArea = new JTextArea();
                            jScrollPane3.setViewportView(logArea);
                        }
                    }
                }
            }
            {
                jPanel3 = new JPanel();
                FlowLayout jPanel3Layout = new FlowLayout();
                jTabbedPane1.addTab("jPanel3", null, jPanel3, null);
                jPanel3.setLayout(jPanel3Layout);
                {
                    jLabel4 = new JLabel();
                    jPanel3.add(jLabel4);
                    jLabel4.setText("Table\u540d\u7a31");
                }
                {
                    tableNameText = new JTextField();
                    jPanel3.add(tableNameText);
                    tableNameText.setPreferredSize(new java.awt.Dimension(463, 23));
                }
                {
                    jLabel3 = new JLabel();
                    jPanel3.add(jLabel3);
                    jLabel3.setText("\u4f86\u6e90\u6a94\u8def\u5f91");
                }
                {
                    excelFilePathText2 = new JTextField();
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(excelFilePathText2, false);
                    jPanel3.add(excelFilePathText2);
                    excelFilePathText2.setPreferredSize(new java.awt.Dimension(455, 22));
                }
                {
                    firstRowMakeInsertSqlBtn = new JButton();
                    jPanel3.add(firstRowMakeInsertSqlBtn);
                    firstRowMakeInsertSqlBtn.setText(
                            "\u4ee5\u7b2c\u4e00\u5217\u70ba\u6b04\u4f4d\u540d\u7a31\u7522\u751fInsert SQL");
                    firstRowMakeInsertSqlBtn.setPreferredSize(new java.awt.Dimension(251, 22));
                    firstRowMakeInsertSqlBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            firstRowMakeInsertSqlBtn(evt);
                        }
                    });
                }
            }
        }
        pack();
        this.setSize(595, 409);
    } catch (Exception e) {
        // add your error handling code here
        e.printStackTrace();
    }
}

From source file:FocusEventDemo.java

public void addComponentsToPane(final Container pane) {
    GridBagLayout gridbag = new GridBagLayout();
    pane.setLayout(gridbag);/*from   ww w  . j av  a 2s.c  o  m*/

    GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0; // Make column as wide as possible.
    JTextField textField = new JTextField("A TextField");
    textField.setMargin(new Insets(0, 2, 0, 2));
    textField.addFocusListener(this);
    gridbag.setConstraints(textField, c);
    add(textField);

    c.weightx = 0.1; // Widen every other column a bit, when possible.
    c.fill = GridBagConstraints.NONE;
    JLabel label = new JLabel("A Label");
    label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    label.addFocusListener(this);
    gridbag.setConstraints(label, c);
    add(label);

    String comboPrefix = "ComboBox Item #";
    final int numItems = 15;
    Vector<String> vector = new Vector<String>(numItems);
    for (int i = 0; i < numItems; i++) {
        vector.addElement(comboPrefix + i);
    }
    JComboBox comboBox = new JComboBox(vector);
    comboBox.addFocusListener(this);
    gridbag.setConstraints(comboBox, c);
    add(comboBox);

    c.gridwidth = GridBagConstraints.REMAINDER;
    JButton button = new JButton("A Button");
    button.addFocusListener(this);
    gridbag.setConstraints(button, c);
    add(button);

    c.weightx = 0.0;
    c.weighty = 0.1;
    c.fill = GridBagConstraints.BOTH;
    String listPrefix = "List Item #";
    Vector<String> listVector = new Vector<String>(numItems);
    for (int i = 0; i < numItems; i++) {
        listVector.addElement(listPrefix + i);
    }
    JList list = new JList(listVector);
    list.setSelectedIndex(1); // It's easier to see the focus change
    // if an item is selected.
    list.addFocusListener(this);
    JScrollPane listScrollPane = new JScrollPane(list);

    gridbag.setConstraints(listScrollPane, c);
    add(listScrollPane);

    c.weighty = 1.0; // Make this row as tall as possible.
    c.gridheight = GridBagConstraints.REMAINDER;
    // Set up the area that reports focus-gained and focus-lost events.
    display = new JTextArea();
    display.setEditable(false);
    // The setRequestFocusEnabled method prevents a
    // component from being clickable, but it can still
    // get the focus through the keyboard - this ensures
    // user accessibility.
    display.setRequestFocusEnabled(false);
    display.addFocusListener(this);
    JScrollPane displayScrollPane = new JScrollPane(display);

    gridbag.setConstraints(displayScrollPane, c);
    add(displayScrollPane);
    setPreferredSize(new Dimension(450, 450));
    ((JPanel) pane).setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.ImportDataFileInfo.java

/**
 *  shows modified (truncated) data after import
 *//*w  w  w  . j a  va  2 s.c  o m*/
protected void showModifiedData() {
    if (importer.getTruncations().size() > 0) {
        JPanel mainPane = new JPanel(new BorderLayout());
        JLabel msg = createLabel(getResourceString("WB_TRUNCATIONS"));
        msg.setFont(msg.getFont().deriveFont(Font.BOLD));
        mainPane.add(msg, BorderLayout.NORTH);

        String[] heads = new String[3];
        String[][] vals = new String[importer.getTruncations().size()][3];
        heads[0] = getResourceString("WB_ROW");
        heads[1] = getResourceString("WB_COLUMN");
        heads[2] = getResourceString("WB_TRUNCATED");

        int row = 0;
        for (DataImportTruncation trunc : importer.getTruncations()) {
            vals[row][0] = String.valueOf(trunc.getRow());
            vals[row][1] = trunc.getColHeader();
            if (vals[row][1].equals("")) {
                vals[row][1] = String.valueOf(trunc.getCol() + 1);
            }
            vals[row++][2] = trunc.getExcluded();
        }

        JTable mods = new JTable(vals, heads);
        mods.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false));

        mainPane.add(UIHelper.createScrollPane(mods), BorderLayout.CENTER);

        CustomFrame cwin = new CustomFrame(getResourceString(MODIFIED_IMPORT_DATA), CustomFrame.OKHELP,
                mainPane);
        cwin.setHelpContext("WorkbenchImportData"); //help context could be more specific
        cwin.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        UIHelper.centerAndShow(cwin);
    }
    if (importer.getMessages().size() > 0) {
        JPanel mainPane = new JPanel(new BorderLayout());
        JTextArea msgs = new JTextArea();
        msgs.setRows(importer.getMessages().size());
        for (String msg : importer.getMessages()) {
            msgs.append(msg);
            msgs.append("\n");
        }
        mainPane.add(msgs, BorderLayout.CENTER);
        CustomFrame cwin = new CustomFrame(getResourceString(MODIFIED_IMPORT_DATA), CustomFrame.OKHELP,
                mainPane);
        cwin.setHelpContext("WorkbenchImportData"); //help context could be more specific
        cwin.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        UIHelper.centerAndShow(cwin);
    }
}

From source file:SiteFrame.java

public PageFrame(String name, SiteManager sm) {
    super("Page: " + name, true, true, true, true);
    parent = sm;/*ww  w.  java  2 s .co  m*/
    setBounds(50, 50, 300, 150);

    Container contentPane = getContentPane();

    // Create a text area to display the contents of our file in
    // and stick it in a scrollable pane so we can see everything
    ta = new JTextArea();
    JScrollPane jsp = new JScrollPane(ta);
    contentPane.add(jsp, BorderLayout.CENTER);

    JMenuBar jmb = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem saveItem = new JMenuItem("Save");
    saveItem.addActionListener(this);
    fileMenu.add(saveItem);
    jmb.add(fileMenu);
    setJMenuBar(jmb);

    filename = name;
    loadContent();
}

From source file:gtu._work.ui.ObnfExceptionLogDownloadUI.java

private void initGUI() {
    try {//w  w  w  . ja  v  a2s . c o  m
        JCommonUtil.frameCloseConfirm(this);
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                FlowLayout jPanel1Layout = new FlowLayout();
                jTabbedPane1.addTab("", null, jPanel1, null);
                jPanel1.setLayout(jPanel1Layout);
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("\u532f\u51fa\u76ee\u9304");
                }
                {
                    exportTextField = new JTextField();
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(exportTextField, true);
                    jPanel1.add(exportTextField);
                    exportTextField.setPreferredSize(new java.awt.Dimension(187, 22));
                }
                {
                    jLabel2 = new JLabel();
                    jPanel1.add(jLabel2);
                    jLabel2.setText("domainJar");
                    jLabel2.setPreferredSize(new java.awt.Dimension(56, 15));
                }
                {
                    domainJarText = new JTextField();
                    ObnfRepairDBBatch batch = new ObnfRepairDBBatch();
                    domainJarText.setText(batch.fetchDomainJar());
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(domainJarText, false);
                    jPanel1.add(domainJarText);
                    domainJarText.setPreferredSize(new java.awt.Dimension(185, 22));
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(512, 262));
                    {
                        messageIdArea = new JTextArea();
                        jScrollPane1.setViewportView(messageIdArea);
                    }
                }
                {
                    DefaultComboBoxModel jComboBox1Model = new DefaultComboBoxModel();
                    for (FtpSite f : FtpSite.values()) {
                        jComboBox1Model.addElement(f);
                    }
                    siteFtpComboBox = new JComboBox();
                    jPanel1.add(siteFtpComboBox);
                    siteFtpComboBox.setModel(jComboBox1Model);
                }
                {
                    downloadBtn = new JButton();
                    jPanel1.add(downloadBtn);
                    downloadBtn.setText("\u4e0b\u8f09");
                    downloadBtn.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            downloadBtnAction();
                        }
                    });
                }
                {
                    makeReportBtn = new JButton();
                    jPanel1.add(makeReportBtn);
                    makeReportBtn.setText("\u7522\u751f\u5831\u8868");
                    makeReportBtn.setPreferredSize(new java.awt.Dimension(102, 22));
                    makeReportBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            makeReportBtnPerformed();
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("log", null, jPanel2, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel2.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(529, 340));
                    {
                        logArea = new JTextArea();
                        jScrollPane2.setViewportView(logArea);
                    }
                }
            }
        }
        pack();
        this.setSize(542, 394);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:au.org.ala.delta.intkey.ui.MultiStateInputDialog.java

/**
 * ctor/*from   ww w.ja  v a2 s  .c om*/
 * 
 * @param owner
 *            Owner frame of dialog
 * @param ch
 *            the character whose states are being set
 * @param initialSelectedStates
 *            initial states that should be selected in the dialog. In
 *            general this should be any states already set for the
 *            character. In the case that this is a controlling character
 *            being set before its dependent character, all states that make
 *            the dependent character applicable should be selected.
 * @param dependentCharacter
 *            the dependent character - if the dialog is being used to set a
 *            controlling character before its dependent character, this
 *            argument should be a reference to the dependent character. In
 *            all other cases it should be null.
 * @param imageSettings
 *            image settings
 * @param displayNumbering
 *            true if numbering should be displayed
 * @param enableImagesButton
 *            the if the images button should be enabled
 * @param imagesStartScaled
 *            true if images should start scaled.
 */
public MultiStateInputDialog(Frame owner, MultiStateCharacter ch, Set<Integer> initialSelectedStates,
        au.org.ala.delta.model.Character dependentCharacter, ImageSettings imageSettings,
        boolean displayNumbering, boolean enableImagesButton, boolean imagesStartScaled, boolean advancedMode) {
    super(owner, ch, imageSettings, displayNumbering, enableImagesButton, imagesStartScaled, advancedMode);

    ResourceMap resourceMap = Application.getInstance().getContext()
            .getResourceMap(MultiStateInputDialog.class);
    resourceMap.injectFields(this);

    setTitle(title);
    setPreferredSize(new Dimension(600, 350));

    if (dependentCharacter != null) {
        _pnlControllingCharacterMessage = new JPanel();
        _pnlControllingCharacterMessage.setFocusable(false);
        _pnlControllingCharacterMessage.setBorder(new EmptyBorder(5, 0, 0, 0));
        _pnlMain.add(_pnlControllingCharacterMessage, BorderLayout.SOUTH);
        _pnlControllingCharacterMessage.setLayout(new BorderLayout(0, 0));

        _lblWarningIcon = new JLabel("");
        _lblWarningIcon.setFocusable(false);
        _lblWarningIcon.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
        _pnlControllingCharacterMessage.add(_lblWarningIcon, BorderLayout.WEST);

        _txtControllingCharacterMessage = new JTextArea();
        _txtControllingCharacterMessage.setText(MessageFormat.format(setControllingCharacterMessage,
                _formatter.formatCharacterDescription(dependentCharacter),
                _formatter.formatCharacterDescription(ch)));
        _txtControllingCharacterMessage.setFocusable(false);
        _txtControllingCharacterMessage.setBorder(new EmptyBorder(0, 5, 0, 0));
        _txtControllingCharacterMessage.setEditable(false);
        _pnlControllingCharacterMessage.add(_txtControllingCharacterMessage);
        _txtControllingCharacterMessage.setWrapStyleWord(true);
        _txtControllingCharacterMessage.setFont(UIManager.getFont("Button.font"));
        _txtControllingCharacterMessage.setLineWrap(true);
        _txtControllingCharacterMessage.setBackground(SystemColor.control);
    }

    _scrollPane = new JScrollPane();
    _pnlMain.add(_scrollPane, BorderLayout.CENTER);

    _list = new JList();
    _scrollPane.setViewportView(_list);

    _listModel = new DefaultListModel();
    for (int i = 0; i < ch.getNumberOfStates(); i++) {
        _listModel.addElement(_formatter.formatState(ch, i + 1));
    }

    _list.setModel(_listModel);

    _list.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() > 1) {
                // Treat double click on a list item as the ok button being
                // pressed.
                _okPressed = true;
                handleBtnOKClicked();
            }
        }

    });

    // Select the list items that correspond to the initial selected states.
    if (initialSelectedStates != null) {
        List<Integer> listIndiciesToSelect = new ArrayList<Integer>();
        for (int stateNumber : new ArrayList<Integer>(initialSelectedStates)) {
            listIndiciesToSelect.add(stateNumber - 1);
        }

        Integer[] wrappedPrimitivesList = listIndiciesToSelect
                .toArray(new Integer[initialSelectedStates.size()]);
        _list.setSelectedIndices(ArrayUtils.toPrimitive(wrappedPrimitivesList));
    }

    _inputData = new HashSet<Integer>();

}

From source file:org.tinymediamanager.ui.dialogs.FeedbackDialog.java

/**
 * Instantiates a new feedback dialog.//w w w .  j  av  a 2  s  .  co  m
 */
public FeedbackDialog() {
    super(BUNDLE.getString("Feedback"), "feedback"); //$NON-NLS-1$
    setBounds(100, 100, 450, 320);

    getContentPane().setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(400px;min):grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:max(250px;min):grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, }));

    JPanel panelContent = new JPanel();
    getContentPane().add(panelContent, "2, 2, fill, fill");
    panelContent.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.PARAGRAPH_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));

    JLabel lblName = new JLabel(BUNDLE.getString("Feedback.name")); //$NON-NLS-1$
    panelContent.add(lblName, "2, 2, right, default");

    tfName = new JTextField();
    panelContent.add(tfName, "4, 2, fill, default");
    tfName.setColumns(10);

    JLabel lblEmailoptional = new JLabel(BUNDLE.getString("Feedback.email")); //$NON-NLS-1$
    panelContent.add(lblEmailoptional, "2, 4, right, default");

    tfEmail = new JTextField();
    panelContent.add(tfEmail, "4, 4, fill, default");
    tfEmail.setColumns(10);

    // pre-fill dialog
    if (Globals.isDonator()) {
        Properties p = License.decrypt();
        tfEmail.setText(p.getProperty("email"));
        tfName.setText(p.getProperty("user"));
    }

    JLabel lblFeedback = new JLabel(BUNDLE.getString("Feedback.message")); //$NON-NLS-1$
    panelContent.add(lblFeedback, "2, 6, 3, 1");

    JScrollPane scrollPane = new JScrollPane();
    panelContent.add(scrollPane, "2, 8, 3, 1, fill, fill");

    textArea = new JTextArea();
    scrollPane.setViewportView(textArea);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);

    JPanel panelButtons = new JPanel();
    panelButtons.setLayout(new EqualsLayout(5));
    getContentPane().add(panelButtons, "2, 4, fill, fill");

    JButton btnSend = new JButton(BUNDLE.getString("Feedback")); //$NON-NLS-1$
    btnSend.setIcon(IconManager.APPLY);
    btnSend.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            // check if feedback is provided
            if (StringUtils.isEmpty(textArea.getText())) {
                JOptionPane.showMessageDialog(null, BUNDLE.getString("Feedback.message.empty")); //$NON-NLS-1$
                return;
            }

            // send feedback
            HttpClient client = TmmHttpClient.getHttpClient();
            HttpPost post = new HttpPost(
                    "https://script.google.com/macros/s/AKfycbxTIhI58gwy0UJ0Z1CdmZDdHlwBDU_vugBmQxcKN9aug4nfgrgZ/exec");
            try {
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);

                StringBuilder message = new StringBuilder("Feedback from ");
                message.append(tfName.getText());
                message.append("\nEmail:");
                message.append(tfEmail.getText());
                message.append("\n");
                message.append("\nis Donator?: ");
                message.append(Globals.isDonator());
                message.append("\nVersion: ");
                message.append(ReleaseInfo.getRealVersion());
                message.append("\nBuild: ");
                message.append(ReleaseInfo.getRealBuildDate());
                message.append("\nOS: ");
                message.append(System.getProperty("os.name"));
                message.append(" ");
                message.append(System.getProperty("os.version"));
                message.append("\nJDK: ");
                message.append(System.getProperty("java.version"));
                message.append(" ");
                message.append(System.getProperty("java.vendor"));
                message.append("\nUUID: ");
                message.append(System.getProperty("tmm.uuid"));
                message.append("\n\n");
                message.append(textArea.getText());

                nameValuePairs.add(new BasicNameValuePair("message", message.toString()));
                nameValuePairs.add(new BasicNameValuePair("sender", tfEmail.getText()));
                post.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));

                HttpResponse response = client.execute(post);

                HttpEntity entity = response.getEntity();
                EntityUtils.consume(entity);

            } catch (IOException e) {
                LOGGER.error("failed sending feedback: " + e.getMessage());
                JOptionPane.showMessageDialog(null,
                        BUNDLE.getString("Feedback.send.error") + "\n" + e.getMessage()); //$NON-NLS-1$
                return;
            }

            JOptionPane.showMessageDialog(null, BUNDLE.getString("Feedback.send.ok")); //$NON-NLS-1$
            setVisible(false);
        }
    });
    panelButtons.add(btnSend);

    JButton btnCacnel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
    btnCacnel.setIcon(IconManager.CANCEL);
    btnCacnel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });
    panelButtons.add(btnCacnel);
}