Java Code Examples for javax.swing.plaf.basic.BasicButtonUI

The following examples show how to use javax.swing.plaf.basic.BasicButtonUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
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);
}
 
Example 2
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);
}
 
Example 3
Source Project: marathonv5   Source File: ButtonTabComponent.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 4
Source Project: SmartIM4IntelliJ   Source File: ClosableTabHost.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 5
Source Project: SmartIM   Source File: ClosableTabHost.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 6
Source Project: ramus   Source File: ButtonTabComponent.java    License: GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 7
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);
}
 
Example 8
Source Project: java-disassembler   Source File: TabbedPane.java    License: GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 9
Source Project: JavaSerialKiller   Source File: ButtonTabComponent.java    License: MIT License 6 votes vote down vote up
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);
}
 
Example 10
Source Project: cuba   Source File: ButtonTabComponent.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 11
Source Project: binnavi   Source File: ButtonTabComponent.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 12
Source Project: KEEL   Source File: ButtonTabComponent.java    License: GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 13
Source Project: javamelody   Source File: MButtonTabComponent.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 14
Source Project: JCEditor   Source File: ButtonTabComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 15
Source Project: tn5250j   Source File: ButtonTabComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 16
Source Project: tn5250j   Source File: ButtonTabComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 17
Source Project: LoboBrowser   Source File: PermissionCellButton.java    License: MIT License 6 votes vote down vote up
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();
}
 
Example 18
Source Project: xtunnel   Source File: ButtonTabComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 19
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);
}
 
Example 20
Source Project: bytecode-viewer   Source File: TabbedPane.java    License: GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 21
Source Project: pumpernickel   Source File: JSwitchButton.java    License: MIT License 5 votes vote down vote up
@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);
}
 
Example 22
Source Project: bigtable-sql   Source File: SmallTabButton.java    License: Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 23
Source Project: wpcleaner   Source File: CloseTabComponent.java    License: Apache License 2.0 5 votes vote down vote up
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);            
}
 
Example 24
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 5 votes vote down vote up
protected TabButton() {
  super();
  setUI(new BasicButtonUI());
  setToolTipText("close this tab");
  setContentAreaFilled(false);
  setFocusable(false);
  setBorder(BorderFactory.createEtchedBorder());
  setBorderPainted(false);
  setRolloverEnabled(true);
}
 
Example 25
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 5 votes vote down vote up
protected TabButton() {
  super();
  setUI(new BasicButtonUI());
  setToolTipText("close this tab");
  setContentAreaFilled(false);
  setFocusable(false);
  setBorder(BorderFactory.createEtchedBorder());
  setBorderPainted(false);
  setRolloverEnabled(true);
}
 
Example 26
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 5 votes vote down vote up
protected TabButton() {
  super();
  setUI(new BasicButtonUI());
  setToolTipText("close this tab");
  setContentAreaFilled(false);
  setFocusable(false);
  setBorder(BorderFactory.createEtchedBorder());
  setBorderPainted(false);
  setRolloverEnabled(true);
}
 
Example 27
Source Project: Pixelitor   Source File: CloseTabButton.java    License: GNU General Public License v3.0 5 votes vote down vote up
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));
}
 
Example 28
Source Project: consulo   Source File: BranchActionGroupPopup.java    License: Apache License 2.0 5 votes vote down vote up
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());
}
 
Example 29
protected TabButton createTabButton() {
  TabButton button = new TabButton();
  button.setUI(new BasicButtonUI());
  button.setBorder(tabButtonBorder);
  return button;
}
 
Example 30
@Override
public void setUI(ButtonUI ui) {
  // We use the BasicButtonUI so we can display a button without a
  // background.
  super.setUI(new BasicButtonUI());
}