I've got a problem with a Frame that is originally of small size, then
resized (by an ActionEvent or sth. similar) but it's components aren't
resized, i.e. they stay as small as they had to be when painted in the
then small frame.
The problem can be reduced to a the following code:
/** CODE STARTS HERE */
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class WindowResize extends JFrame {
private JPanel pane;
private static final Dimension minDim = new Dimension(200,150);
private static final Dimension maxDim = new Dimension(400,300);
private Dimension currDim = minDim;
public WindowResize() {
super("No Title");
Container cp = getContentPane();
cp.setLayout(null);
setSize(200,150);
pane = new JPanel();
pane.setBackground(Color.blue.darker());
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
cp.add(pane);
pane.setBounds(0,0,400,300);
pane.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) {
toggleSize();
}
});
setVisible(true);
}
public void toggleSize() {
if (currDim.equals(minDim)) {
currDim = maxDim;
} else {
currDim = minDim;
}
setSize(currDim);
}
public static void main(String[] args) {
WindowResize app = new WindowResize();
}
}
/** CODE ENDS HERE */
If you now resize the window by clicking into the panel, the panel
doesn't resize, i.e. stays "halfsized".
I'd be very glad if someone could help me there.
Thanks a lot
greetings,
Dennis
========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator-SanJose!in.nntp.be!newspeer.cwnet.com!sjc1.nntp.concentric.net!newsfeed.concentric.net!newsfeed.ozemail.com.au!ozemail.com.au!not-for-mail
Message-ID: <cancel.3C2A2...@gmx.net>
Control: cancel <3C2A2B29...@gmx.net>
Subject: cmsg cancel <3C2A2B29...@gmx.net>
From: Dennis Walter <dwm...@gmx.net>
Newsgroups: comp.lang.java.gui
X-No-Archive: yes
Lines: 2
NNTP-Posting-Host: wonenara.ozemail.com.au
X-Trace: ozemail.com.au 1009694677 203.108.164.177 (Sun, 30 Dec 2001 17:44:37 EST)
NNTP-Posting-Date: Sun, 30 Dec 2001 17:44:37 EST
Organization: OzEmail Ltd, Australia
Distribution: world
Date: Sun, 30 Dec 2001 02:51:13 GMT
This message was cancelled from within Mozilla.