Lock Dialog Size





7
Date Submitted Mon. Feb. 13th, 2006 3:40 PM
Revision 1 of 1
Coder mattrmiller
Tags Java | JDialog | JPanel | Resize | Size
Comments 0 comments
Locks a minimim size to a dialog or panel.


     lockMinSize(500400);

 


        // Locks minimum frame size
        protected void lockMinSize(int nWidth, int nHeight)
        {
                // Declare variables
                final int nX = nWidth;
                final int nY = nHeight;

                // Add listener
                this.addComponentListener(new ComponentAdapter()
                {
                        public void componentResized(ComponentEvent event)
                        {
                                setSize((getWidth() < nX) ? nX : getWidth(), (getHeight() < nY) ? nY : getHeight());
                        }
                });
        }

 

Matthew R. Miller

www.bluecreststudios.com
=================
Matthew R. Miller

http://bluecreststudios.com
http://www.codeandcoffee.com

Comments

There are currently no comments for this snippet.

Voting