net.alantea.swing.action.ActionToggleButton 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.JPanel;
import javax.swing.JToggleButton;
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("actionToggleButton")
@SuppressWarnings("serial")
public class ActionToggleButton extends JToggleButton
{
/**
* Instantiates a new action button.
*
* @param parent the parent
* @param target the target
* @param actionKey the action key
*/
public ActionToggleButton(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 ActionToggleButton()
{
super();
}
@VAttribute("action")
public void setActionKey(String actionKey, Object target)
{
ActionManager.setAction(this, target, actionKey);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy