net.alantea.swing.action.ActionButton Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swingplus Show documentation
Show all versions of swingplus Show documentation
Addons over swing package.
The newest version!
package net.alantea.swing.action;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import net.alantea.swing.ribbon.RibbonGroup;
import net.alantea.swing.ribbon.RibbonTab;
import net.alantea.viewml.annotations.VAttribute;
import net.alantea.viewml.annotations.VElement;
/**
* The Class ActionButton.
*/
@VElement("actionButton")
@SuppressWarnings("serial")
public class ActionButton extends JButton
{
/**
* Instantiates a new action button.
*
* @param parent the parent
* @param target the target
* @param actionKey the action key
*/
public ActionButton(JPanel parent, Object target, String actionKey)
{
super();
setActionKey(actionKey, target);
if ((parent instanceof RibbonGroup) || (parent instanceof RibbonTab))
{
setBorderPainted(false);
setFocusPainted(false);
setContentAreaFilled(false);
setVerticalTextPosition ( SwingConstants.BOTTOM ) ;
setVerticalAlignment ( SwingConstants.CENTER ) ;
setHorizontalTextPosition ( SwingConstants.CENTER ) ;
setMargin(new Insets(1,1,1,1));
}
parent.add(this);
}
/**
* Instantiates a new action button.
*/
public ActionButton()
{
super();
}
@VAttribute("action")
public void setActionKey(String actionKey, Object target)
{
ActionManager.setAction(this, target, actionKey);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy