-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
x86
-
linux
FULL PRODUCT VERSION :
>java -version
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
also on 1.5
>/usr/java/jdk1.5.0_03/bin/java -version
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Server VM (build 1.5.0_03-b07, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
>uname -a
Linux hutch 2.4.20-6-sleuth9-p4-smp #2 SMP Tue Apr 20 12:26:23 PDT 2004 i686 athlon i386 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
>fluxbox -version
Fluxbox 0.1.14 : (c) 2001-2002 Henrik Kinnunen
> X -version
XFree86 Version 4.3.0 (Red Hat Linux release: 4.3.0-2)
Release Date: 27 February 2003
X Protocol Version 11, Revision 0, Release 6.6
Build Operating System: Linux 2.4.20-3bigmem i686 [ELF]
Build Date: 27 February 2003
Build Host: porky.devel.redhat.com
Before reporting problems, check http://www.XFree86.Org/
to make sure that you have the latest version.
Module Loader present
OS Kernel: Linux version 2.4.20-6-sleuth9-p4-smp (jphillip@jib) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #2 SMP Tue Apr 20 12:26:23 PDT 2004
A DESCRIPTION OF THE PROBLEM :
Java 1.5 and 1.4.2 on Linux 2.4 with fluxbox as the window manager: windows are placed at the wrong location and windows move when pack() is called.
If the method setResizable(false) is used, the initial placement of the window is incorrect on the Y-axis. During a gui update when pack() is called the window moves up the y axis by 22 pixels.
If setResizable(false) is not used the initial window placement is still incorrect for the Y axis, but closer to the specified position. During a gui update the window behaves properly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the included source and run it.
A window will appear with a button. Clicking the button refreshes the display, the window will move when the button is clicked.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For the window to be placed in the correct initial position, and the window to remain in that position after calling pack().
ACTUAL -
The window was not in the correct initial position, and after calling pack the window moves up 22 pixels.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JButton;
public class BugDemo extends JFrame implements ActionListener
{
private JButton updateButton;
private int numUpdates;
public static void main(String[] args)
{
BugDemo app = new BugDemo();
}
public BugDemo()
{
initGUI();
}
private void initGUI()
{
setResizable(false);
setTitle("Test");
numUpdates = 0;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
updateButton = new JButton();
updateButton.setText("Update Display");
updateButton.addActionListener(this);
getContentPane().add(updateButton);
setLocation(new Point(300,50));
setVisible(true);
pack();
validate();
}
private void updateDisplay()
{
getContentPane().removeAll();
updateButton.setText(numUpdates+" Updates, Again?");
getContentPane().add(updateButton);
pack();
validate();
}
public void actionPerformed ( ActionEvent e )
{
if(e.getSource() == updateButton)
{
numUpdates++;
updateDisplay();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
A workaround is to not use setResizable(false), or to use setBounds(x,y,xw,yw) and not call pack().
###@###.### 2005-06-21 11:26:12 GMT
>java -version
java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)
also on 1.5
>/usr/java/jdk1.5.0_03/bin/java -version
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Server VM (build 1.5.0_03-b07, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
>uname -a
Linux hutch 2.4.20-6-sleuth9-p4-smp #2 SMP Tue Apr 20 12:26:23 PDT 2004 i686 athlon i386 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
>fluxbox -version
Fluxbox 0.1.14 : (c) 2001-2002 Henrik Kinnunen
> X -version
XFree86 Version 4.3.0 (Red Hat Linux release: 4.3.0-2)
Release Date: 27 February 2003
X Protocol Version 11, Revision 0, Release 6.6
Build Operating System: Linux 2.4.20-3bigmem i686 [ELF]
Build Date: 27 February 2003
Build Host: porky.devel.redhat.com
Before reporting problems, check http://www.XFree86.Org/
to make sure that you have the latest version.
Module Loader present
OS Kernel: Linux version 2.4.20-6-sleuth9-p4-smp (jphillip@jib) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #2 SMP Tue Apr 20 12:26:23 PDT 2004
A DESCRIPTION OF THE PROBLEM :
Java 1.5 and 1.4.2 on Linux 2.4 with fluxbox as the window manager: windows are placed at the wrong location and windows move when pack() is called.
If the method setResizable(false) is used, the initial placement of the window is incorrect on the Y-axis. During a gui update when pack() is called the window moves up the y axis by 22 pixels.
If setResizable(false) is not used the initial window placement is still incorrect for the Y axis, but closer to the specified position. During a gui update the window behaves properly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the included source and run it.
A window will appear with a button. Clicking the button refreshes the display, the window will move when the button is clicked.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For the window to be placed in the correct initial position, and the window to remain in that position after calling pack().
ACTUAL -
The window was not in the correct initial position, and after calling pack the window moves up 22 pixels.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JButton;
public class BugDemo extends JFrame implements ActionListener
{
private JButton updateButton;
private int numUpdates;
public static void main(String[] args)
{
BugDemo app = new BugDemo();
}
public BugDemo()
{
initGUI();
}
private void initGUI()
{
setResizable(false);
setTitle("Test");
numUpdates = 0;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
updateButton = new JButton();
updateButton.setText("Update Display");
updateButton.addActionListener(this);
getContentPane().add(updateButton);
setLocation(new Point(300,50));
setVisible(true);
pack();
validate();
}
private void updateDisplay()
{
getContentPane().removeAll();
updateButton.setText(numUpdates+" Updates, Again?");
getContentPane().add(updateButton);
pack();
validate();
}
public void actionPerformed ( ActionEvent e )
{
if(e.getSource() == updateButton)
{
numUpdates++;
updateDisplay();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
A workaround is to not use setResizable(false), or to use setBounds(x,y,xw,yw) and not call pack().
###@###.### 2005-06-21 11:26:12 GMT