javax.swing.plaf.basic.BasicButtonUI Java Examples

The following examples show how to use javax.swing.plaf.basic.BasicButtonUI. 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
Source File: ButtonTabComponent.java    From MeteoInfo with GNU Lesser 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 #2
Source File: TabbedPane.java    From bytecode-viewer with 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 #3
Source File: ButtonTabComponent.java    From wildfly-core with GNU Lesser General Public License v2.1 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 File: ButtonTabComponent.java    From xtunnel with 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 #5
Source File: PermissionCellButton.java    From LoboBrowser with 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 #6
Source File: ButtonTabComponent.java    From tn5250j with 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 #7
Source File: ButtonTabComponent.java    From tn5250j with 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 #8
Source File: ButtonTabComponent.java    From JCEditor with 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 #9
Source File: MButtonTabComponent.java    From javamelody with 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 #10
Source File: ButtonTabComponent.java    From KEEL with 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 #11
Source File: ButtonTabComponent.java    From binnavi with 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 File: ButtonTabComponent.java    From cuba with 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 #13
Source File: ButtonTabComponent.java    From JavaSerialKiller with 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 #14
Source File: ButtonTabComponent.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
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 #15
Source File: TabbedPane.java    From java-disassembler with 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 #16
Source File: ButtonTabComponent.java    From marathonv5 with 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 #17
Source File: ButtonTabComponent.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
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 #18
Source File: ButtonTabComponent.java    From ramus with 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 #19
Source File: ClosableTabHost.java    From SmartIM with 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 #20
Source File: ClosableTabHost.java    From SmartIM4IntelliJ with 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 #21
Source File: JSwitchButton.java    From pumpernickel with 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 File: BranchActionGroupPopup.java    From consulo with 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 #23
Source File: CloseTabButton.java    From Pixelitor with 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 #24
Source File: MainPanel.java    From java-swing-tips with 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 File: MainPanel.java    From java-swing-tips with 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 File: MainPanel.java    From java-swing-tips with 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 File: CloseTabComponent.java    From wpcleaner with 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 #28
Source File: SmallTabButton.java    From bigtable-sql with 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 #29
Source File: WindowsOutlookBarUI.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
protected TabButton createTabButton() {
  TabButton button = new TabButton();
  button.setUI(new BasicButtonUI());
  button.setBorder(tabButtonBorder);
  return button;
}
 
Example #30
Source File: WindowsOutlookBarUI.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
protected TabButton createTabButton() {
  TabButton button = new TabButton();
  button.setUI(new BasicButtonUI());
  button.setBorder(tabButtonBorder);
  return button;
}