-
Bug
-
Resolution: Fixed
-
P2
-
6u20
-
b06
-
sparc
-
solaris_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2195832 | 7 | Unassigned | P4 | Closed | Won't Fix | |
JDK-2204967 | 6u25 | Sean Coffey | P2 | Closed | Fixed | b01 |
JDK-2204278 | 6u24-rev | Sean Coffey | P2 | Resolved | Fixed | b22 |
Compile and execute the following testcase with MToolkit.
- Click on "Open Dialog" button
A new JDialog (500x500) will appear with a "New Button" inside
- Resize the JDialog to a smaller size
The "New Button" does not return to the default preferred size (500x500) of the JDialog.
This happens only with MToolkit. Works with XToolkit.
% cat Test.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test {
public static void main(String[] args) {
final Frame f = new Frame();
f.setLayout(new BorderLayout());
f.setBounds(0, 0, 500, 110);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent ev) {
System.exit(0);
}
});
JButton b = new JButton("Open Dialog");
f.add(b, BorderLayout.NORTH);
f.setVisible(true);
b.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialog jd = new JDialog( f );
JButton jb = new JButton("New Button");
jb.setPreferredSize( new Dimension (500,500) );
jb.setMinimumSize(jb.getPreferredSize());
jd.getContentPane().add( jb );
jd.validate();
jd.setVisible( true );
final Dimension prefSize = jd.getPreferredSize();
jd.addComponentListener( new ComponentAdapter() {
public void componentResized( ComponentEvent e ) {
Dimension redimSize = e.getComponent().getSize();
Dimension newSize = new Dimension( redimSize );
System.out.println( "Preferred Size: "+prefSize.width+" "+ prefSize.height +
" RedimSize: "+redimSize.width+" "+redimSize.height);
if ( redimSize.width < prefSize.width )
newSize.width = prefSize.width;
if ( redimSize.height < prefSize.height )
newSize.height = prefSize.height;
e.getComponent().setSize( newSize );
// a possible workaround : force component refresh with validate()
// e.getComponent().validate();
}
});
}
});
}
}
- Click on "Open Dialog" button
A new JDialog (500x500) will appear with a "New Button" inside
- Resize the JDialog to a smaller size
The "New Button" does not return to the default preferred size (500x500) of the JDialog.
This happens only with MToolkit. Works with XToolkit.
% cat Test.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test {
public static void main(String[] args) {
final Frame f = new Frame();
f.setLayout(new BorderLayout());
f.setBounds(0, 0, 500, 110);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent ev) {
System.exit(0);
}
});
JButton b = new JButton("Open Dialog");
f.add(b, BorderLayout.NORTH);
f.setVisible(true);
b.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialog jd = new JDialog( f );
JButton jb = new JButton("New Button");
jb.setPreferredSize( new Dimension (500,500) );
jb.setMinimumSize(jb.getPreferredSize());
jd.getContentPane().add( jb );
jd.validate();
jd.setVisible( true );
final Dimension prefSize = jd.getPreferredSize();
jd.addComponentListener( new ComponentAdapter() {
public void componentResized( ComponentEvent e ) {
Dimension redimSize = e.getComponent().getSize();
Dimension newSize = new Dimension( redimSize );
System.out.println( "Preferred Size: "+prefSize.width+" "+ prefSize.height +
" RedimSize: "+redimSize.width+" "+redimSize.height);
if ( redimSize.width < prefSize.width )
newSize.width = prefSize.width;
if ( redimSize.height < prefSize.height )
newSize.height = prefSize.height;
e.getComponent().setSize( newSize );
// a possible workaround : force component refresh with validate()
// e.getComponent().validate();
}
});
}
});
}
}
- backported by
-
JDK-2204278 MToolkit : resizing a component in componentResized() is not propagated to content
- Resolved
-
JDK-2204967 MToolkit : resizing a component in componentResized() is not propagated to content
- Closed
-
JDK-2195832 MToolkit : resizing a component in componentResized() is not propagated to content
- Closed
- relates to
-
JDK-5025858 Resizing a decorated frame triggers componentResized event twice.
- Resolved