Khalid Haddouti
Khalid Haddouti

Reputation: 3

Select Text From multiple JEditorPane

In the same JPanel , i have two JEditorPane, how i can select text from the two JEditorPane at the same time

JPanel panel=new JPanel(new BorderLayout());
JEditorPane jeditorpane1=new JEditorPane();
// Set content of jeditorpane1
JEditorPane jeditorpane2=new JEditorPane();
// Set content of jeditorpane2
panel.add(jeditorpane1,BorderLayout.WEST);
panel.add(jeditorpane2,BorderLayout.EAST);

I use mouse to select text from jeditorpane !

Upvotes: 0

Views: 122

Answers (1)

StanislavL
StanislavL

Reputation: 57421

jeditorpane1.selectAll();
jeditorpane2.selectAll();

But when JEditorPane is not focused selection is invisible

to make it visible use

((DefaultCaret)jeditorpane1.getCaret()).setSelectionVisible(true);

Upvotes: 1

Related Questions