下面列出了怎么用javax.swing.plaf.basic.BasicButtonUI的API类实例代码及写法,或者点击链接到github查看源代码。
private TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
// super(SmartIcons.close);
int size = 16;
setPreferredSize(new Dimension(size, size));
setToolTipText("close");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
setOpaque(false);
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEmptyBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
// addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
// super(SmartIcons.close);
int size = 16;
setPreferredSize(new Dimension(size, size));
setToolTipText("close");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
setOpaque(false);
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEmptyBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
// addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
TabButton ()
{
final int size = 13; // Button side length
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
final int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("Close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText(messages.getMainMessage("closeTabToolTip"));
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
addAncestorListener(ancestorListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
/**
* Creates a new tab button object.
*/
public TabButton() {
final int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("Close this tab.");
// Make the button look the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createBevelBorder(1)); // createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
/**
* Constructor.
*/
TabButton() {
super();
final int size = 17;
setPreferredSize(new Dimension(size, size));
// setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(BUTTON_MOUSE_LISTENER);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("Fechar aba");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText(LangTool.getString("popup.close"));
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
public PermissionCellButton(final PermissionSystem.PermissionBoard.PermissionRow.PermissionCell cell, final String text, final boolean alignRight, final ChangeListener changeListener) {
super(text);
this.cell = cell;
this.canBeUndecidable = cell.canBeUndecidable;
this.cellChangeListener = changeListener;
// final Border defaultBorder = getBorder();
final Insets marginInsets = getMargin();
final Insets borderInsets = grow(marginInsets, BORDER_PADDING);
final Border emptyBorder =
BorderFactory
.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right);
final Border defaultColorBorder = BorderFactory.createDashedBorder(GREY_TRANSPARENT);
final CompoundBorder plainBorder = BorderFactory.createCompoundBorder(defaultColorBorder, emptyBorder);
setBorder(plainBorder);
permissionResult = cell.getEffectivePermission();
assert (permissionResult.permission.isDecided());
setHorizontalAlignment(alignRight ? SwingConstants.RIGHT : SwingConstants.CENTER);
setUI(new BasicButtonUI());
addMouseMotionListener(this);
setFocusable(false);
setForeground(Color.BLACK);
updateBackground();
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("close this tab");
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
addActionListener(this);
}
public TabButton() {
final int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText("Close this tab");
// Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
// Make it transparent
setContentAreaFilled(false);
// No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
// Making nice rollover effect
// we use the same listener for all buttons
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
// Close the proper tab by clicking the button
addActionListener(this);
}
@Override
public void updateUI() {
if (UIManager.getDefaults().get(uiClassID) == null) {
UIManager.getDefaults().put(uiClassID,
"com.pump.plaf.button.SwitchButtonUI");
}
BasicButtonUI sui = (BasicButtonUI) UIManager.getUI(this);
super.setUI(sui);
}
public SmallTabButton(String toolTipText, ImageIcon icon, T userObject)
{
_icon = icon;
_userObject = userObject;
int size;
if (null == icon)
{
size = 17;
}
else
{
size = Math.max(_icon.getIconWidth(), _icon.getIconHeight()) + 5;
}
setPreferredSize(new Dimension(size, size));
setToolTipText(toolTipText);
//setIcon(icon);
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
//Making nice rollover effect
//we use the same listener for all buttons
addMouseListener(s_buttonMouseListener);
setRolloverEnabled(true);
//Close the proper tab by clicking the button
//addActionListener(this);
setOpaque(false);
}
public TabButton() {
int size = 17;
setPreferredSize(new Dimension(size, size));
setToolTipText(GT._T("Close this tab"));
setUI(new BasicButtonUI());
setContentAreaFilled(false);
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
addMouseListener(closeMouseListener);
setRolloverEnabled(true);
addActionListener(this);
}
protected TabButton() {
super();
setUI(new BasicButtonUI());
setToolTipText("close this tab");
setContentAreaFilled(false);
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
setRolloverEnabled(true);
}
protected TabButton() {
super();
setUI(new BasicButtonUI());
setToolTipText("close this tab");
setContentAreaFilled(false);
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
setRolloverEnabled(true);
}
protected TabButton() {
super();
setUI(new BasicButtonUI());
setToolTipText("close this tab");
setContentAreaFilled(false);
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
setRolloverEnabled(true);
}
CloseTabButton(TabViewContainer tab) {
setPreferredSize(new Dimension(SIZE, SIZE));
setToolTipText("Close this tab");
setUI(new BasicButtonUI());
setContentAreaFilled(false);
setFocusable(false);
setBorder(createEtchedBorder());
setBorderPainted(false);
addMouseListener(buttonMouseListener);
setRolloverEnabled(true);
addActionListener(e -> TabsUI.warnAndCloseTab(tab));
}
private MyToolbarButton(@Nullable String text, @Nullable Icon icon, @Nullable Icon rolloverIcon) {
setBorder(JBUI.Borders.empty(0, 2));
setBorderPainted(false);
setContentAreaFilled(false);
setOpaque(false);
setRolloverEnabled(true);
Icon regularIcon = chooseNotNull(icon, EmptyIcon.ICON_0);
setIcon(regularIcon);
setToolTipText(text);
setRolloverIcon(chooseNotNull(rolloverIcon, regularIcon));
update();
setUI(new BasicButtonUI());
}
protected TabButton createTabButton() {
TabButton button = new TabButton();
button.setUI(new BasicButtonUI());
button.setBorder(tabButtonBorder);
return button;
}
@Override
public void setUI(ButtonUI ui) {
// We use the BasicButtonUI so we can display a button without a
// background.
super.setUI(new BasicButtonUI());
}