pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Control of the startup window
Date Wed, 01 Dec 2010 22:44:48 GMT
Bill,

I'm sure Greg or someone else can give you a more complete answer, but here
is some info that should get you started.

Firstly, DesktopApplicationContext supports a number of command line
arguments that can be used to alter the host window upon startup.
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java

Search for X_ARGUMENT and you will see them all grouped together

The arguments take the format of
--argument_name=value
(Note the 2 hypens at the start)

I'm not sure if these are documented elsewhere, but they should be fairly
simple to understand if you look at the source code.



You can also get a reference to the host window with the following code
java.awt.Frame hostFrame =
(java.awt.Frame)display.getDisplayHost().getParent();

If your app implements org.apache.pivot.wtk.Application, it will be receive
a Display object in its startup() method.
Refer to http://pivot.apache.org/tutorials/hello-world.html for an example.


On 2 December 2010 05:00, Bill van Melle <bill.van.melle@gmail.com> wrote:

> I'm probably missing something obvious here, but since all the tutorials
> are web-based, there doesn't seem to be any relevant documentation...
>
> When I run as a desktop application, there seems to be a single (operating
> system) window that is effectively the desktop for Pivot.
>
> * Can I control its size?
>
* Can I learn its size?  When the user reshapes it, can I learn about that?
>
You can use the startup properties mentioned above to determine start up
size and position.

This code will dump the size of the host frame, and resize it.
java.awt.Frame hostFrame =
(java.awt.Frame)display.getDisplayHost().getParent();
System.out.println(String.format("%-40s %-40s", "size",
hostFrame.getSize()));
hostFrame.setSize(200, 200);
System.out.println(String.format("%-40s %-40s", "size",
hostFrame.getSize()));
hostFrame.setSize(100, 100);
System.out.println(String.format("%-40s %d %d", "xy", hostFrame.getX(),
hostFrame.getY()));

You can interact with the java.awt.Frame and add your own listeners
hostFrame.getWindowStateListeners();
hostFrame.getWindowListeners();
etc


> * Can I constrain my own org.apache.pivot.wtk.Window to be exactly the size
> of this window?  (By default, it seems to behave like it has infinite
> extent.)
>
http://pivot.apache.org/tutorials/hello-wtkx.html
See    maximized="true"


> * Can I escape this window, i.e., create a Pivot window/frame/dialog that
> is a new (operating system) window?
>
I'm not sure if this is currently possible.

https://issues.apache.org/jira/browse/PIVOT-418
Perhaps this JIRA ticket is relevant, but I don't know exactly what
functionality the change brings.
Greg should be able to fill you in.

Chris

Mime
View raw message