Skip to main content

slow JXTaskPane animation

4 replies [Last post]
joe42
Offline
Joined: 2010-07-09
Points: 0

Hi,
Depending on the machine's CPU the collapsing/expanding of a JXTaskPane is really slow here.
collapsing/expanding the JXTaskPanes in the the following example needs up to 4 seconds on a dual core linux laptop 1.3 GHZ.
On a slower virtual windows up to 2 seconds. only on a dual 3 GHZ development machine it runs smooth.
Do i misuse the JXTaskPanes or is it a bug/performance problem in the JXTaskPane itself?
package de.test;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import org.jdesktop.swingx.JXFrame;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.JXTaskPane;
import org.jdesktop.swingx.JXTaskPaneContainer;

public class SwingApp {
public static void main(String[] args) throws Exception {

final String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian" };

final Object[][] data = { { "Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
{ "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, { "Sue", "Black", "Knitting", new Integer(2), new Boolean(false) },
{ "Jane", "White", "Speed reading", new Integer(20), new Boolean(true) }, { "Joe", "Brown", "Pool", new Integer(10), new Boolean(false) } };

initLookAndFeel();

final JXFrame frame = new JXFrame("Taskpane test", true);

JXTaskPaneContainer taskPaneContainer = new JXTaskPaneContainer();

JXTaskPane jobManagementTaskPane = new JXTaskPane();
jobManagementTaskPane.setTitle("A");
jobManagementTaskPane.add(new JScrollPane(new JXTable(data, columnNames)));
taskPaneContainer.add(jobManagementTaskPane);

JXTaskPane systemComponentsTaskPane = new JXTaskPane();
systemComponentsTaskPane.setTitle("B");
systemComponentsTaskPane.add(new JScrollPane(new JXTable(data, columnNames)));
taskPaneContainer.add(systemComponentsTaskPane);

JXTaskPane userManagementTaskPane = new JXTaskPane();
userManagementTaskPane.setTitle("C");
userManagementTaskPane.add(new JScrollPane(new JXTable(data, columnNames)));
taskPaneContainer.add(userManagementTaskPane);

frame.add(new JScrollPane(taskPaneContainer), BorderLayout.CENTER);

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
}

private static void initLookAndFeel() throws Exception {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
}
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

JXTaskPane uses a JXCollapsiblePane internally. Can you replace the JXTaskPaneContainer and JXTaskPanes and just use JXCollapsiblePane for the test? Is it any better for you, worse, or the same?
Karl

kleopatra
Offline
Joined: 2003-06-11
Points: 0

hmm ... looks and works fine for me. Unfortunately, no idea what might be wrong in your context. At the worst, you might consider to turn off animation.
CU
Jeanette

joe42
Offline
Joined: 2010-07-09
Points: 0

It seems to be a problem with the openjdk under ubuntu
After starting with -Dsun.java2d.pmoffscreen=false performance is ok.

kschaefe
Offline
Joined: 2006-06-08
Points: 0

Good that you've found a solution. I'll update the JavaDocs with this information.
Karl