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


Groups > comp.lang.java.programmer > #18371

Re: How to center a JFrame when it comes up

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: How to center a JFrame when it comes up
Date 2012-08-28 16:57 -0700
Organization A noiseless patient Spider
Message-ID <k1jlss$qj5$1@dont-email.me> (permalink)
References <0704555b-cf8b-4319-9949-b39cb098991c@googlegroups.com>

Show all headers | View raw


On 8/28/2012 3:03 PM, clusardi2k@aol.com wrote:
> I would like to have a JFrame come up from anther one and center it
> on the screen. Hoe do I do this.
>
> Can I do it with two JFrames produced in NetBeans Design view.


This is an RTFM question, but the answer can be tricky to find, so:

<http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html>


"This example does not set the frame location, but it is easy to do so 
using either the setLocationRelativeTo or setLocation method. For 
example, the following code centers a frame onscreen:

   frame.setLocationRelativeTo(null);"


Read the docs!!

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to center a JFrame when it comes up clusardi2k@aol.com - 2012-08-28 15:03 -0700
  Re: How to center a JFrame when it comes up markspace <-@.> - 2012-08-28 16:57 -0700

csiph-web