JDK-4930166 : JInternalFrame does not redraw borders when its resizable property is changed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 2003-09-30
  • Updated: 2022-12-08
Related Reports
Duplicate :  
Description
Name: vsR10238			Date: 09/30/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0, JDK1.4.2, JDK1.4.1
JCK            : JCK1.5-runtime
Platform[s]    : all
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Falling test[s]:
         api/javax_swing/interactive/JInternalFrameTests.html#JInternalFrame [JInternalFrameTest0012]

Changing the "resizable" property of JInternalFrame does not cause its border to be redrawn.

When setIconifiable(true) is called, the "iconify" icon appears immediately, but when
setResizable(true) is called, the JInternalFrame border changes its appearence to "resizable"
only when it is repainted due to some other reason (i.e. after the size of the containing frame
or JInternalFrame is changed manually with mouse).

This behavior is a bit inconsistent and confusing.

The bug affects JCK1.5-runtime test api/javax_swing/interactive/JInternalFrameTests.html#JInternalFrame

Test source location:
=====================
/java/re/jck/1.5/promoted/beta/b04/binaries/JCK-runtime-15/tests/api/javax_swing/interactive/JInternalFrameTests.java


How to reproduce:
=================
1) Please, compile and run the following java code
2) Click on the checkbox. The "iconify" icon appears immediately but the JInternalFrame border
    changes its appearence to "resizable" only when it is repainted due to some other reason
    (i.e. after  the size of the containing frame or JInternalFrame is changed manually).

--- test start ---
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class JInternalFrameResizeBorderTest extends JFrame implements ItemListener {

     JCheckBox checkbox = new JCheckBox( "setResizable + setIconifiable" );
     JInternalFrame internalFrame = new JInternalFrame("JInternalFrame");

     public JInternalFrameResizeBorderTest() {
         super("JInternalFrame test");
         JDesktopPane desktopPane=new JDesktopPane();
         internalFrame.setBounds(20,20,150,100);
         internalFrame.setVisible(true);
         desktopPane.add(internalFrame);
         JPanel pane=new JPanel();
         setContentPane(pane);
         pane.setLayout(new BorderLayout());
         pane.add( desktopPane, BorderLayout.CENTER);
         checkbox.addItemListener(this);
         pane.add( checkbox, BorderLayout.SOUTH );
     }

     public void itemStateChanged(ItemEvent e)
     {
         internalFrame.setResizable(e.getStateChange()==ItemEvent.SELECTED);
         internalFrame.setIconifiable(e.getStateChange()==ItemEvent.SELECTED);
     }

     public static void main(String[] args) {
         JFrame frame = new JInternalFrameResizeBorderTest();
         frame.setSize(new Dimension(400,300));
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setVisible(true);
     }
}

--- test end ---


Specific machine info:
======================
Hostname: linux-16
OS: Windows XP Pro

======================================================================

Comments
EVALUATION This has been the case for some time. Looks like we need to catch the property change event and repaint the border. ###@###.### 2003-09-30
30-09-2003