Mouse over - how to select text

Hi all,
I trying to build a function that when the mouse is moved over a text, then that text is selected and some actions are performed. At the moment I am using the g.drawstring() to place the text inside a jPanel, remember the XY coordinate of that text and then, when the mouseMoved event is trigger I compare the mouse position with the original drawing coordinate. It works fine if the string is single character, but it gets very complicated when the string is made up of several words "Hello Java" and I would like to select only the "Hello" or the "Java", as I don't know in advance the XY coordinate of the second word, as the font is not proportional (what I am doing now, is search for the " " and set boundaries of each individual word within the string...a bit cumbersome, but kind of works
My Question is:
is there a better way to place the string on the panel, other than the g.drawstring() that can make reading and identifying much easier? perhaps, placing the string inside some kind of other component which the mouse that 'identify' to be over more easily?
thanks for the help
P.S. I have read some posts, which address specific questions; mine is more a question on best architecture/availability of Java.components/API that can be used to do my task in the best way.

thanks for your reply.
I am basically trying to draw a node and edge pattern, where the nodes are the text strings and the edges are simple lines. posX and posY are the coordinate of where to strings are drawn. Now, what I would like to do is to move the mouse over and highlight (for exampl) the string but only single words, not the whole string (which could be, for exampl, "Hello Java"), so highilighting either Hello or Java, depending on where the mouse is. But I need to place the string (or the JLabel or JText) at specific posX, posY coordinates inside my JPanel.
protected void paintComponent(Graphics g) {
super.paintComponent(g);
/** SOME CODE*/
Font font = new Font("Arial Unicode MS", Font.PLAIN, 20);
g.setFont(font);
g.setColor(Color.black);
g.drawString(textString panelXSize/2-posX, panelYSize/2-posY);
g.drawLine(panelXSize/2, panelYSize/2,panelXSize/2-posX, panelYSize/2-posY);
}

