4

We have multiple tag input in JS ( picture )

Tag Input on JS

I wanted to know is there any default Java Swing facility to do it within JTextField or JTextArea. Is there any custom look-and-feel library or plugin to do so ?

Thanks a lot !

4
  • I'm a bit confused, Are you asking for a web library (js = Java Script) or for a library to do so with Java? (or Applet? (Java and Web)) Commented May 11, 2014 at 10:36
  • 1
    Are you looking for a lookahead functionality? java2s.com/Code/Java/Swing-JFC/TextFieldLookAheadExample.htm Commented May 11, 2014 at 10:56
  • @quant : I am trying to implement the exact feature using Java Swing. No JS in here. Pure Java. I used the example for the sake of understanding. Commented May 11, 2014 at 12:39
  • @Hirak : not lookahead. I am trying to add multiple tag, if autocomplete is found, that will be bonus. Commented May 11, 2014 at 12:42

1 Answer 1

3

No, there is no such component. You should be able to make your own easy enough:

  1. Start with a JPanel using a FlowLayout and add a JTextField to the panel
  2. Then you can add an ActionListener to the text field. When ever Enter is pressed you create a "TagComponnent" and add the component to the start of the panel and remove the text from the text field.
  3. This "TagComponent" may just be a simple panel that contains a label (for the text) and a button (to remove) the component from the panel.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.