Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Swing Problem

Thread view: 
Eryk - 21 Mar 2007 01:47 GMT
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.
Phi - 21 Mar 2007 06:00 GMT
> 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();
   }
}
Andrew Thompson - 21 Mar 2007 13:34 GMT
> > 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.
Oliver Wong - 21 Mar 2007 15:34 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.