Results 1 to 6 of 6
- 02-18-2013, 01:50 PM #1
Member
- Join Date
- Jan 2013
- Posts
- 28
- Rep Power
- 0
Color line in JTextArea after a mouse clik
Hello,
I want color and retrieve the contents of each row selected by the mouse in JTextArea.
the problem that I can not do it with a single clik but it works with double clik.
when I putJava Code:if (evt.getClickCount()== 2) { TextArea.setSelectionColor(Color.BLUE); String a = TextArea.getSelectedText(); System.out.println(a); }
The coloring does not work anymore and the result of display always nullJava Code:if (evt.getClickCount()== 1)
- 02-18-2013, 03:19 PM #2
Re: Color line in JTextArea after a mouse clik
If you want help, you should provide an SSCCE that demonstrates exactly what's going on.
Without the SSCCE I'm just guessing, but it would seem that a single click deselects any text, and a double click selects the word you clicked on. That seems like pretty normal behavior, so if you want something else to happen, you'll have to program it.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-18-2013, 03:59 PM #3
Member
- Join Date
- Jan 2013
- Posts
- 28
- Rep Power
- 0
Re: Color line in JTextArea after a mouse clik
thanks for your request but it's possible to select the word by one clik
- 02-18-2013, 04:14 PM #4
Re: Color line in JTextArea after a mouse clik
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-18-2013, 05:01 PM #5
Member
- Join Date
- Jan 2013
- Posts
- 28
- Rep Power
- 0
Re: Color line in JTextArea after a mouse clik
really i did'n understand what is the SSCCE
, i use netbeans to develop management application not website
- 02-18-2013, 05:14 PM #6
Re: Color line in JTextArea after a mouse clik
I linked to a site explaining what an SSCCE is. It's the standard way to post code when asking for help on a forum. Here it is again: Short, Self Contained, Correct Example
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Different text color in JTextArea
By bigvanilla in forum New To JavaReplies: 2Last Post: 01-29-2011, 02:21 PM -
Mouse Click changes Color of Rectangle
By DocIcarus in forum New To JavaReplies: 1Last Post: 11-23-2010, 01:53 PM -
change color on mouse click
By hannerz06 in forum New To JavaReplies: 3Last Post: 03-31-2010, 09:46 PM -
change object color on mouse click
By gotenks05 in forum Java AppletsReplies: 1Last Post: 04-05-2009, 07:14 PM -
How to know the exact word on which the mouse is, in a JTextArea
By JavaBean in forum AWT / SwingReplies: 1Last Post: 05-19-2007, 12:03 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks