Swing Problem

E

Eryk

When I create a new JFrame using the Swing library the window is
always the smallest it can possibly be. It even hides some of the
title if it deems it necessary. I've tried solutions like custom
setting the size using setSize, but it disregards my settings there.
I'm not really sure what to do to get the window to behave what I
would call normally. Any help is much appreciated, thank you.
 
P

Phi

Eryk said:
When I create a new JFrame using the Swing library the window is
always the smallest it can possibly be. It even hides some of the
title if it deems it necessary. I've tried solutions like custom
setting the size using setSize, but it disregards my settings there.
I'm not really sure what to do to get the window to behave what I
would call normally. Any help is much appreciated, thank you.

Hello Eryk

Try the following code. Even if it is not the best way to resize the
JFrame after the "setVisible()" command it would also work (I just
tested this on linux).

If the following code does not work as expected (draw a frame with
300x300 pixel size), I don't have a solution for your problem.
If the following code works, but your code still does not, please
provide your code to analyze.

greets

-------------------------------------------

import javax.swing.JFrame;

public class SizeFrame {
public SizeFrame() {
JFrame jf = new JFrame("My Frame Title");
jf.setSize(300, 300);
jf.setVisible(true);
}

public static void main(String[] args) {
new SizeFrame();
}
}
 
O

Oliver Wong

Eryk said:
When I create a new JFrame using the Swing library the window is
always the smallest it can possibly be. It even hides some of the
title if it deems it necessary. I've tried solutions like custom
setting the size using setSize, but it disregards my settings there.
I'm not really sure what to do to get the window to behave what I
would call normally. Any help is much appreciated, thank you.

Google for "LayoutManager", "setPreferredSize" and "setMinimumSize".

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top