aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Move find and replace dialog to reveal matching word? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Move find and replace dialog to reveal matching word?" Watch "Move find and replace dialog to reveal matching word?" New topic
Author

Move find and replace dialog to reveal matching word?

Minh Nam
Ranch Hand

Joined: Sep 10, 2011
Posts: 57
Hi my friends,

I am writing a text editor which has a find and replace feature.
I am facing a problem, that is, sometimes the find and replace dialog hides the matching word. I would like to hear your suggestion about:
- how to determine if the dialog is hiding the matching word?
- how to determine a new location for dialog to let the user can see the matching word?

Thanks.


Advanced java topics
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4522
    
    5

JTextComponent#modelToView(int pos) in conjunction with other methods that you are probably already using can get you the Rectangle for the start and end of the word. The rest should be straightforward mathematics.

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates any remaining problem.

luck, db
There are no new questions, but there may be new answers.
Minh Nam
Ranch Hand

Joined: Sep 10, 2011
Posts: 57
Thanks, look likes I have to do some mathematics myself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Move find and replace dialog to reveal matching word?
 
Similar Threads
How to create a non hiding dialog box in swing
matching a string in a line
how to search for string in file
JTable rows focus highlighted
How to read and modify MS word using Java