Similar Messages

  • How to select text in javaFX?

    Hello, i don't know how to select text in javaFX to do a copy and paste (for example). Does anyone know?
    Thank you

    You cannot select text (unless doing lot of code yourself) except in TextBox.
    I shown how to do copy & paste in the thread [javafx.scene.text.Text -> how to make displayed text copyable ?|http://forums.sun.com/thread.jspa?threadID=5393948] (classical Java stuff).

  • MAGIC TRACKPAD how to select text?  There is no "mouse button" to hold down

    The magic trackpad doesn't seem to have a "button" that can be held down while dragging (in order to select text etc).
    I want to select text & then paste it into an input box (for example, Search).
    Apple needs to add virtual Function Keys to the top of the MT, allowing you to turn on scripted functions related to selecting, dragging, copying, pasting etc.

    Press down on the trackpad until it clicks.
    Nope, the magic trackpad doesn't do this. That's the problem.
    Huh, how odd. Mine does. Did Apple change the Magic Trackpad since I bought mine? Or maybe yours is defective?
    The press-down-till-click is also used in either the left or right bottom corner to activate a right-click. Chosen in the trackpad preferences. Though I've gotten used to the two-finger tap for that instead.
    Ted

  • How to select text from a webpage

    hi. i have firefox for my n900. i would like to know how to select some text from a webpage so i can copy and paste it. thanks for the help. i couldn't it anywhere.

    First tap where you want the selection to start. (It might help to zoom in as far as possible first. You can do this using the volume buttons in the newly-released Firefox 1.1rc1.) Then hold the Shift key while pressing the arrow keys on the N900 keyboard to select text.
    Note: We are aware that this is not a very user-friendly way to select text, and we hope to include a better design in a future version of mobile Firefox.

  • How to select text and pictures together in word processing mode?

    Hello,
    I have written about 20 chapters of a book in word processing mode. Each chapter has many pictures, carefully positioned within the text.
    Each chapter is a separate pages file.
    Now i want to put them together into one single document and have a big problem.
    When i press cmd+A to select everything in one document in order to copy and paste it into another document, i can either select the text OR the pictures, not both together.
    In Layout mode it is possible, but not in word processing mode.
    Does anybody know how to select both in word processing mode or how to transform a word processing document into a layout mode document?
    Or is there a way to put together a word processing document from a number of single documents?
    Thanks in advance
    funthomas

    I still use word processing for just about everything. The first two versions of Pages only had word processing. I think all of the complaints/requests about the "always-present" text layer led the developers to add page layout. I think they would have been better off adding another application (like AppleWorks' draw module compared to AppleWorks' word processing module.

  • Does anyone know how to select text in Appleworks, click on the font button and then be able to scroll thru all the font so that one can see the text change as you scroll down the list, at present  I have to do it one font style at a time and then repeat

    does anyone know how to view text in Appleworks, to be able to click on the font button and then be able to scroll thru all the font so that one can see it change as you scroll down the list, at present  I have to do it one font style at a time and then repeat? Thanks jl

    Welcome to the Apple forums
    Your question really belongs in the AppleWorks community/forum.
    You can turn on fonts in actual type in the AppleWorks preferences.

  • ITunes' Taskbar-playing mode doesn't show track details on mouse-over, how to fix this?

    In earlier versions of iTunes the taskbar playing-mode showed details of the current track (title, artist, album illustration) on mouse-over.
    The new version (10.6.1.7) lacks this function.
    Is this a change Apple made and will it come back? Or is it just a setting in the Preferences which I can't find?
    Thanks in advance!

    Its a bug there is nothing that you can do about that
    you have just to wait until they fix it
    I

  • How do you SELECT ALL on a page (used to CTRL L-CLICK in margin then mouse over selection)?

    In Pages 4x you could hold CTRL+LEFTMOUSE while in the margin area then select multiple things on that page you were looking by mousing over them (including selecting all).  Now you have to go one item at a time to delete? Is there a work-around?

    Ghazgkull wrote:
    . ctrl+clicking in iTunes selects all.
    No, it does not. You are still incorrect.
    ctrl + click does NOT select anything.
    It checks all boxes when you ctrl click on one box.
    If you want to select a bunch of consecutive songs...
    Select one then Shift click another, This will select all items from the first selection to the last selection.
    This is just plain nutty and is normally achieved on Windows 7 using ctrl+a,
    No it doesn't
    ctrl + a selects all.
    You are not selecting anything when you check all boxes. You are sinmply checking all boxes.

  • How to hide list mouse over effect?

    Hi,
    I am using list item render and I have my own items effect on mouse over, how can I disable the list mouse over effect without setting the mouseChildren to false.
    I hope you be able to help me with this one.

    for datagrid, i'm trying to figure out for the list
    http://stackoverflow.com/questions/2325080/disable-roll-over-color-for-list-or-datagrid-co mponents

  • Interactive PDF with mouse-overs was created in Illustrator, now pauses and flashes when opened in Acrobat

    I have created an interactive PDF using Illustrator that has mouse-overs. When i export the file and then open it in Acrobat there is odd pausing on teh image bewteen mousing over it and the text callout that shold then display. Did I export or save incorrectly?

    Thank you for both responses! I'm impressed with the fact that you're reading my post.
    I'm new to tech matters with Adobe/PDF/Nitro tho I've been using them for several years.
    The original file was created by an agency and given to independent contractor to use.  I don't know which program they used to create the form. And I don't know what XFA or LiveCycle Designer means  because I'm not technically sophisticated unfortunately.
    I used Nitro 6 to populate the data and have a number of forms already filled out, which I periodically open and modify and resubmit. But Nitro 6 is acting sick, despite reinstalling several times.  I'm attempting to see if it's worth transitioning to Adobe Acrobat, i.e., can I reopen the forms I've populated and continue to work with them.  I like some of the Adobe features for other purposes (e.g., OCR). 
    Any help in determining how to open the form while keeping the data?

  • Cannot use double tap and move with one finger to select text in Mountain Lion

    I've been using OS X in my Macbook Pro since Snow Leopard, and if I choose "tap with one finger to click", I can use double tap and move with one finger to select text if the cursor is between text.
    It works in Snow Leopard,and Lion However, in Mountain Lion, this doesn't work!! I have to click in the bottom right corner of my trackpad  in order to select the text.
    Can anyone get this fixed ?
    Thanks.

    Caolei,
    I don't know if you'll ever see this, but thank you! I hope this helps somebody else down the line, too.
    re. "I can use double tap and move with one finger to select text if the cursor is between text."
    I've been trying to figure out how to select text with tapping and without clicking.
    This did the trick.
    It's quite finicky to not select a space in between words.
    Zooming in does seem to help (two finger double tapping in a body of text may trigger a SmartZoom and zoom the current frame of text to fill the screen, if anybody doesn't know this.)
    ((There's a smartMagnifyWithEvent Cocoa NSEvent that's not universally supported across all applications for noob OS X developers like me.))
    I haven't been able to find the part about double tapping between text to begin a selection (which seems to work best when double tapping directly next to a letter) anywhere in the help system on or online. I probably just missed it, though.
    Clicking with the built-in trackpad on my MacBook Pro w/ Retina or Magic Mouse just takes too much pressure for an old-time touch typist like me.
    As an aside, I've been trying BetterTouchTool and MagicPrefs to enable one finger tap on the Magic Mouse. BetterTouchTool seems to trigger text selection unwantedly and randomly, though.
    The whole mystique of Mac / Apple being intuitive and user-friendly seems to be one of the greatest marketing coups / unbelievable con jobs of the last century.
    I'm actually somewhat qualified to express an opinion as a software engineer with a degree in Computer Science and programming and user interface design experience in Windows, UNIX, web, Android and other systems, and now OS X and iOS. I could go on and on and on but I won't other to say that I still find Macs buggy and hard to use. I'm now finding that my new iPhone 5 is just as big of a pain (i.e. big thumbs missing landscape keyboard in Contacts.) Of course, I like flexibility and options and custom workflows and more than one way to do things and simply being able to do things at all, so I'm also actually somewhat biased. Sorry for the rant...
    Cheers,
    Hal

  • In WebHelp, when I mouse over a link, the font size changes.

    Either after I generate to WebHelp or View in RoboHelp, when I mouse over a hyperlink text, the font changes from large to small text. My step is a 11pt font, my body text is 10pt. It appears the 11 pt. font switches to 10pt font when I mouse over it. Any way to fix this?
    Also noticed that when I have a note at 9 pt, and mouse over a link, the text changes to 10pt.
    So now it appears in most of my topics with links within a step or note. In a body, the text appears fine (or stays the same) when you mouse over a link.

    Not believing that either.
    You should be able to edit your CSS in a text editor. If you are not sure what to do, set up a simple project using your CSS. Any text will do and create a link.
    See the Contact page on my site and follow the instructions there.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Mouse over picture Zoom effect

    Hello all,
    I have a request and I have seen this before when pointer is over picture a zoom effect happens.
    Where do I find more info please.
    Regards,
    Bill

    Help: Mouse over effect for a TEXT ITEM with possible 250+ characters

  • Help: Mouse over like ajax effect

    Hi
    I am working on a form that come with multiple varchar(4000) fields. To fit to the screen, I attempt to make this fields rather small. I have heard that there are approaches that allow mouse over effect. So that when user place mouse over the field, the content will be pop-up.
    Any suggestions are greatly appreciated.
    Thanks.
    Jimmy

    Help: Mouse over effect for a TEXT ITEM with possible 250+ characters

  • Mouse over highlighting

    Hello
    i use layered menu in dvd studio. when i build the dvd, and played on computer, i have to click to the button to highlight, and click again to activate.
    why must i click to highlight the menu? i want to highlight to mouse over. how?

    Hi - welcome to the discussions. This is a fairly frequent question, and the answer is that this is the way layer based menus work. To get the rollover you have to use a standard overlay menu.

Maybe you are looking for

  • Adding a new field in the infocube

    Hi Friends, I have a small issue i need to add a field into the the infocube which already has data in it. I went through the concept of remodelling and through the posts in SDN and also a link which guided me through the entire process but still i h

  • Gap in between divs in firefox

    Hi there. I'm working on a website and I have tested in both IE 7, and Firefox v2. In IE it looks as intended, but in Firefox, there is a gap between the customer menu (with lime green background), and the Top Menu bit (above the lime green). The cus

  • Document 60000030482 cannot be reversed due to clearing reset

    Hello Freinds, Has anybody faced this error during FP09. Document 60000030482 cannot be reversed due to clearing reset There are some documents which are stuck in clarification list. Please can anyone help me to rectify this error. Regards, Charvi

  • HT4613 How do I turn off closed captioning?

    Closed captioning just turned on while I was watching a TV show on Apple TV. It's not on in settings. How do I turn it off??

  • Refine Edge Radius Tool Not working

    Hi Today my refine edge is not working, although it used to work. When I select with the quick selection tool and click refine edge, when I pick the radius to smooth it out ,it makes a strange thing Please Help I made a screenshot for the screen,Note