Java 8 JTextComponent - 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 JTextComponent class.

This code example shows how to use the following methods:getText
        c.insets = new Insets(5, 5, 5, 5);
        panel.add(startButton, c);
    } 
     
    private void start() { 
        workingMemory.startProcess(processIdTextField.getText());
        workingMemory.fireAllRules();
    } 
     
} 
7
CodeRank
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:addCaretListener, getText, setText
 
  /** the label for the URL. */ 
  protected JLabel m_LabelURL = new JLabel("URL ");
 
  /** the textfield for the URL. */ 
  protected JTextField m_TextURL = new JTextField(40);
 
  /** the button for the DB-Dialog. */ 
  protected JButton m_ButtonDatabase = new JButton("User...");
 
  /** the button for connecting to the database. */ 
  protected JButton m_ButtonConnect = new JButton("Connect");
 
  /** the button for the history. */ 
  protected JButton m_ButtonHistory = new JButton("History...");
 
  /** the connection listeners. */ 
  protected HashSet m_ConnectionListeners;
 
  /** the history listeners. */ 

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:addKeyListener, setBackground, setEnabled, setToolTipText, setDisabledTextColor
 
    public FloatPropertyView(Item item, Packet in, XAppDbgConnection connection) throws IOException {
        super(item, in.getChannel(), connection);
 
        // Setup UI 
        mField = new JTextField();
        mField.setDisabledTextColor(Color.DARK_GRAY);
        add(mField, BorderLayout.CENTER);
        mField.addKeyListener(this);
        mField.setToolTipText(item.getDescription());
 
        if (item.isReadable()) {
            // Read initial value 
            mCachedValue = mOrigValue = in.readFloat();
            showValue(); 
        } 
 
        if (!item.isWritable()) {
            mField.setEnabled(false);
        } 

7
CodeRank
This code example shows how to use the following methods:getText
     
    protected String[] getFieldValues() {
        return new String [] {
                // TODO: This will have to be special once we aren't 
                // just passing plain strings around 
                _pathTextField.getText()
        }; 
    } 
     
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == _browseButton) {
            JFileChooser chooser = new JFileChooser();
             
            // TODO: We should probably use the BasicPanel as the parent 
            int result = chooser.showOpenDialog(_browseButton);
             
            if (result == JFileChooser.APPROVE_OPTION) {
                _pathTextField.setText(chooser.getSelectedFile().getAbsolutePath());
                _pathTextField.setCaretPosition(0);
                 
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
See Code Examples for Java 8 JTextComponent Methods: