Package javax.swing.text

Examples of javax.swing.text.JTextComponent


  }

  @RunsInEDT
  private @Nonnull JTextComponent doStartCellEditing(@Nonnull JTable table, int row, int column) {
    Point cellLocation = cellLocation(table, row, column, location());
    JTextComponent textComponent = null;
    try {
      textComponent = activateEditorWithF2Key(table, row, column, cellLocation);
    } catch (ActionFailedException e) {
      textComponent = activateEditorWithDoubleClick(table, row, column, cellLocation);
    }
View Full Code Here


     * {@inheritDoc}
     */
    public void processInput(BridgeComponentPeer peer,
            BridgeInputContext context, Map inputForm)
    {
        JTextComponent com = (JTextComponent) peer.getComponentObject();
        if (com.isEditable() && hasEvent(peer, inputForm))
        {
            String text = (String) inputForm.get(peer.getId());
            com.setText(text);
            createEvent(context, peer, com);
        }
    }
View Full Code Here

    public boolean hasEvent(BridgePeer peer, Map form)
    {
        String text = (String) form.get(peer.getId());
        if (text != null)
        {
            JTextComponent com = (JTextComponent) peer.getComponentObject();
            return !text.equals(com.getText());
        } else
        {
            return false;
        }
    }
View Full Code Here

            super("Plot Signal");
        }
       
        @Override
        public void actionPerformed(ActionEvent e) {
        JTextComponent tc = getTextComponent(e);
        String signalName = null;
       
        // Get the name of the signal to plot. If there is a selection, use that as the signal name,
        // otherwise, scan for a signalname around the caret
        try {
            int selStart = tc.getSelectionStart();
            int selEnd = tc.getSelectionEnd();
            if (selStart != selEnd) {
                signalName = tc.getText(selStart, selEnd - selStart);
            }
            else {
                signalName = getSignalNameAtCaret(tc);
            }
        }
View Full Code Here

    final String[] changeLog = getText().split("\n\n");

    // Split up the change log by version
    for(String entry : changeLog) {
      String[] data = entry.split("\n", 2);
      JTextComponent jta = new ColoredTextArea();
      jta.setText(data[1]);
      jta.setEditable(false);
      cards.add(data[0], new JScrollPane(jta));
      model.addElement(data[0]);
    }

    JComboBox<String> cb = new JComboBox<String>(model);
View Full Code Here

        else
        {
          editorDialog = new TextAreaPropertyEditorDialog();
        }

        final JTextComponent textField = getTextField();
        final String originalValue = textField.getText();
        final String text = editorDialog.performEdit(originalValue);
        if (editorDialog.isConfirmed())
        {
          textField.setText(text);
        }
      }

      stopCellEditing();
    }
View Full Code Here

    /**
     * Invoked when an action occurs.
     */
    public void actionPerformed(final ActionEvent e)
    {
      final JTextComponent textComponent = getTextField();
      final int position = textComponent.getCaretPosition();
      try
      {
        textComponent.getDocument().insertString(position, "\n", null);
      }
      catch (BadLocationException e1)
      {
        // yeah, whatever
        UncaughtExceptionsModel.getInstance().addException(e1);
View Full Code Here

  {
    // this depends on who has the focus right now.
    final Component owner = FocusManager.getCurrentManager().getPermanentFocusOwner();
    if (owner instanceof JTextComponent)
    {
      final JTextComponent textComponent = (JTextComponent) owner;
      textComponent.selectAll();
    }
    else if (owner instanceof TextComponent)
    {
      final TextComponent textComponent = (TextComponent) owner;
      textComponent.selectAll();
    }
    else if (owner instanceof JTable)
    {
      final JTable table = (JTable) owner;
      table.selectAll();
View Full Code Here

  {
    // this depends on who has the focus right now.
    final Component owner = FocusManager.getCurrentManager().getPermanentFocusOwner();
    if (owner instanceof JTextComponent)
    {
      final JTextComponent textComponent = (JTextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof TextComponent)
    {
      final TextComponent textComponent = (TextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof JTable)
    {
      final JTable table = (JTable) owner;
      table.clearSelection();
View Full Code Here

* A {@link WiringHarness} for binding a {@link JTextComponent} to a {@link String} value in a
* {@link BindableModel}.
*/
public class JTextComponentWiringHarness implements WiringHarness<Bound, Field> {
    public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException {
        JTextComponent textComponent = context.getFieldObject(field, JTextComponent.class);
        Mutator mutator = Mutator.create(context, bound.to());
        Binding binding = bindJTextComponent(mutator, textComponent);
        if (binding == null) {
            return ImmutableList.of();
        }
View Full Code Here

TOP

Related Classes of javax.swing.text.JTextComponent

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.