File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Text boxes over an image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Text boxes over an image" Watch "Text boxes over an image" New topic
Author

Text boxes over an image

Kevin Corre
Greenhorn

Joined: Oct 26, 2011
Posts: 18
Hi guys, just wondering if it is possible to have an image and to use text boxes to label different areas of the picture? Where the items are labeled is where I would like to put the boxes so I could type in the answer myself for testing purposes. I have attached the jpg.

This is the code I have so far that loads the image.


[Thumbnail for shaft.jpg]

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2191
    
    7
use text boxes to label different areas of the picture?


I don't know what a "text box" is. Anyway I would use a JLabel since you want to display a label. You can add any component to a label. The basic code would be:



You will need to experiment with the location to position the label where you want it.
Kevin Corre
Greenhorn

Joined: Oct 26, 2011
Posts: 18
sorry maybe I didn't explain it right. I want to be able to type in the name of whatever the lines are pointing to in the picture. thought I was calling it by the right term when I said text box, just want a field where I can type in hub or shaft or hilt or whatever the term may be for the item. The names will not be above them so I can test myself on the different terms. With your example you are putting the label there as if it were in the picture, think of the picture as not having the names there and I want to type what they are in a field. Hope that is clearer.

Kevin
Kevin Corre
Greenhorn

Joined: Oct 26, 2011
Posts: 18
Ok got it figured out from you post this is what I was looking for, of course the names wont be left under the boxes. Thanks for the try anyways.

 
GeeCON Prague 2014
 
subject: Text boxes over an image