-
Bug
-
Resolution: Fixed
-
P4
-
1.4.2, 5.0
-
b10
-
x86
-
linux, windows_2003
-
Verified
FULL PRODUCT VERSION :
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 5.2.3790
A DESCRIPTION OF THE PROBLEM :
The default layout manager of JSpinner does not allow removing the arrow up button through its removeLayoutComponent method as it should, but it allows removing the arrow down button as well as the editor.
there is a bug in the source code of BasicSpinnerUI version 1.15 03/01/23 on line 704. It should read of course "nextButton = null;" instead of "c = null;"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
public class JSpinnerBug2
{
public static void main(String[] args)
{
// create a JSpinner and set a value
JSpinner spinner = new JSpinner();
spinner.setValue(new Integer(1234567890));
// get the arrow buttons
Component arrowUp = spinner.getComponent(0);
Component arrowDown = spinner.getComponent(1);
// try remove both buttons from the layout
LayoutManager layout = spinner.getLayout();
layout.removeLayoutComponent(arrowUp);
layout.removeLayoutComponent(arrowDown);
// create a frame and add the spinner spinner
JFrame frame = new JFrame("Only the arrow down is missing");
Container pane = frame.getContentPane();
pane.setLayout(new FlowLayout());
pane.add(spinner);
// show the frame
frame.setBounds(0, 0, 300, 150);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
remove the next button using addLayoutComponent("Next", null)
better, subclass BasicSpinnerUI and write your own layout manager
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 5.2.3790
A DESCRIPTION OF THE PROBLEM :
The default layout manager of JSpinner does not allow removing the arrow up button through its removeLayoutComponent method as it should, but it allows removing the arrow down button as well as the editor.
there is a bug in the source code of BasicSpinnerUI version 1.15 03/01/23 on line 704. It should read of course "nextButton = null;" instead of "c = null;"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
public class JSpinnerBug2
{
public static void main(String[] args)
{
// create a JSpinner and set a value
JSpinner spinner = new JSpinner();
spinner.setValue(new Integer(1234567890));
// get the arrow buttons
Component arrowUp = spinner.getComponent(0);
Component arrowDown = spinner.getComponent(1);
// try remove both buttons from the layout
LayoutManager layout = spinner.getLayout();
layout.removeLayoutComponent(arrowUp);
layout.removeLayoutComponent(arrowDown);
// create a frame and add the spinner spinner
JFrame frame = new JFrame("Only the arrow down is missing");
Container pane = frame.getContentPane();
pane.setLayout(new FlowLayout());
pane.add(spinner);
// show the frame
frame.setBounds(0, 0, 300, 150);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
remove the next button using addLayoutComponent("Next", null)
better, subclass BasicSpinnerUI and write your own layout manager
- duplicates
-
JDK-6342335 BasicSpinnerUI.SpinnerLayout implementation of removeLayoutComponent() incorrect
- Closed
- relates to
-
JDK-6532833 PIT: Metal LAF - The right side border is not shown for the Spinner after the removing the buttons
- Closed
-
JDK-6532837 PIT: On GTK LAF, the 'Up' button is not removed by LayoutManager.removeLayoutComponent()
- Closed