-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
x86
-
windows_nt
Name: skT45625 Date: 08/15/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-001, native threads, symcjit)
After adding some tabs to a TabbedPane, a call to getTabRunCount() returns the
same value as a previous call ( before adding), even if the added tabs must be
(and are) placed on multiple lines. The JDK1.2.2 docs states that
getTabRunCount() returns the number of rows/columns or 0 if there is no UI set.
The correct value is returned if getTabRunCount() is called some time
after the adding.
The following application demonstrates this:
import javax.swing.*;
import java.awt.event.*;
public class PaneTest implements WindowListener{
static JFrame frame;
static public void main( String args[]) {
frame= new JFrame("tst");
frame.setBounds( 100,100,300,300);
frame.addWindowListener( new PaneTest());
JTabbedPane pane= new JTabbedPane();
JButton b1= new JButton("button one");
JButton b2= new JButton("button two");
JButton b3= new JButton("button three");
pane.add( "one 1111111111111111", b1);
System.out.println("the UI is set (not null): "+ pane.getUI());
System.out.println("No. of rows: " +pane.getTabRunCount() +" <-
should be 1 row");
frame.getContentPane().add( pane);
frame.show();
System.out.println("No. of rows: "+ pane.getTabRunCount() +" <-
there is 1 row");
pane.add( "two 2222222222222222222222", b2);
pane.add( "three 3333333333333333333333", b3);
//***************************************************
// A possible workaround
//
// pane.validate();
//
//***************************************************
System.out.println("No. of rows: "+ pane.getTabRunCount() +" <-
should be 3 rows");
System.out.println("the UI is set (not null): "+ pane.getUI());
}
public void windowActivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
frame.dispose();
System.exit( 0);
}
public void windowDeactivated(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}import javax.swing.*;
import java.awt.event.*;
public class PaneTest implements WindowListener{
static JFrame frame;
static public void main( String args[]) {
frame= new JFrame("tst");
frame.setBounds( 100,100,300,300);
frame.addWindowListener( new PaneTest());
JTabbedPane pane= new JTabbedPane();
JButton b1= new JButton("button one");
JButton b2= new JButton("button two");
JButton b3= new JButton("button three");
pane.add( "one 1111111111111111", b1);
System.out.println("the UI is set (not null): "+ pane.getUI());
System.out.println("No. of rows: " +pane.getTabRunCount() +" <-
should be 1 row");
frame.getContentPane().add( pane);
frame.show();
System.out.println("No. of rows: "+ pane.getTabRunCount() +" <-
there is 1 row");
pane.add( "two 2222222222222222222222", b2);
pane.add( "three 3333333333333333333333", b3);
//***************************************************
// A possible workaround
//
// pane.validate();
//
//***************************************************
System.out.println("No. of rows: "+ pane.getTabRunCount() +" <-
should be 3 rows");
System.out.println("the UI is set (not null): "+ pane.getUI());
}
public void windowActivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
frame.dispose();
System.exit( 0);
}
public void windowIconified(WindowEvent e) {
}
public void windowOpened(WindowEvent e) {
}
}
(Review ID: 108450)
======================================================================