Reputation: 100
I'm currently implementing a simple text editor for personal purposes, something like quick notes. I will use it as my task planer. For this I need some specifical tags to be implemented. For example, lets say, I have 2 tasks for today and they look like this:
{Uni, 29.12.2015} do some homework {Uni, 29.12.2015} °
{Home, 29.12.2015} do some stuff here {Home, 29.12.2015} °
What I need now is, when clicking on the circle, the tags will dissapear and it will look like this:
do some homework °
do some stuff here °
By clicking on the circle again, the tags would appear again.
My question is, is it actually possible to implement this using java? I know how to show/hide text, but I don't know how to implement this "circle button functionality". I'm currently using swing library for main functionalities of my editor, but I'm not sure if I can make it work using this library. Is there some library that allows this? Unfortunately, google didn't bring me further. I would appreciate any help.
Upvotes: 0
Views: 167
Reputation: 324157
What I need now is, when clicking on the circle,
Swing text components support a viewToModel(...)
method.
So you could add a MouseListener to the text area and get the character represented where the mouse was clicked. It the character is your special circle then you toggle the text.
Upvotes: 2