Thanks Todd, That solution works. One diff is to pass a Dimension to setPreferredSize as it only would not take the (int, int).
I'll post it for history. from startup() WTKXSerializer wtkxSerializer = new WTKXSerializer(); window = (Window) wtkxSerializer.readObject(this, "PivotTestApp.wtkx"); Dimensions preferredSize = window.getPreferredSize(); ApplicationContext.DisplayHost displayHost = display.getDisplayHost(); Dimension dim = new Dimension(preferredSize.width, preferredSize.height); displayHost.setPreferredSize(dim); java.awt.Frame hostFrame = (java.awt.Frame) displayHost.getParent(); hostFrame.pack(); window.open(display); One thing I noticed is the frame still starts at it's default size (or args override) briefly before the pack. So I also used the args solution that Vicente provided earlier to start the frame at a closer size. Maybe knowing the pack size and applying it as args is the way I will go. This is in the main() args = new String[]{"--width=250", "--height=150", "--center=true"}; DesktopApplicationContext.main(PivotTestApp.class, args); Thanks again everyone for your help, Carl Todd Volkert wrote: > Well.... it's not documented and certainly not officially supported, > but if you peek under the covers, you can do something like the following: > > Dimensions preferredSize = mainAppWindow.getPreferredSize(); > ApplicationContext.DisplayHost displayHost = display.getDisplayHost(); > displayHost.setPreferredSize(preferredSize.width, preferredSize.height); > java.awt.Frame hostFrame = (java.awt.Frame)displayHost.getParent(); > hostFrame.pack(); > > I haven't tried this, so I'm not 100% sure it'll work, but you can > give it a shot :) > > -T > > On Fri, Oct 2, 2009 at 12:41 PM, Carl Marcum > <carl.mar...@codebuilders.net <mailto:carl.mar...@codebuilders.net>> > wrote: > > Is is possible to get a reference to the frame and pack it so you > don't need the exact size? > > For instance in a Swing Application Framework based app, I may do > this in the startup method: > > this.getApplication().getMainView().getFrame().pack(); > > Thanks, Carl > > > > Todd Volkert wrote: >> That'll work, but it'll always hard code the size and location of >> the host frame. Alternatively, you can pass those arguments to >> your application at the command line. >> >> On Fri, Oct 2, 2009 at 12:01 PM, Vicente de Rivera III >> <thirdy.deriv...@gmail.com <mailto:thirdy.deriv...@gmail.com>> wrote: >> >> Hi, >> >> I had that problem too before, here's my main method >> >> public static void main(String[] args) { >> if (args.length > 0) { >> noDb = true; >> } >> args = new String[]{"--width=800", "--height=650", >> "--center=true"}; >> Locale.setDefault(new Locale("en", "PH")); >> DesktopApplicationContext.main(Main.class, args); >> } >> >> if you look at the code in DesktopApplicationContext, I'm >> sure you see the arguments there >> >> - >> thirdy >> >> >