🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
6 messages
6 total messages Started by John T. Dow Thu, 18 Mar 2004 21:13
How to prevent MDI windows from being moved by user
#1148
Author: John T. Dow
Date: Thu, 18 Mar 2004 21:13
16 lines
1943 bytes
I've used internal frames to create an mdi application and have everything
working as I want it with one exception. I'd like to prevent users from
moving windows, as which windows are open at any point in time, and their
overlapping placement, is controlled by the business logic. So far I can
prevent the user from minimizing, closing, or resizing the windows (panels).
I haven't found how to prevent them from being moved.

I posted this question in a jbuilder forum and have had two suggestions for
workarounds. 1) Monitor mouse events and prevent moving. 2) Allow moving but
provide an easy way to restore positions.

Any other solutions, such as a setMovable(false) method?

Thanks

John
Re: How to prevent MDI windows from being moved by user
#1151
Author: John McGrath [TeamB]
Date: Fri, 19 Mar 2004 04:37
28 lines
2010 bytes
On 3/18/2004 at 4:13:39 PM, John T. Dow wrote:

> I've used internal frames to create an mdi application and have
> everything working as I want it with one exception. I'd like to
> prevent users from moving windows, as which windows are open at any
> point in time, and their overlapping placement, is controlled by the
> business logic. So far I can prevent the user from minimizing,
> closing, or resizing the windows (panels).  I haven't found how to
> prevent them from being moved.
> 
> I posted this question in a jbuilder forum and have had two
> suggestions for workarounds. 1) Monitor mouse events and prevent
> moving. 2) Allow moving but provide an easy way to restore positions.
> 
> Any other solutions, such as a setMovable(false) method?

It seems strange to me that you are using a JInternalFrame and then you
want to disable virtually all of the functionality that a
JInternalFrame provides.  So why use a JInternalFrame?

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: How to prevent MDI windows from being moved by user
#1152
Author: John T. Dow
Date: Fri, 19 Mar 2004 05:01
53 lines
3539 bytes
John

Good question. If there's a better way to do what I want to do, I'm all 
ears. Here's what I want to do....

I have an application I'm converting to java. It has 24 tables. I want 
to have each table displayed in a "window" on a desktop area (under the 
one and only menu). While there are 24 tables/windows, there will be
at most about 8 in use at once. These are opened and closed under the
control of the software as the user works with the system. Each window 
has a specific size and placement on the desktop area, predetermined by 
the customer and the developer.

The user begins with one table, and depending on what he's doing, a 
second, then third, etc open up when appropriate, and then eventually 
they close up again automatically.

The windows are designed, sized, and placed such that critical 
information on existing windows is not covered when a new window is opened.

I am not aware of any of the layout managers that provide multiple 
panels simultaneously visible in a cascaded-type arrangement. (Maybe 
staggered is a better word, as "cascade" probably has a specific 
meaning?) The card  layout only shows one at a time. The overlay layout 
is intended to show you all at once, using transparency.

John



John McGrath [TeamB] wrote:
> On 3/18/2004 at 4:13:39 PM, John T. Dow wrote:
> 
> 
>>I've used internal frames to create an mdi application and have
>>everything working as I want it with one exception. I'd like to
>>prevent users from moving windows, as which windows are open at any
>>point in time, and their overlapping placement, is controlled by the
>>business logic. So far I can prevent the user from minimizing,
>>closing, or resizing the windows (panels).  I haven't found how to
>>prevent them from being moved.
>>
>>I posted this question in a jbuilder forum and have had two
>>suggestions for workarounds. 1) Monitor mouse events and prevent
>>moving. 2) Allow moving but provide an easy way to restore positions.
>>
>>Any other solutions, such as a setMovable(false) method?
> 
> 
> It seems strange to me that you are using a JInternalFrame and then you
> want to disable virtually all of the functionality that a
> JInternalFrame provides.  So why use a JInternalFrame?
> 
Re: How to prevent MDI windows from being moved by user
#1153
Author: John McGrath [TeamB]
Date: Fri, 19 Mar 2004 06:15
25 lines
2248 bytes
On 3/19/2004 at 12:01:31 AM, John T. Dow wrote:

> I am not aware of any of the layout managers that provide multiple
> panels simultaneously visible in a cascaded-type arrangement. (Maybe
> staggered is a better word, as "cascade" probably has a specific
> meaning?) The card  layout only shows one at a time. The overlay
> layout is intended to show you all at once, using transparency.

