Re: moveable sizeable text box
RichT wrote:
Knute Johnson wrote:
RichT wrote:
Hi,
Does anyone know how to create a text box that can be edited resized
and move about an image in a JComponent using the mouse?
The simplest thing I can think of is to put the text box in a Dialog.
Then you can resize the dialog and the text box will go along.
This sounds like a great idea, I set undecorated to true to remove the
title bar etc., and I am left with just an outline with the text area
filling the JDialog with a 5 border all around.
I have resizeable set to true, but I am unable to get a handle to resize
or move it, any ideas? I am using netbeans 6 by the way to design this.
A window without title bar probably cannot be resized.
Also I have a modal dialog and would like to be able to click the
screen and populate a text box with the coordinates.
Put a MouseListener on the component that you want to know the
coordinates of and then set those values in the text box when the
mouse is pressed or clicked or something.
Thanks :)
When the dialog is closed I would like the top left corner of the
textbox to be drawn where the coordinates were selected.
Don't use a layout manager on that component and then position it
manually.
I am not sure I understand this bit, after the dialog ok button is
pressed I wanted the text displayed in a moveable sizeable text box on
the JComponent which has the image drawn to it, then when save is
selected tat text will be drawn into the image and the text box will be
disposed of.
Cheers
Rich
OK so what you are really trying to do is to draw text on an image and
you need the GUI part to accomplish that, yes?
So you really will have a couple of problems to solve, first how to
position the text on the image and then how to get the text in the first
place. Your idea of using a moveable/resizable text box probably won't
work well as you want. Why not have the user select from a menu the
option to draw text on the image, then draw a line box on the image as
the placement area and make that box movable/resizable and pop up a
dialog to enter the text into. As text is entered into the dialog you
can draw it in the image box and you will be able to position it as
well. I know that this sounds pretty complicated but I don't think it
will really be that hard to do.
--
Knute Johnson
email s/nospam/linux/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access