Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18470 > unrolled thread

How to stop a jframe from being moved

Started byclusardi2k@aol.com
First post2012-08-31 07:06 -0700
Last post2012-08-31 08:01 -0700
Articles 5 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How to stop a jframe from being moved clusardi2k@aol.com - 2012-08-31 07:06 -0700
    Re: How to stop a jframe from being moved Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-31 10:47 -0400
      Re: How to stop a jframe from being moved Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-08-31 17:26 +0000
    Re: How to stop a jframe from being moved clusardi2k@aol.com - 2012-08-31 07:57 -0700
    Re: How to stop a jframe from being moved clusardi2k@aol.com - 2012-08-31 08:01 -0700

#18470 — How to stop a jframe from being moved

Fromclusardi2k@aol.com
Date2012-08-31 07:06 -0700
SubjectHow to stop a jframe from being moved
Message-ID<8bfe7cf1-4511-49f7-8637-e1241c945d67@googlegroups.com>
How can I prevent/stop a jframe from being moved on the monitor.

Thank you,

[toc] | [next] | [standalone]


#18471

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2012-08-31 10:47 -0400
Message-ID<k1qipu$vgc$1@dont-email.me>
In reply to#18470
On 8/31/2012 10:06 AM, clusardi2k@aol.com wrote:
> How can I prevent/stop a jframe from being moved on the monitor.

     What a horrible idea!

     There are lots of ways.  A few of the more sensible:

     - Turn off the monitor.

     - Uninstall the drivers for all user interaction devices.

     - Turn off the computer.

     - Electrocute the user.

     A few of the less sensible:

     - Use a javax.swing.Timer to forcibly reposition the JFrame
       every delta-T milliseconds, thus negating the user's attempt
       to move it.  (For extra credit, play a sound clip of a
       maniacal laugh.)

     - See if there's a way to listen for window movement events,
       and forcibly reposition when/if they occur.  Doesn't look
       like WindowListener will do this, but maybe you can hack
       up some weird combination of WindowFocusListener and
       MouseAdapter to get the notification you need, possibly
       using the JFrame's glass pane.

     - Maybe if you suppress the window decorations there won't
       be a "move window" handle.

     - Maybe using full-screen exclusive mode would help with some
       of the approaches mentioned above.

> Thank you,

     Two words you're unlikely to hear from your users.

     The single most important reason to have a windowing system in
the first place is to allow multiple applications to share display
space and input devices.  When you say "*My* application always
owns this chunk of screen real estate," you are also saying "*My*
application's need for that bit of screen is greater than that
of any other application, *even those I've never imagined.*"  The
ancient Greeks called this attitude "ὕβρις," and displaying ὕβρις
was an excellent way to get yourself punished by the dwellers
on Olympus ...

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


#18480

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2012-08-31 17:26 +0000
Message-ID<slrnk41stq.u9l.avl@gamma.logic.tuwien.ac.at>
In reply to#18471
Eric Sosman <esosman@ieee-dot-org.invalid> wrote:
> On 8/31/2012 10:06 AM, clusardi2k@aol.com wrote:
>> How can I prevent/stop a jframe from being moved on the monitor.
>      What a horrible idea!
>      There are lots of ways.  A few of the more sensible:
>      - Turn off the monitor.
>      - Uninstall the drivers for all user interaction devices.
>      - Turn off the computer.
>      - Electrocute the user.

How about the legal way?
 OP should add a subparagraph 12.4.2 to their software's EULA,
 that simply forbids the licencee("user") to move certain/all
 of the application's windows.

[toc] | [prev] | [next] | [standalone]


#18472

Fromclusardi2k@aol.com
Date2012-08-31 07:57 -0700
Message-ID<0e5f2077-e80a-4bfc-afed-a2c9dd1b9b1d@googlegroups.com>
In reply to#18470
Using the following event produces a jerky effect. Do you have something better!

    private void formComponentMoved(java.awt.event.ComponentEvent evt) 
    {
      
            this.setLocationRelativeTo(my_modal_frame_obj)
    }

Thanks,

[toc] | [prev] | [next] | [standalone]


#18473

Fromclusardi2k@aol.com
Date2012-08-31 08:01 -0700
Message-ID<0027e9f2-4fe9-4e37-b91a-04e10461efbc@googlegroups.com>
In reply to#18470
I also get the below exception trace when the project starts:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at Toy_Package.Toy_Obj.formComponentMoved(Toy_Obj.java:1859)
	at Toy_Package.Toy_Obj.access$000(Toy_Obj.java:25)
	at Toy_Package.Toy_Obj$2.componentMoved(Toy_Obj.java:770)
	at java.awt.AWTEventMulticaster.componentMoved(AWTEventMulticaster.java:169)

...

Thanks,

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web