# How to Highlight Text in a ControlP5 Textfield?

**URL:** <https://discourse.processing.org/t/how-to-highlight-text-in-a-controlp5-textfield/44256>\
**Category:** Libraries\
**Created:** [April 8, 2024, 8:33pm UTC](https://discourse.processing.org/t/how-to-highlight-text-in-a-controlp5-textfield/44256 "2024-04-08T20:33:41Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [April 11, 2024, 3:51am UTC](https://discourse.processing.org/t/how-to-highlight-text-in-a-controlp5-textfield/44256/20 "2024-04-11T03:51:54Z")

</div>

```auto
I start to see why they didn’t include javafx in Processing

```

It really is not that difficult; the authors just failed to include the _javafx.controls_ module, even though they did include three other modules: [JavaFX Unable to add modules to Processing IDE - #3 by svan](https://discourse.processing.org/t/javafx-unable-to-add-modules-to-processing-ide/41272/3) (read the entire thread)

However, the last error that you described is due to something else. I have no idea why they don’t want to support JavaFX controls. They really are good controls and were initially intended to supplant Swing.

**Addendum:**

Speaking of Swing, have you looked at JTextField?

```auto
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

javax.swing.JFrame frame;
java.awt.Canvas canvas;

final int _wndW = 400;
final int _wndH = 300;

void buildWnd() {
  JTextField txtFld = new JTextField("");
  txtFld.setBounds(50, 40, 280, 30);
  txtFld.setBackground(Color.WHITE);
  frame.add(txtFld);
  // ****Action**** //
  txtFld.addActionListener( new ActionListener() {
    void actionPerformed(ActionEvent actionEvent) {
      // Do something;
    }
  }
  );
  txtFld.repaint(); // To make it visible after export application.
}

void setup() {
  frame = (javax.swing.JFrame) ((processing.awt.PSurfaceAWT.SmoothCanvas) surface.getNative()).getFrame();
  canvas = (processing.awt.PSurfaceAWT.SmoothCanvas) ((processing.awt.PSurfaceAWT)surface).getNative();
  frame.setBounds(500, 300, _wndW, _wndH);
  frame.remove(canvas);

  javax.swing.SwingUtilities.invokeLater(()-> {
    buildWnd(); // Builds components on EventDispatchThread
  }
  );
}

```

---

_[View the full topic](https://discourse.processing.org/t/how-to-highlight-text-in-a-controlp5-textfield/44256)._
