For Programmers: Free Programming Magazines  


Home > Archive > Java Help > July 2006 > Resizable border?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Resizable border?
fiziwig

2006-07-21, 7:02 pm

In Windows I can put a resizable border around any rectangle on the
screen that lets the user drag the corners or edges to resize the
rectangle. Is there anything like that in Java that will let me allow
the user to resize, for example, a JTextArea by dragging the corners
or edges? I can't find anything in the docs, but that doesn't mean it
doesn't exist. I started with Border Factory, but I'm not sure where
else to look.

Any help would be appreciated.

--gary

Andrey Kuznetsov

2006-07-21, 7:02 pm

> In Windows I can put a resizable border around any rectangle on the
> screen that lets the user drag the corners or edges to resize the
> rectangle. Is there anything like that in Java that will let me allow
> the user to resize, for example, a JTextArea by dragging the corners
> or edges? I can't find anything in the docs, but that doesn't mean it
> doesn't exist. I started with Border Factory, but I'm not sure where
> else to look.


there are no such thing as resizeable border,
you can however write mouse handler which will do resizing for you,
or you can use one from JGui (http://jgui.imagero.com)

Andrey

--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities


Ian Wilson

2006-07-24, 8:00 am

Andrey seems to have addressed your question but I have a followup question:

fiziwig wrote:
> In Windows I can put a resizable border around any rectangle on the
> screen that lets the user drag the corners or edges to resize the
> rectangle.


I'm curious, If you resize a rectangle what happens to the containing
window? does it grow to accomodate the bigger rectangle or does the
rectangle overlap other components in the same window?

> Is there anything like that in Java that will let me allow
> the user to resize, for example, a JTextArea by dragging the corners
> or edges? I can't find anything in the docs, but that doesn't mean it
> doesn't exist. I started with Border Factory, but I'm not sure where
> else to look.


Why do you want do do that? My first thought is to place the JTextArea
in a JFrame (or JInternalFrame) and let the user resize the frame.
Suitable use of a layout manager would mean the JTextArea can be made to
grow or shrink to fill the space available as the frame is resized.

Presumably there is some circumstances where what you suggest is a
sensible plan of action, I'd love to know what those circumstances are.
fiziwig

2006-07-24, 7:01 pm


Ian Wilson wrote:
> Andrey seems to have addressed your question but I have a followup question:
>
> fiziwig wrote:
>
> I'm curious, If you resize a rectangle what happens to the containing
> window? does it grow to accomodate the bigger rectangle or does the
> rectangle overlap other components in the same window?


The resizable regions are contained in a JLayeredPane which is a
WYSIWYG page editor being written to a client's specifications.
Regions, which are transparent, may, and often do, overlap.

>
> Why do you want do do that? My first thought is to place the JTextArea
> in a JFrame (or JInternalFrame) and let the user resize the frame.
> Suitable use of a layout manager would mean the JTextArea can be made to
> grow or shrink to fill the space available as the frame is resized.


The single parent window may contains as many as 30 or 40 seperate
content regions, each of which might contain an image, or some text. A
headline region might be in 72 point Times New Roman and the text
region beneath it might be in 12 point Arial or an image that the text
regions need to flow around. When a text area is not in edit mode it is
actually a JLabel and can be dragged around or resized, but when the
"edit" toolbar button is clicked the currently selected text region
becomes a JTextArea so that the text can be edited. Replacing the
JLabel with the JTextArea with the same content is invisible to the
user, except that the region is now editable. When the JTextArea is
de-selected it is seemlessly replaced by a JLabel with the newly edited
content. All this functionality is encapsulated in a ContentRegion
class that keeps track of all the details of how each region is
currently represented on the screen. The whole page layout is saved and
loaded as an XML file to the client's specs.

--gary

> Presumably there is some circumstances where what you suggest is a
> sensible plan of action, I'd love to know what those circumstances are.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com