-
Bug
-
Resolution: Cannot Reproduce
-
P2
-
None
-
1.2.0
-
sparc
-
solaris_2.5
In "JDK-1.2beta2-V", when ui is set to JLF, clicking on Tabs causes ArrayIndexOutOfBoundsException.
To reproduce, please run the following Test :
1) %java TestShow
2) Press the button at the bottom to switch UIs between motif and jlf.
3) When the UI is jlf, move the mouse to the tab and click.
4) java.lang.ArrayIndexOutOfBoundsException is thrown.
import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import java.awt.swing.*;
public class TestShow extends JFrame implements ActionListener
{
JPanel onePanel, secondPanel;
JButton button;
JTextArea textArea;
String uiSet[] = {"java.awt.swing.jlf.JLFLookAndFeel",
"java.awt.swing.motif.MotifLookAndFeel"};
int ui_index = 0;
public TestShow() {
super("Test Suite");
this.getContentPane().setLayout(new BorderLayout());
JTabbedPane tabbedPane = new JTabbedPane();
// first tab
onePanel = new JPanel(new BorderLayout());
textArea = new JTextArea();
textArea.setBackground(Color.white);
button = new JButton("push to change ui factory");
button.addActionListener( this);
onePanel.add("Center", textArea);
onePanel.setBackground(Color.yellow);
tabbedPane.addTab("Single Tab", onePanel);
tabbedPane.setSelectedIndex(0);
// second tab
secondPanel = new JPanel(new BorderLayout() );
secondPanel.add("Center", new JButton("Smile"));
tabbedPane.addTab("Second Tab", secondPanel);
this.getContentPane().add("Center", tabbedPane);
this.getContentPane().add("South", button);
// window listener
WindowListener wl = new WindowAdapter(){
public void windowClosing(WindowEvent event){
System.exit(0);
}
};
addWindowListener(wl);
setSize(500,200);
setLocation(300, 300);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
try{
System.out.println("Choose ui factory : " + uiSet[ui_index % 2]);
UIManager.setLookAndFeel(uiSet[ ui_index % 2]);
SwingUtilities.updateComponentTreeUI(this);
ui_index++;
}catch(Exception exception){
exception.printStackTrace();
}
}
public static void main(String args[]){
TestShow frame = new TestShow();
}
}
// The end.
To reproduce, please run the following Test :
1) %java TestShow
2) Press the button at the bottom to switch UIs between motif and jlf.
3) When the UI is jlf, move the mouse to the tab and click.
4) java.lang.ArrayIndexOutOfBoundsException is thrown.
import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import java.awt.swing.*;
public class TestShow extends JFrame implements ActionListener
{
JPanel onePanel, secondPanel;
JButton button;
JTextArea textArea;
String uiSet[] = {"java.awt.swing.jlf.JLFLookAndFeel",
"java.awt.swing.motif.MotifLookAndFeel"};
int ui_index = 0;
public TestShow() {
super("Test Suite");
this.getContentPane().setLayout(new BorderLayout());
JTabbedPane tabbedPane = new JTabbedPane();
// first tab
onePanel = new JPanel(new BorderLayout());
textArea = new JTextArea();
textArea.setBackground(Color.white);
button = new JButton("push to change ui factory");
button.addActionListener( this);
onePanel.add("Center", textArea);
onePanel.setBackground(Color.yellow);
tabbedPane.addTab("Single Tab", onePanel);
tabbedPane.setSelectedIndex(0);
// second tab
secondPanel = new JPanel(new BorderLayout() );
secondPanel.add("Center", new JButton("Smile"));
tabbedPane.addTab("Second Tab", secondPanel);
this.getContentPane().add("Center", tabbedPane);
this.getContentPane().add("South", button);
// window listener
WindowListener wl = new WindowAdapter(){
public void windowClosing(WindowEvent event){
System.exit(0);
}
};
addWindowListener(wl);
setSize(500,200);
setLocation(300, 300);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
try{
System.out.println("Choose ui factory : " + uiSet[ui_index % 2]);
UIManager.setLookAndFeel(uiSet[ ui_index % 2]);
SwingUtilities.updateComponentTreeUI(this);
ui_index++;
}catch(Exception exception){
exception.printStackTrace();
}
}
public static void main(String args[]){
TestShow frame = new TestShow();
}
}
// The end.