Java Code Examples for javax.swing.plaf.TabbedPaneUI

The following examples show how to use javax.swing.plaf.TabbedPaneUI. 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
Source Project: keystore-explorer   Source File: KseFrame.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void maybeShowKeyStoreTabPopup(MouseEvent evt) {
	if (evt.isPopupTrigger()) {
		int tabCount = jkstpKeyStores.getTabCount();
		TabbedPaneUI tpu = jkstpKeyStores.getUI();

		for (int i = 0; i < tabCount; i++) {
			Rectangle rect = tpu.getTabBounds(jkstpKeyStores, i);

			int x = evt.getX();
			int y = evt.getY();

			if (x < rect.x || x > rect.x + rect.width || y < rect.y || y > rect.y + rect.height) {
				continue;
			}

			jpmKeyStoreTab.show(evt.getComponent(), evt.getX(), evt.getY());
			break;
		}
	}
}
 
Example 2
private void handlePopup( final MouseEvent e ) {
  final JTabbedPane reportEditorPane = getReportEditorPane();
  final TabbedPaneUI ui = reportEditorPane.getUI();
  final int tabIndex = ui.tabForCoordinate( reportEditorPane, e.getX(), e.getY() );
  final JPopupMenu popupMenu = new JPopupMenu();

  final CloseReportAction closeThisAction = new CloseReportAction( tabIndex );
  closeThisAction.setReportDesignerContext( getContext() );
  final CloseChildReportsAction closeChildsAction = new CloseChildReportsAction( tabIndex );
  closeChildsAction.setReportDesignerContext( getContext() );
  final CloseOtherReportsAction closeOthersAction = new CloseOtherReportsAction( tabIndex );
  closeOthersAction.setReportDesignerContext( getContext() );
  final CloseAllReportsAction closeAllAction = new CloseAllReportsAction();
  closeAllAction.setReportDesignerContext( getContext() );
  final CloseUnmodifiedReportsAction closeUnmodifiedReportsAction = new CloseUnmodifiedReportsAction();
  closeUnmodifiedReportsAction.setReportDesignerContext( getContext() );

  popupMenu.add( new JMenuItem( closeThisAction ) );
  popupMenu.addSeparator();
  popupMenu.add( new JMenuItem( closeChildsAction ) );
  popupMenu.add( new JMenuItem( closeUnmodifiedReportsAction ) );
  popupMenu.add( new JMenuItem( closeOthersAction ) );
  popupMenu.add( new JMenuItem( closeAllAction ) );
  popupMenu.show( reportEditorPane, e.getX(), e.getY() );
}
 
Example 3
/**
 * Moves {@link JTabbedPane} scrollable tabs view according to scroll amount.
 *
 * @param tabbedPane   {@link JTabbedPane}
 * @param scrollAmount either positive or negative blocks scroll amount
 */
protected void scroll ( final T tabbedPane, final int scrollAmount )
{
    final TabbedPaneUI ui = tabbedPane.getUI ();
    if ( ui instanceof WTabbedPaneUI )
    {
        final TabContainer tabContainer = ( ( WTabbedPaneUI ) ui ).getTabContainer ();
        if ( tabContainer != null )
        {
            final boolean horizontal = tabbedPane.getTabPlacement () == JTabbedPane.TOP ||
                    tabbedPane.getTabPlacement () == JTabbedPane.BOTTOM;
            final Rectangle vr = tabContainer.getVisibleRect ();
            final Rectangle bounds = new Rectangle ( tabContainer.getSize () );
            if ( horizontal )
            {
                vr.x += scrollAmount * vr.width;
            }
            else
            {
                vr.y += scrollAmount * vr.height;
            }
            tabContainer.scrollRectToVisible ( bounds.intersection ( vr ) );
        }
    }
}
 
Example 4
Source Project: darklaf   Source File: TabbedPaneTransferHandler.java    License: MIT License 5 votes vote down vote up
private DarkTabbedPaneUI supportsIndicator(final Component c) {
    if (c instanceof JTabbedPane) {
        TabbedPaneUI ui = ((JTabbedPane) c).getUI();
        if (ui instanceof DarkTabbedPaneUI) {
            return ((DarkTabbedPaneUI) ui);
        }
    }
    return null;
}
 
