Hello
I want to highlight a text in a text area that matches a pattern written in a text field
help me
i need it asap
I want to highlight a text in a text area that matches a pattern written in a text field
help me
i need it asap
import java.awt.*; import javax.swing.*; public class TextAreaDemo extends JFrame { JTextArea resultArea = new JTextArea(10, 50); public TextAreaDemo() { resultArea.setText("abcdefghijklmnopqrst"); resultArea.setSelectionStart(3); resultArea.setSelectionEnd(15); JScrollPane scrollingArea = new JScrollPane(resultArea); JPanel content = new JPanel(); content.setLayout(new BorderLayout()); content.add(scrollingArea, BorderLayout.CENTER); this.setContentPane(content); this.setTitle("TextAreaDemo"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); } public static void main(String[] args) { JFrame win = new TextAreaDemo(); win.setVisible(true); } }
import java.awt.*; import javax.swing.*; public class TextAreaDemo extends JFrame { JTextArea resultArea = new JTextArea(10, 50); public TextAreaDemo() { resultArea.setText("abcdefghijklmnopqrst"); resultArea.setSelectionStart(3); resultArea.setSelectionEnd(15); JScrollPane scrollingArea = new JScrollPane(resultArea); JPanel content = new JPanel(); content.setLayout(new BorderLayout()); content.add(scrollingArea, BorderLayout.CENTER); this.setContentPane(content); this.setTitle("TextAreaDemo"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); } public static void main(String[] args) { JFrame win = new TextAreaDemo(); win.setVisible(true); } }
Comment