/** * Create a button for a tool bar * * @param title tooltip for the button * @return the button */ public static PushButton createButton(SwingScilabVariableBrowser variableBrowser, String title) { PushButton button = ScilabPushButton.createPushButton(); ((SwingScilabPushButton) button.getAsSimplePushButton()) .addActionListener(new DeleteAction(variableBrowser)); button.setToolTipText(title); ((SwingScilabPushButton) button.getAsSimplePushButton()).setIcon(icon); return button; }
/** @return the corresponding button */ public static PushButton createButton() { PushButton button = ScilabPushButton.createPushButton(); button.setCallback(new GoToSCIAction()); ((SwingScilabPushButton) button.getAsSimplePushButton()) .setToolTipText(UiDataMessages.SCIFOLDER); ((SwingScilabPushButton) button.getAsSimplePushButton()).setIcon(FileUtils.getSCIIcon()); return button; }
/** * Create a button for a tool bar * * @param editor the associated editor * @param title tooltip for the button * @return the button */ public static PushButton createButton(SwingScilabVariableEditor editor, String title) { PushButton button = ScilabPushButton.createPushButton(); ((SwingScilabPushButton) button.getAsSimplePushButton()) .addActionListener(new SetPrecisionShortAction(editor, title)); button.setToolTipText(title); ImageIcon imageIcon = new ImageIcon(ScilabSwingUtilities.findIcon("short")); ((SwingScilabPushButton) button.getAsSimplePushButton()).setIcon(imageIcon); return button; }
/** * Create a button * * @param callback the associated callback * @return the push button */ protected static PushButton createButton(CommonCallBack callback) { PushButton item = ScilabPushButton.createPushButton(); SwingScilabPushButton swingItem = (SwingScilabPushButton) item.getAsSimplePushButton(); swingItem.setAction(callback); // Not compatible with java 1.5 // Hide the name text // swingItem.setHideActionText(true); swingItem.setText(""); return item; }