LCBLayout causes ChartEditor to shift right on Mac OS X

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

LCBLayout causes ChartEditor to shift right on Mac OS X

Postby MitchBuell » Tue Jan 13, 2009 8:57 pm

I've found a strange bug when running JFreeChart on a Mac. In the ChartEditor when you click on a tab (other than the current tab) the entire ChartEditor JPanel inside the JOptionPane shifts to the right by about 10 pixels. If you click on enough different tabs, the GUI will slide off and disappear. However, it only shifts if a LCBLayout is used somewhere. If you remove all LCBLayouts then there is no problem.

I'm using a PowerBook G4 running the latest software available for it: OS X 10.5.6, Java 1.5.0_16.

Below is a simplified ChartEditor that demonstrates the issue. When run on my Mac, clicking between Tab1, Tab2, and Tab3 causes the panel to shift. Remove the single LCBLayout and no more shifting.
Code: Select all
class MyChartEditor extends JPanel implements ChartEditor
    public MyChartEditor(JFreeChart chart)
        setLayout(new BorderLayout());
        JTabbedPane tabs = new JTabbedPane();

        JPanel panel1 = new JPanel(new BorderLayout());

        // Bug with LCBLayout
        JPanel lcbPanel = new JPanel(new LCBLayout(1));
        lcbPanel.add(new JLabel("Panel 1"));
        lcbPanel.add(new JPanel());
        lcbPanel.add(new JPanel());

        tabs.addTab("Tab1", panel1);
        JPanel panel2 = new JPanel();
        panel2.add(new JLabel("Panel 2"));
        tabs.addTab("Tab2", panel2);
        JPanel panel3 = new JPanel();
        panel3.add(new JLabel("Panel 3"));
        tabs.addTab("Tab3", panel3);
        add(tabs, BorderLayout.NORTH);
Posts: 47
Joined: Thu Dec 11, 2008 7:59 pm

Postby david.gilbert » Wed Jan 14, 2009 12:32 pm

I think I recall hearing about this one before, but didn't have access to a Mac to try it out. I added this bug report at SourceForge: ... tid=115494

...and will investigate later (I do have access to a Mac now, but not with me right now).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
JFreeChart Project Leader
Posts: 11655
Joined: Fri Mar 14, 2003 10:29 am

Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot] and 8 guests