Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Swing Problem

Reply
Thread Tools

Swing Problem

 
 
Eryk
Guest
Posts: n/a
 
      03-21-2007
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.

 
Reply With Quote
 
 
 
 
Phi
Guest
Posts: n/a
 
      03-21-2007
Eryk wrote:
> 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();
}
}
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      03-21-2007
On Mar 21, 4:00 pm, Phi <p...@gressly.ch> wrote:
> Eryk wrote:
> > When I create a new JFrame using the Swing library the window is
> > always the smallest it can possibly be.


Did you remember to put anything in it?

Andrew T.

 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      03-21-2007

"Eryk" <> wrote in message
news: oups.com...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing is dead! Long live Swing. Knute Johnson Java 32 02-29-2012 05:10 PM
Why not using javax.swing.event with swing? S.T Java 2 05-25-2007 12:10 AM
javax.swing.Popup, javax.swing.PopupFactory lizard Java 0 01-30-2006 09:34 PM
Swing Model Classes Updating Swing Components on a Thread Other Than AWT mkrause Java 0 05-06-2005 04:32 PM
Java 1.2 Swing vs. Java 1.5 Swing Big Daddy Java 2 04-16-2005 01:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57