Java Code Examples for javax.swing.JTabbedPane#HORIZONTAL

The following examples show how to use javax.swing.JTabbedPane#HORIZONTAL . 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: AbstractTabDisplayer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void autoscroll( Point cursorLocn ) {
    Rectangle tabsArea = getTabsArea();
    if( !tabsArea.contains( cursorLocn ) ) {
        autoscroller.stop();
        return;
    }
    if( orientation == JTabbedPane.HORIZONTAL ) {
        if( cursorLocn.x < tabsArea.x+25 ) {
            autoscroller.start( true );
        } else if( cursorLocn.x > tabsArea.x+tabsArea.width-25 ) {
            autoscroller.start( false );
        } else {
            autoscroller.stop();
        }
    } else {
        if( cursorLocn.y < tabsArea.y+25 ) {
            autoscroller.start( true );
        } else if( cursorLocn.y > tabsArea.y+tabsArea.height-25 ) {
            autoscroller.start( false );
        } else {
            autoscroller.stop();
        }
    }
}
 
Example 2
Source File: AbstractTabDisplayer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Insets getAutoscrollInsets() {
    if( orientation == JTabbedPane.HORIZONTAL ) {
        return new Insets( 0, 25, 0, 25 );
    } else {
        return new Insets( 25, 0, 25, 0 );
    }
}
 
Example 3
Source File: TabTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public TabTable( TabDataModel tabModel, int tabsLocation ) {
    this( TabTableModel.create(tabModel, tabsLocation),
            tabsLocation == JTabbedPane.TOP || tabsLocation == JTabbedPane.BOTTOM ? JTabbedPane.HORIZONTAL : JTabbedPane.VERTICAL );
    this.tabsLocation = tabsLocation;
}
 
Example 4
Source File: TabTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public boolean getScrollableTracksViewportHeight() {
    return orientation == JTabbedPane.HORIZONTAL ? true : super.getScrollableTracksViewportHeight();
}
 
Example 5
Source File: TabTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public boolean getScrollableTracksViewportWidth() {
    return orientation == JTabbedPane.HORIZONTAL ? super.getScrollableTracksViewportHeight() : true;
}
 
Example 6
Source File: SingleRowTabTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private SingleRowTabTable( TabDataModel tabModel, ArrayList<Integer> tabIndexes ) {
    super( TabTableModel.create( tabModel, tabIndexes ), JTabbedPane.HORIZONTAL );
    this.tabIndexes = tabIndexes;
}
 
Example 7
Source File: AbstractTabDisplayer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public AbstractTabDisplayer( final TabDataModel tabModel, int tabsLocation ) {
    super( tabModel );
    setLayout( new BorderLayout( 3, 3 ) );
    this.orientation = tabsLocation == JTabbedPane.TOP || tabsLocation == JTabbedPane.BOTTOM ? JTabbedPane.HORIZONTAL : JTabbedPane.VERTICAL;
    scrollPane = new JScrollPane();
    controls = new ControlsToolbar();
    lblFullPath.setBorder( BorderFactory.createEmptyBorder( 0, 3, 2, 3) );
    Font defaultFont = lblFullPath.getFont();
    lblFullPath.setFont( defaultFont.deriveFont( defaultFont.getSize2D()-2 ) );
    JPanel controlsPanel = new JPanel( new BorderLayout() );
    controlsPanel.setOpaque( false );
    if( TabTableUI.IS_AQUA ) {
        Color backColor = UIManager.getColor( "NbSplitPane.background" ); //NOI18N
        if( null != backColor ) {
            setBackground( backColor );
            setOpaque( true );
        }
        Color white = Color.white;
        white = white.darker();
        lblFullPath.setForeground(white);
    }
    switch( tabsLocation ) {
        case JTabbedPane.TOP:
        case JTabbedPane.BOTTOM:
            add( scrollPane, BorderLayout.CENTER );
            controlsPanel.add( controls, BorderLayout.NORTH );
            add( controlsPanel, BorderLayout.EAST );
            if( Settings.getDefault().isShowFullPath() )
                add( lblFullPath, BorderLayout.SOUTH );
            break;
        case JTabbedPane.LEFT:
        case JTabbedPane.RIGHT:
            add( scrollPane, BorderLayout.CENTER );
            controlsPanel.add( controls, BorderLayout.EAST );
            add( controlsPanel, BorderLayout.NORTH );
            break;
        default:
            throw new IllegalArgumentException( "Invalid orientation: " + tabsLocation );
    }
    configureScrollPane( scrollPane );
    scrollLeft = new ScrollAction( scrollPane, tabsLocation, true );
    scrollRight = new ScrollAction( scrollPane, tabsLocation, false );
    controls.add( ButtonFactory.createScrollLeftButton( scrollLeft ) );
    controls.add( ButtonFactory.createScrollRightButton( scrollRight ) );
    addMouseWheelListener( this );

    projectsListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            repaint();
        }
    };

    fullPathListener = new ChangeListener() {
        @Override
        public void stateChanged( ChangeEvent e ) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    updateFullPath();
                }
            });
        }
    };
    tabModel.addChangeListener(fullPathListener);
}