Example 5
Source Project: jdk1.8-source-analysis   Source File: MultiTabbedPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 6
Source Project: jdk1.8-source-analysis   Source File: MultiTabbedPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 7
Source Project: jdk1.8-source-analysis   Source File: MultiTabbedPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 8
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 9
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 10
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 11
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 12
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 13
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 14
Source Project: jdk8u60   Source File: MultiTabbedPaneUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 15
Source Project: jdk8u60   Source File: MultiTabbedPaneUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 16
Source Project: jdk8u60   Source File: MultiTabbedPaneUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 17
Source Project: JDKSourceCode1.8   Source File: MultiTabbedPaneUI.java    License: MIT License 5 votes vote down vote up
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 18
Source Project: JDKSourceCode1.8   Source File: MultiTabbedPaneUI.java    License: MIT License 5 votes vote down vote up
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 19
Source Project: JDKSourceCode1.8   Source File: MultiTabbedPaneUI.java    License: MIT License 5 votes vote down vote up
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 20
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 21
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 22
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 23
Source Project: netbeans   Source File: MergeDialogComponent.java    License: Apache License 2.0 5 votes vote down vote up
/** Called when the seqeunce of mouse events should lead to actual
 *  showing of the popup menu. */
@Override
protected void showPopup(java.awt.event.MouseEvent mouseEvent) {
    TabbedPaneUI tabUI = mergeTabbedPane.getUI();
    int clickTab = tabUI.tabForCoordinate(mergeTabbedPane, mouseEvent.getX(), mouseEvent.getY());
    MergePanel panel = getSelectedMergePanel();
    if (panel == null) {
        return;
    }
    if (clickTab != -1) {
        //Click is on valid tab, not on empty area in tab
        showPopupMenu(createPopupMenu(panel), mouseEvent.getPoint(), mergeTabbedPane);
    }
}
 
Example 24
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 25
/**
 * Invokes the <code>getTabBounds</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Rectangle getTabBounds(JTabbedPane a, int b) {
    Rectangle returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b);
    }
    return returnValue;
}
 
Example 26
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 27
Source Project: Bytecoder   Source File: JTabbedPane.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the UI object which implements the L&amp;F for this component.
 *
 * @param ui the new UI object
 * @see UIDefaults#getUI
 */
@BeanProperty(hidden = true, visualUpdate = true, description
        = "The UI object that implements the tabbedpane's LookAndFeel")
public void setUI(TabbedPaneUI ui) {
    super.setUI(ui);
    // disabled icons are generated by LF so they should be unset here
    for (int i = 0; i < getTabCount(); i++) {
        Icon icon = pages.get(i).disabledIcon;
        if (icon instanceof UIResource) {
            setDisabledIconAt(i, null);
        }
    }
}
 
Example 28
Source Project: Bytecoder   Source File: JTabbedPane.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the tooltip text for the component determined by the
 * mouse event location.
 *
 * @param event  the <code>MouseEvent</code> that tells where the
 *          cursor is lingering
 * @return the <code>String</code> containing the tooltip text
 */
public String getToolTipText(MouseEvent event) {
    if (ui != null) {
        int index = ((TabbedPaneUI)ui).tabForCoordinate(this, event.getX(), event.getY());

        if (index != -1) {
            return pages.get(index).tip;
        }
    }
    return super.getToolTipText(event);
}
 
Example 29
Source Project: Bytecoder   Source File: JTabbedPane.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the <code>Accessible</code> child contained at
 * the local coordinate <code>Point</code>, if one exists.
 * Otherwise returns the currently selected tab.
 *
 * @return the <code>Accessible</code> at the specified
 *    location, if it exists
 */
public Accessible getAccessibleAt(Point p) {
    int tab = ((TabbedPaneUI) ui).tabForCoordinate(JTabbedPane.this,
                                                   p.x, p.y);
    if (tab == -1) {
        tab = getSelectedIndex();
    }
    return getAccessibleChild(tab);
}
 
Example 30
Source Project: Bytecoder   Source File: MultiTabbedPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}