CommandButtonDisplayState state,
CommandButtonKind commandButtonKind, int fontSize) {
ResizableIcon mainPasteIcon = SvgBatikResizableIcon.getSvgIcon(
TestCommandButtons.class.getClassLoader().getResource(
"test/svg/edit-paste.svg"), new Dimension(32, 32));
JCommandButton mainButton = new JCommandButton(text, mainPasteIcon);
mainButton.setDisabledIcon(new FilteredResizableIcon(mainPasteIcon,
new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY),
null)));
// mainButton.setMnemonic('P');
mainButton.setExtraText("Extra for " + text.toLowerCase());
mainButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Action invoked");
}
});
mainButton.setPopupCallback(new PopupPanelCallback() {
@Override
public JPopupPanel getPopupPanel(JCommandButton commandButton) {
return new SamplePopupMenu(commandButton
.getComponentOrientation());
}
});
mainButton.setCommandButtonKind(commandButtonKind);
mainButton.setDisplayState(state);
mainButton.setFlat(false);
mainButton.setFont(mainButton.getFont().deriveFont((float) fontSize));
return mainButton;
}