Good timing.  I just wrote this code to do what I think you're talking
about.  It allows the frame to be dragged to a small size but immediately
repaints it to the minimum.  I would have preferred that the frame drag stop
at the minimum sizes but oh well..._frame is a JFrame

        _frame.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent e) {
                Dimension request = _frame.getSize();
                Dimension result = new Dimension();
                result.width = Math.max(request.width, FRAME_MIN_WIDTH);
                result.height = Math.max(request.height, FRAME_MIN_HEIGHT);
                if (result.width != request.width ||
                    result.height != request.height) {
                    _frame.setSize(result);
                }
            }
        });

--------------------------------
Rand Clark
Software Design Engineer
Transoft Networks
a Hewlett-Packard company
805.883.4315
[EMAIL PROTECTED]
--------------------------------


>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, October 23, 2001 11:09 AM
>To: [EMAIL PROTECTED]
>Subject: How to make a window unshrinkable?
>
>
>
>Is it possible to make an application window "unshrinkable" beyond a
>certain minimum size?  The idea is to allow only those resizings that
>result in an application window whose width and height are
>respectively greater or equal than some pre-set values.
>
>Thanks,
>
>KJ
>
>_______________________________________________
>Swing mailing list
>[EMAIL PROTECTED]
>http://eos.dk/mailman/listinfo/swing
>
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to