Okay, one of the replies here gave me a clue: I had to move the code in question AFTER the "setSize()" for it to work. Now the sun is shining, the birds are singing again, &c.
...
Type: Posts; User: Blackbird
Okay, one of the replies here gave me a clue: I had to move the code in question AFTER the "setSize()" for it to work. Now the sun is shining, the birds are singing again, &c.
...
I guess I'm new enough that I don't understand the question, so I'll just provide the entire class:
It is in "go":
...
By "getX()" I meant getWidth() and getHeight().
The code snippet above won't compile; I get,
(and similar err msgs for getWidth() and setLocation().
I also tried this:
...
I found this on a similar thread:
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
int left = (d.width - this.getWidth()) / 2;
int top = (d.height - this.getHeight()) /...
My form is wedged against the NW corner of my screen; I want it in the middle. In fact, I will always want the main form (in every project) in the middle. How can I make that the default behavior?