iamsankar / seaglass

Automatically exported from code.google.com/p/seaglass
0 stars 0 forks source link

JTabbedPane inside JSplitPane crash after updated to 0.1.7.1 #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open the application

What is the expected output? What do you see instead?
This is a simple frame with JTabbedPane inside a JSplitPane
I expected to see my application running. (It works before with 0.1.6.x) 
However, it crashed.
Please see attached code and error logs.

What version of the product are you using? On what operating system? 
What JRE version?
Mac OS X 10.6.2 JRE 1.6

Please provide any additional information below.

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;

public class SeaglassBugDemo extends JFrame {

    public static void main(String[] args) {
        //set look and feel
        try {

UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel
"); 
            System.out.println(">> Set Seaglass look and feel");
//            
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookA
ndFeel");
//            System.out.println(">> Set Nimbus look and feel");
        } catch (Exception e) {
            System.err.println(">> Cannot set look and feel");
            e.printStackTrace();
        }

        SeaglassBugDemo demo = new SeaglassBugDemo();
        demo.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    public SeaglassBugDemo(){
        super("Seaglass");

        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        JTabbedPane tabPane2 = new JTabbedPane();
        tabPane2.add(new JPanel(),"test");
        splitPane.add(tabPane2);
        this.getContentPane().add(splitPane,BorderLayout.CENTER);

        this.setBounds(0,0,800,600);
        this.setResizable(true);
        this.setVisible(true);
    }

}

--------------------

*Logs*

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at 
com.seaglasslookandfeel.ui.SeaGlassTabbedPaneUI.getCloseButtonBounds(
SeaGlassTabbedPaneUI.java:1137)
    at 
com.seaglasslookandfeel.ui.SeaGlassTabbedPaneUI.calculateTabWidth(SeaG
lassTabbedPaneUI.java:1002)
    at 
com.seaglasslookandfeel.ui.SeaGlassTabbedPaneUI.calculateMaxTabWidth(
SeaGlassTabbedPaneUI.java:1030)
    at 
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize
(BasicTabbedPaneUI.java:2315)
    at 
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLay
outSize(BasicTabbedPaneUI.java:2262)
    at java.awt.Container.preferredSize(Container.java:1599)
    at java.awt.Container.getPreferredSize(Container.java:1584)
    at javax.swing.JComponent.getPreferredSize(JComponent.java:1624)
    at 
javax.swing.plaf.basic.BasicSplitPaneUI$BasicHorizontalLayoutManager.getP
referredSizeOfComponent(BasicSplitPaneUI.java:1613)
    at 
javax.swing.plaf.basic.BasicSplitPaneUI$BasicHorizontalLayoutManager.getP
referredSizes(BasicSplitPaneUI.java:1846)
    at 
javax.swing.plaf.basic.BasicSplitPaneUI$BasicHorizontalLayoutManager.rese
tToPreferredSizes(BasicSplitPaneUI.java:1883)
    at 
javax.swing.plaf.basic.BasicSplitPaneUI$BasicHorizontalLayoutManager.layo
utContainer(BasicSplitPaneUI.java:1312)
    at java.awt.Container.layout(Container.java:1421)
    at java.awt.Container.doLayout(Container.java:1410)
    at java.awt.Container.validateTree(Container.java:1507)
    at java.awt.Container.validateTree(Container.java:1513)
    at java.awt.Container.validateTree(Container.java:1513)
    at java.awt.Container.validateTree(Container.java:1513)
    at java.awt.Container.validateTree(Container.java:1513)
    at java.awt.Container.validate(Container.java:1480)
    at java.awt.Window.show(Window.java:860)
    at java.awt.Component.show(Component.java:1563)
    at java.awt.Component.setVisible(Component.java:1515)
    at java.awt.Window.setVisible(Window.java:841)
    at SeaglassBugDemo.<init>(SeaglassBugDemo.java:59)
    at SeaglassBugDemo.main(SeaglassBugDemo.java:28)

Original issue reported on code.google.com by Krist.Wo...@gmail.com on 28 Feb 2010 at 9:24

GoogleCodeExporter commented 9 years ago
Verified. I'll work on this straightaway.

Original comment by kahuxtable on 28 Feb 2010 at 9:30

GoogleCodeExporter commented 9 years ago
Thanks!

Original comment by Krist.Wo...@gmail.com on 28 Feb 2010 at 9:38

GoogleCodeExporter commented 9 years ago
It turns out that Laffy and my own demo code set preferred sizes on some of the 
components. That's why I didn't 
catch this in testing.

It shouldn't be happening though, and I'll get it fixed.

Original comment by kahuxtable on 1 Mar 2010 at 4:51

GoogleCodeExporter commented 9 years ago
Does the version available at

http://oss.sonatype.org/content/groups/staging/com/seaglasslookandfeel/seaglassl
ookandfeel/0.1.7.2-
SNAPSHOT/seaglasslookandfeel-0.1.7.2-20100301.203629-1.jar

fix the problem?

Original comment by kahuxtable on 1 Mar 2010 at 8:39

GoogleCodeExporter commented 9 years ago
I updated to the latest version in the repository and it does not crash now. 

Original comment by Krist.Wo...@gmail.com on 1 Mar 2010 at 8:51

GoogleCodeExporter commented 9 years ago
I mean r1332.

Original comment by Krist.Wo...@gmail.com on 1 Mar 2010 at 8:52

GoogleCodeExporter commented 9 years ago
Thanks for testing and finding that! I feel pretty stupid about letting it 
through.

Fixed in r1332.

Original comment by kahuxtable on 1 Mar 2010 at 9:01