frame.setVisible(true);
}
/** creates a JXLabel and attaches a painter to it. */
private Component doInit() {
JXPanel panel = new JXPanel();
//JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
// create a label
final JXLabel label = new JXLabel();
label.setFont(new Font("Segoe UI", Font.BOLD, 14));
label.setText("task pane item 1 : a label");
label.setIcon(Images.NetworkDisconnected.getIcon(32, 32));
label.setHorizontalAlignment(JXLabel.LEFT);
label.setBackgroundPainter(getPainter());
// tweak with the UI defaults for the taskpane and taskpanecontainer
changeUIdefaults();
// create a taskpanecontainer
JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();
// create a taskpane, and set it's title and icon
JXTaskPane taskpane = new JXTaskPane();
taskpane.setTitle("My Tasks");
taskpane.setIcon(Images.Quit.getIcon(24, 24));
// add various actions and components to the taskpane
taskpane.add(label);
taskpane.add(new AbstractAction() {
{
putValue(Action.NAME, "task pane item 2 : an action");
putValue(Action.SHORT_DESCRIPTION, "perform an action");
putValue(Action.SMALL_ICON, Images.NetworkConnected.getIcon(32, 32));
}
public void actionPerformed(ActionEvent e) {
label.setText("an action performed");
}
});
// add the task pane to the taskpanecontainer
taskpanecontainer.add(taskpane);
// set the transparency of the JXPanel to 50% transparent
panel.setAlpha(0.7f);
panel.add(taskpanecontainer, BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(250, 200));
return panel;
}