Try the Borland XYLayout.  This does not really do very much - it just
sets the bounds of its child components to the values set by the
caller.  Normally the layout manager determines the bounds, so XYLayout
is really kind of a "slacker" of a layout manager.

What might makes more sense for your application is to write your own
layout manager.  Since you already have the code that determines where
the panels should go, this should be trivial.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: How to prevent MDI windows from being moved by user
#1154
Author: John T. Dow
Date: Fri, 19 Mar 2004 14:38
67 lines
3602 bytes
John

I haven't designed the various panels yet, but I plan to use the 
XYLayout for them because I need to fill them with lots of data fields 
and buttons etc.

I understand that the XYLayout would let me position panels as desired. 
But as far as I know, it doesn't let one panel overlap another, and 
there is no way to move a panel that's behind (or partially behind) 
another to the front. There is a move to front and move to back (or is 
it top and bottom?) but that's to be used during design, not during 
execution.

At this point I have internal frames working very nicely. For example, 
for a panel named "Address", I have the following bits of code.

To set the position and size of one of the frames:

IFAddress.setBounds(26, 23, 750, 635);

To open and make active an internal frame:

IFAddress.show();
try { IFAddress.setSelected(true); } 
catch(java.beans.PropertyVetoException ex) { }

To close it:

IFAddress.dispose();

To make it active (e.g. from a drop down "Windows" menu, or under 
program control):

try { IFAgent.setSelected(true); } 
catch(java.beans.PropertyVetoException ex) { }

Except for not being able to prevent the frames from being moved, this 
is doing everything I need. I can probably live without that if there's 
no simple solution. Plan B is to make it easy for the user to put 
everything back into its standard location. Perhaps the Windows menu 
could have "Reposition" at the top. From reading the documentation, 
reshape() looks like it would do this job.

John



John McGrath [TeamB] wrote:
> On 3/19/2004 at 12:01:31 AM, John T. Dow wrote:
> 
> 
>>I am not aware of any of the layout managers that provide multiple
>>panels simultaneously visible in a cascaded-type arrangement. (Maybe
>>staggered is a better word, as "cascade" probably has a specific
>>meaning?) The card  layout only shows one at a time. The overlay
>>layout is intended to show you all at once, using transparency.
> 
> 
> Try the Borland XYLayout.  This does not really do very much - it just
> sets the bounds of its child components to the values set by the
> caller.  Normally the layout manager determines the bounds, so XYLayout
> is really kind of a "slacker" of a layout manager.
> 
> What might makes more sense for your application is to write your own
> layout manager.  Since you already have the code that determines where
> the panels should go, this should be trivial.
> 
Re: How to prevent MDI windows from being moved by user
#1164
Author: John McGrath [TeamB]
Date: Fri, 19 Mar 2004 22:24
55 lines
3360 bytes
On 3/19/2004 at 9:38:30 AM, John T. Dow wrote:

> I haven't designed the various panels yet, but I plan to use the
> XYLayout for them because I need to fill them with lots of data
> fields and buttons etc.

Now I think I am confused.  I thought you were saying that your code
was going to determine the positions of the panels at runtime.  If that
is the case, then I think using XYLayout (or no layout) might make
sense.  But it is a *bad* idea to use XYLayout and to determine the
coordinates at design time.

Are you talking about something different here?  Before you were
talking about placing the panels and now you are talking about placing
the child components inside the panels?  Again, in that case,
determining the exact coordinates at design time is a *bad* idea.

> I understand that the XYLayout would let me position panels as
> desired. But as far as I know, it doesn't let one panel overlap
> another, and there is no way to move a panel that's behind (or
> partially behind) another to the front. 

XYLayout does allow the child components to overlap each other, but you
are correct that it does not provide any mechanism for controlling the
Z-order.  The Z-order is controlled by the container itself, not by the
layout manager.

> There is a move to front and move to back (or is it top and bottom?)
> but that's to be used during design, not during execution.

Right.  Those are features of JBuilder's UI Designer, not of Java or
any of the standard Java libraries.  They modify the code that the
Designer writes such that the components are added to their parent in a
different order.  You can do the same thing runtime using the Component
add() method.

> At this point I have internal frames working very nicely. For
> example, for a panel named "Address", I have the following bits
> of code.
> 
> To set the position and size of one of the frames:
> 
> IFAddress.setBounds(26, 23, 750, 635);

That is exactly the same as it would be without any layout manager at
all.  This would work with a plain JPanel inside another JPanel.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads