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 2006

Tip: Looking for answers? Try searching our database.

minimum size for a jframe

Thread view: 
Brandon McCombs - 27 Mar 2006 02:37 GMT
I want to set a minimum size for a jframe but still allow it to be
resized. I found out that using setMinimumSize() does nothing because I
can still resize the window below the size I specify in that method.  I
found where someone said to add a component listener and posted code to
do that on the forum's website.  I tried that but the current width and
height of the window never change so it isn't doing anything.

LDAPFrame.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
    int width = getWidth();
    int height = getHeight();
   
    boolean resize = false;
    System.out.println( width + " " + height);
    if (width < MIN_WIDTH) {
      resize = true;
      width = MIN_WIDTH;
    }
    if (height < MIN_HEIGHT) {
        resize = true;
        height = MIN_HEIGHT;
    }
    if (resize)
        setSize(new Dimension(width, height));
    System.out.println( width + " " + height + getSize());
    }
      }
);

The first print out gives the initial size that I set the frame to but
so does the 2nd printout despite resizing the frame to even cause it to
print anything.  And since the values are the same as the initial ones
they never go below the size of the initial size and therefore even when
I resize to the size where all the widgets are on top of each other the
frame isn't resized to the minimum.

any ideas?
Alex Hunsley - 28 Mar 2006 09:37 GMT
> I want to set a minimum size for a jframe but still allow it to be
> resized. I found out that using setMinimumSize() does nothing because I
> can still resize the window below the size I specify in that method.

Post a compilable self-contained example if you can!
Alex Hunsley - 28 Mar 2006 09:44 GMT
> I want to set a minimum size for a jframe but still allow it to be
> resized. I found out that using setMinimumSize() does nothing because I
> can still resize the window below the size I specify in that method.  I

Post a self-contained compilable example...
Otherwise we have problem  such as having no idea what type your
LDAPFrame is.


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



©2008 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.