Java 8 JTextArea - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JTextArea class.

This code example shows how to use the following methods:getFont, setFont, addCaretListener, getText
    SpinnerNumberModel  model;
     
    setLayout(new BorderLayout());
     
    // textarea 
    m_TextQuery = new JTextArea();
    m_TextQuery.addCaretListener(this);
    m_TextQuery.setFont(
        new Font("Monospaced", Font.PLAIN, m_TextQuery.getFont().getSize()));
    add(new JScrollPane(m_TextQuery), BorderLayout.CENTER);
 
    // buttons 
    panel = new JPanel(new BorderLayout());
    add(panel, BorderLayout.EAST);
    m_ButtonExecute.setMnemonic('E');
    m_ButtonExecute.addActionListener(new ActionListener() {
	public void actionPerformed(ActionEvent e) {
	  execute(); 
	} 
      }); 

7
CodeRank
This code example shows how to use the following methods:setBackground, setLineWrap, setWrapStyleWord, setEditable
     * @param entity The evolved entity to render. 
     * @return A text area containing the string representation of the entity. 
     */ 
    public JComponent render(Object entity)
    { 
        JTextArea text = new JTextArea(entity.toString());
        text.setEditable(false);
        text.setBackground(null);
        text.setLineWrap(true);
        text.setWrapStyleWord(true);
        return text;
    } 
} 
7
CodeRank
This code example shows how to use the following methods:setLineWrap, setWrapStyleWord, setCaretPosition, setEditable
     * @return a panel. 
     */ 
    private JPanel createLicencePanel() {
 
        final JPanel licencePanel = new JPanel(new BorderLayout());
        final JTextArea area = new JTextArea(this.licence);
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        area.setCaretPosition(0);
        area.setEditable(false);
        licencePanel.add(new JScrollPane(area));
        return licencePanel;
 
    } 
 
 
} 
7
CodeRank
This code example shows how to use the following methods:setLineWrap, setWrapStyleWord, setEditable
     * @see org.apache.jmeter.visualizers.request.RequestView#init() 
     */ 
    @Override 
    public void init() { 
        paneRaw = new JPanel(new BorderLayout(0, 5));
        sampleDataField = new JTextArea();
        sampleDataField.setEditable(false);
        sampleDataField.setLineWrap(true);
        sampleDataField.setWrapStyleWord(true);
 
        paneRaw.add(GuiUtils.makeScrollPane(sampleDataField));
 
    } 
 
    /* (non-Javadoc) 
     * @see org.apache.jmeter.visualizers.request.RequestView#clearData() 
     */ 
    @Override 
    public void clearData() { 
        sampleDataField.setText(""); //$NON-NLS-1$
7
CodeRank
This code example shows how to use the following methods:addFocusListener, setLineWrap, setRows, setWrapStyleWord, setDocument
     *            The text to display in the label. 
     * @param docModel the document for the text area 
     */ 
    public JLabeledTextArea(String pLabel, Document docModel) {
        super(); 
        mTextArea = new JTextArea();
        mLabel = new JLabel(pLabel);
        init(); 
        if (docModel != null) {
            mTextArea.setDocument(docModel);
        } 
    } 
 
    /** 
     * Get the label {@link JLabel} followed by the text field @link {@link JTextArea}. 
     */ 
    @Override 
    public List<JComponent> getComponentList() {
        List<JComponent> comps = new LinkedList<JComponent>();
        comps.add(mLabel);

7
CodeRank
This code example shows how to use the following methods:setOpaque, setEditable, setText
 
        addToPanel(mainPanel, labelConstraints, 0, 5, checkButton = new JButton("Test CSV File"));
 
        labelConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
 
        checkInfo = new JTextArea();
        addToPanel(mainPanel, editConstraints, 1, 5, GuiBuilderHelper.getTextAreaScrollPaneContainer(checkInfo, 10));
        checkButton.addActionListener(new TestCsvFileAction(this));
        checkInfo.setEditable(false);
        checkInfo.setOpaque(false);
 
        JPanel container = new JPanel(new BorderLayout());
        container.add(mainPanel, BorderLayout.NORTH);
        add(container, BorderLayout.CENTER);
    } 
 
    public JTextArea getCheckInfoTextArea() {
        return checkInfo;
    } 
 

6
CodeRank
This code example shows how to use the following methods:setLineWrap, setWrapStyleWord, setCaretPosition, setEditable
     * @return a panel. 
     */ 
    private JPanel createLicencePanel() {
 
        final JPanel licencePanel = new JPanel(new BorderLayout());
        final JTextArea area = new JTextArea(this.licence);
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        area.setCaretPosition(0);
        area.setEditable(false);
        licencePanel.add(new JScrollPane(area));
        return licencePanel;
 
    } 
 
 
} 
7
CodeRank
This code example shows how to use the following methods:setOpaque, setToolTipText, setLineWrap, setWrapStyleWord, setEditable
    private JLabel lblSource;
    private JTextArea lblChangesetComment;
    private JTextArea lblChangesetSource;
 
    protected static JTextArea buildTextArea(String tooltip) {
        JTextArea lbl = new JTextArea();
        lbl.setLineWrap(true);
        lbl.setWrapStyleWord(true);
        lbl.setEditable(false);
        lbl.setOpaque(false);
        lbl.setToolTipText(tooltip);
        return lbl;
    } 
 
    protected static JLabel buildLabel(String text, String tooltip, JTextArea textArea) {
        // We need text field to be a JTextArea for line wrapping but cannot put HTML code in here, 
        // so create a separate JLabel with same characteristics (margin, font) 
        JLabel lbl = new JLabel("<html><p style='margin-top:"+textArea.getMargin().top+"'>"+text+"</html>");
        lbl.setFont(textArea.getFont());
        lbl.setToolTipText(tooltip);
6
CodeRank
This code example shows how to use the following methods:setBackground, setLineWrap, setEditable
 
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(label, BorderLayout.NORTH);
        panel.add(new JTextScrollPane(scriptField), BorderLayout.CENTER);
 
        JTextArea explain = new JTextArea(JMeterUtils.getResString("bsh_assertion_script_variables")); //$NON-NLS-1$
        explain.setLineWrap(true);
        explain.setEditable(false);
        explain.setBackground(this.getBackground());
        panel.add(explain, BorderLayout.SOUTH);
 
        return panel;
    } 
 
    @Override 
    public void clearGui() { 
        super.clearGui(); 
        filename.setText(""); // $NON-NLS-1$
        parameters.setText(""); // $NON-NLS-1$
        scriptField.setInitialText(""); // $NON-NLS-1$
6
CodeRank
This code example shows how to use the following methods:setBackground, setLineWrap, setEditable
 
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(label, BorderLayout.NORTH);
        panel.add(new JTextScrollPane(scriptField), BorderLayout.CENTER);
 
        JTextArea explain = new JTextArea(JMeterUtils.getResString("bsh_script_variables")); //$NON-NLS-1$
        explain.setLineWrap(true);
        explain.setEditable(false);
        explain.setBackground(this.getBackground());
        panel.add(explain, BorderLayout.SOUTH);
 
        return panel;
    } 
} 
6
CodeRank
See Code Examples for Java 8 JTextArea Methods: