Package javax.swing.plaf

Examples of javax.swing.plaf.TabbedPaneUI


    tabBackground.setBorder(null);
    tabBackground.setLayout(new SBoxLayout(SBoxLayout.VERTICAL));
    JTabbedPane tabs = new JTabbedPane(JTabbedPane.BOTTOM);
    // Adjust the Tab Width, if we can. The default is pretty if there's
    // space, but in the column there are no pixels to waste.
    TabbedPaneUI ui = tabs.getUI();
    if (ui instanceof StyledTabbedPaneUI) {
      ((StyledTabbedPaneUI) ui).setTabLabelMargins(1);
    }
    tabs.setFocusable(false);
    tabs.add("Friends", buddyPane);
View Full Code Here


            parent = parent.getParent();
        }
    }

    public static int getTabIndexAt(JTabbedPane tabbedPane, int x, int y) {
        TabbedPaneUI tabbedPaneUI = tabbedPane.getUI();
        for (int k = 0; k < tabbedPane.getTabCount(); k++) {
            java.awt.Rectangle rectangle = tabbedPaneUI.getTabBounds(tabbedPane, k);
            if (rectangle.contains(x, y))
                return k;
        }

        return -1;
View Full Code Here

    }

    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);
View Full Code Here

            String msg = Strings.get("tester.JTabbedPane.invalid_index",
                                     new Object[] { new Integer(index) });
            throw new LocationUnavailableException(msg);
        }
        Log.debug("converting index " + index);
        TabbedPaneUI ui = tabs.getUI();
        Rectangle rect = ui.getTabBounds(tabs, index);
        // TODO: figure out the effects of tab layout policy
        if (rect == null || rect.x < 0) {
            throw new TabNotVisibleException(index);
        }
        return new Point(rect.x + rect.width/2, rect.y + rect.height/2);
View Full Code Here

        return super.getPoint(tabs);
    }

    public Rectangle getBounds(Component c) {
        JTabbedPane tabs = (JTabbedPane)c;
        TabbedPaneUI ui = tabs.getUI();
        Point p = getPoint(tabs);
        int idx = ui.tabForCoordinate(tabs, p.x, p.y);
        return idx == -1 ? null : ui.getTabBounds(tabs, idx);
    }
View Full Code Here

    /** Return (in order of preference) the location corresponding to value,
     * cell, or coordinate.
     */
    public ComponentLocation getLocation(Component c, Point p) {
        JTabbedPane tabs = (JTabbedPane)c;
        TabbedPaneUI ui = tabs.getUI();
        int index = ui.tabForCoordinate(tabs, p.x, p.y);
        if (index != -1) {
            String name = tabs.getTitleAt(index);
            return new JTabbedPaneLocation(name);
        }
        return new JTabbedPaneLocation(p);
View Full Code Here

    public boolean accept(AWTEvent event) {
        if (isClick(event)) {
            MouseEvent me = (MouseEvent)event;
            JTabbedPane tp = tabbedPane = (JTabbedPane)me.getComponent();
            TabbedPaneUI ui = tp.getUI();
            int index = ui.tabForCoordinate(tp, me.getX(), me.getY());
            if (index != -1) {
                setStatus("Selecting tab '" + tp.getTitleAt(index));
                init(SE_CLICK);
                return true;
            }
            if (Platform.isOSX()) {
                int xmin = tp.getWidth();
                int xmax = 0;
                int ymin = tp.getHeight();
                int ymax = 0;
                for (int i=0;i < tp.getTabCount();i++) {
                    Rectangle rect = ui.getTabBounds(tp, i);
                    if (rect.x >= 0) {
                        xmin = Math.min(rect.x, xmin);
                        xmax = Math.max(rect.x + rect.width, xmax);
                        ymin = Math.min(rect.y, ymin);
                        ymax = Math.max(rect.y + rect.height, ymax);
View Full Code Here

    /** Parse clicks, notably those that select a tab. */
    protected Step createClick(Component target, int x, int y,
                               int mods, int count) {
        ComponentReference cr = getResolver().addComponent(target);
        JTabbedPane tp = (JTabbedPane)target;
        TabbedPaneUI ui = tp.getUI();
        int index = ui.tabForCoordinate(tp, x, y);
        if (index != -1) {
            // NOTE only tab selections are allowed for when clicking on tabs;
            // no multi-clicks or other buttons are saved, although nothing
            // prevents manual generation of such actions.
            return new Action(getResolver(),
View Full Code Here

  private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0);
  private static final Insets CONTENT_BORDER_INSETS = new Insets(5, 0, 0, 0);
 
  public static void customizeTabbedPaneUI(JTabbedPane tabbedPane) {
    TabbedPaneUI tabbedPaneUI = tabbedPane.getUI();
   
    if (tabbedPaneUI instanceof AquaTabbedPaneUI)
      tabbedPane.setUI(new CompactAquaTabbedPaneUI());
    else if (tabbedPaneUI instanceof AquaTabbedPaneContrastUI)
      tabbedPane.setUI(new CompactAquaTabbedPaneContrastUI());
View Full Code Here

    int tabcount = getTabCount();
    int x = e.getX();
    int y = e.getY();
    boolean useHand = false;
    for( int i = 0; i < tabcount; i++ ) {
      TabbedPaneUI tpu = getUI();
      Rectangle rect = tpu.getTabBounds( this, i );
      if ( x > rect.x  &&  x < rect.x + rect.width &&  y > rect.y  &&  y < rect.y + rect.height )
        useHand = true;
    }
    if ( useHand )
      setCursor( handCursor );
View Full Code Here

TOP

Related Classes of javax.swing.plaf.TabbedPaneUI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.