Java Code Examples for javax.swing.JTabbedPane#RIGHT

The following examples show how to use javax.swing.JTabbedPane#RIGHT . 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: TabsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected boolean store() {
    prefs.putBoolean(WinSysPrefs.EDITOR_CLOSE_ACTIVATES_RECENT, isCloseActivatesMostRecentDocument.isSelected());
    prefs.putBoolean(WinSysPrefs.OPEN_DOCUMENTS_NEXT_TO_ACTIVE_TAB, isNewDocumentOpensNextToActiveTab.isSelected());
    prefs.put(WinSysPrefs.EDITOR_SORT_TABS, getSelectedSortType().name());

    boolean needsWinsysRefresh = false;
    needsWinsysRefresh = checkMultiRow.isSelected() != defMultiRow;
    prefs.putBoolean(WinSysPrefs.DOCUMENT_TABS_MULTIROW, checkMultiRow.isSelected());

    int tabPlacement = JTabbedPane.TOP;
    if( radioBottom.isSelected() )
        tabPlacement = JTabbedPane.BOTTOM;
    else if( radioLeft.isSelected() )
        tabPlacement = JTabbedPane.LEFT;
    else if( radioRight.isSelected() )
        tabPlacement = JTabbedPane.RIGHT;
    prefs.putInt( WinSysPrefs.DOCUMENT_TABS_PLACEMENT, tabPlacement );
    needsWinsysRefresh |= tabPlacement != defTabPlacement;

    return needsWinsysRefresh;
}
 
Example 2
Source File: Switches.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Defines the tab placement. The possible bundle values are <code>top</code>, <code>bottom</code>, <code>left</code>, <code>right</code>.
 * @return Tab placement when JTabbedPane implementation of Tab Control is
 * being used. The return value is one of <code>JTabbedPane.TOP</code> (default), <code>JTabbedPane.BOTTOM</code>,
 * <code>JTabbedPane.LEFT</code>, <code>JTabbedPane.RIGHT</code>.
 * 
 * @see JTabbedPane#getTabPlacement() 
 * 
 * @since 2.44
 */
public static int getSimpleTabsPlacement() {
    int result = JTabbedPane.TOP;
    try {
        String resValue = NbBundle.getMessage(Switches.class, "WinSys.TabControl.SimpleTabs.Placement" ); //NOI18N
        if( "bottom".equals( resValue ) )
            result = JTabbedPane.BOTTOM;
        else if( "right".equals( resValue ) )
            result = JTabbedPane.RIGHT;
        else if( "left".equals( resValue ) )
            result = JTabbedPane.LEFT;
    } catch( MissingResourceException mrE ) {
        //ignore
    }
    return result;
}
 
Example 3
Source File: InnerTabsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
boolean store() {
    boolean changed = false;
    int placement = JTabbedPane.TOP;
    if( radioPlacementBottom.isSelected() ) {
        placement = JTabbedPane.BOTTOM;
    } else if( radioPlacementLeft.isSelected() ) {
        placement = JTabbedPane.LEFT;
    } else if( radioPlacementRight.isSelected() ) {
        placement = JTabbedPane.RIGHT;
    }
    changed |= settings.setTabsLocation( placement );
    changed |= settings.setShowFullPath( checkShowFullPath.isSelected() );
    changed |= settings.setSameProjectSameColor( checkProjectColors.isSelected() );

    int rowCount = 1;
    if( checkMultiRow.isSelected() && radioRowCount.isSelected() )
        rowCount = ((Number)spinRowCount.getValue()).intValue();
    changed |= settings.setRowCount( rowCount );
    changed |= settings.setTabRowPerProject( radioRowPerProject.isSelected() && checkMultiRow.isSelected() );

    changed |= settings.setShowFolderName( checkShowFolderName.isSelected() );
    changed |= settings.setSortDocumentListByProject( checkSortDocumentList.isSelected() );

    return changed;

}
 
Example 4
Source File: InnerTabsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void fireChanged() {
    boolean isChanged = false;
    if (checkShowFolderName.isSelected() != settings.isShowFolderName()
            || checkShowFullPath.isSelected() != settings.isShowFullPath()
            || checkProjectColors.isSelected() != settings.isSameProjectSameColor()
            || checkSortDocumentList.isSelected() != settings.isSortDocumentListByProject()) {
        isChanged = true;
    }
    
    int rowCount = settings.getRowCount();
    if (checkMultiRow.isSelected() && radioRowCount.isSelected()) {
        rowCount = ((Number) spinRowCount.getValue()).intValue();
    }
    if (checkMultiRow.isSelected() != (rowCount > 1 || settings.isTabRowPerProject())) {
        isChanged = true;
    }
    if (rowCount != settings.getRowCount()) {
        isChanged = true;
    }
    if (radioRowPerProject.isSelected() != settings.isTabRowPerProject()) {
        isChanged = true;
    }
    
    if(radioPlacementBottom.isSelected() && settings.getTabsLocation() != JTabbedPane.BOTTOM
            || radioPlacementLeft.isSelected() && settings.getTabsLocation() != JTabbedPane.LEFT
            || radioPlacementRight.isSelected() && settings.getTabsLocation() != JTabbedPane.RIGHT
            || radioPlacementTop.isSelected() && settings.getTabsLocation() != JTabbedPane.TOP) {
        isChanged = true;
    }
    controller.changed(null, isChanged);
}
 
Example 5
Source File: InnerTabsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void load() {
    ProjectSupport projectSupport = ProjectSupport.getDefault();
    switch( settings.getTabsLocation() ) {
        case JTabbedPane.LEFT:
            radioPlacementLeft.setSelected( true );
            break;
        case JTabbedPane.RIGHT:
            radioPlacementRight.setSelected( true );
            break;
        case JTabbedPane.BOTTOM:
            radioPlacementBottom.setSelected( true );
            break;
        default:
            radioPlacementTop.setSelected( true );
    }
    checkShowFolderName.setSelected( settings.isShowFolderName() );
    checkShowFullPath.setSelected( settings.isShowFullPath() );
    checkProjectColors.setSelected( settings.isSameProjectSameColor() );
    checkSortDocumentList.setSelected( settings.isSortDocumentListByProject() );
    int rowCount = settings.getRowCount();
    checkMultiRow.setSelected( rowCount > 1 || settings.isTabRowPerProject() );
    if( rowCount > 1 )
        spinRowCount.getModel().setValue( Integer.valueOf( rowCount ) );
    radioRowPerProject.setSelected( settings.isTabRowPerProject() );
    radioRowCount.setSelected( rowCount > 1 );

    radioRowPerProject.setVisible( projectSupport.isEnabled() );
    checkProjectColors.setVisible( projectSupport.isEnabled() );
    checkSortDocumentList.setVisible( projectSupport.isEnabled() );

    enableControls();
}
 
Example 6
Source File: TabContainer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
TabContainer( TabbedImpl tabbedImpl, TabDisplayer tabDisplayer, int orientation ) {
    super( new BorderLayout(0, 0) );
    this.tabbedImpl = tabbedImpl;
    this.displayer = tabDisplayer;
    tcPanel = new JPanel( layout );
    add( tcPanel, BorderLayout.CENTER );
    tabbedImpl.getSelectionModel().addChangeListener( this );
    String lafId = UIManager.getLookAndFeel().getID();
    if( "Nimbus".equals( lafId ) ) {
        setBorder( new MatteBorder(1, 1, 1, 1, UIManager.getColor("nimbusBorder"))); //NOI18N
    } else if( "Aqua".equals( lafId ) ) {
        setBorder( BorderFactory.createEmptyBorder() );
    } else {
        setBorder( UIManager.getBorder( "Nb.ScrollPane.border" ) ); //NOI18N
    }
    switch( orientation ) {
        case JTabbedPane.TOP:
            add( displayer, BorderLayout.NORTH );
            break;
        case JTabbedPane.LEFT:
            add( displayer, BorderLayout.WEST );
            break;
        case JTabbedPane.RIGHT:
            add( displayer, BorderLayout.EAST );
            break;
        case JTabbedPane.BOTTOM:
            add( displayer, BorderLayout.SOUTH );
            break;
        default:
            throw new IllegalArgumentException( "Invalid orientation: " + orientation ); //NOI18N
    }
    stateChanged( null );
}
 
Example 7
Source File: TabDataRenderer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void paint( Graphics g ) {
    super.paint( g );
    Rectangle rect = getBounds();
    rect.x = 0;
    rect.y = 0;

    // paint underline selection
    if (isSelected && underlineHeight > 0 && underlineColor != null) {
        g.setColor(isActive || inactiveUnderlineColor == null
                ? underlineColor : inactiveUnderlineColor);
        switch (tabsLocation) {
            default:
            case JTabbedPane.TOP:
                g.fillRect(0, rect.height - underlineHeight, rect.width, underlineHeight);
                break;
            case JTabbedPane.BOTTOM:
                g.fillRect(0, 0, rect.width, underlineHeight);
                break;
            case JTabbedPane.LEFT:
                g.fillRect(rect.width - underlineHeight, 0, underlineHeight, rect.height);
                break;
            case JTabbedPane.RIGHT:
                g.fillRect(0, 0, underlineHeight, rect.height);
                break;
        }
    }

    // paint tab decorators
    for( TabDecorator td : decorators ) {
        td.paintAfter( tabData, g, rect, isSelected );
    }
}
 
Example 8
Source File: TabbedPaneTabAreaPainter.java    From seaglass with Apache License 2.0 5 votes vote down vote up
/**
 * @see com.seaglasslookandfeel.painter.AbstractRegionPainter#doPaint(java.awt.Graphics2D,
 *      javax.swing.JComponent, int, int, java.lang.Object[])
 */
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
    JTabbedPane tabPane     = (JTabbedPane) c;
    int         orientation = tabPane.getTabPlacement();

    if (orientation == JTabbedPane.LEFT || orientation == JTabbedPane.RIGHT) {
        paintVerticalLine(g, c, 0, height / 2, width, height);
    } else {
        paintHorizontalLine(g, c, 0, height / 2, width, height);
    }
}
 
Example 9
Source File: TabsPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected void load() {
    isCloseActivatesMostRecentDocument.setSelected(prefs.getBoolean(WinSysPrefs.EDITOR_CLOSE_ACTIVATES_RECENT, true));
    isNewDocumentOpensNextToActiveTab.setSelected(prefs.getBoolean(WinSysPrefs.OPEN_DOCUMENTS_NEXT_TO_ACTIVE_TAB, false));
    EditorSortType sortType = EditorSortType.valueOf(prefs.get(WinSysPrefs.EDITOR_SORT_TABS, EditorSortType.None.name()));
    switch (sortType) {
        case FullFilePath:
            radioSortFullFilePath.setSelected(true);
            break;
        case FileName:
            radioSortFileName.setSelected(true);
            break;
        case FileNameWithParent:
            radioSortFileNameWithParent.setSelected(true);
            break;
        default:
            radioSortNothing.setSelected(true);
            break;
    }

    defMultiRow = prefs.getBoolean( WinSysPrefs.DOCUMENT_TABS_MULTIROW, false );
    checkMultiRow.setSelected( defMultiRow );
    defTabPlacement = prefs.getInt( WinSysPrefs.DOCUMENT_TABS_PLACEMENT, JTabbedPane.TOP );
    switch( defTabPlacement ) {
        case JTabbedPane.BOTTOM:
            radioBottom.setSelected( true );
            break;
        case JTabbedPane.LEFT:
            radioLeft.setSelected( true );
            break;
        case JTabbedPane.RIGHT:
            radioRight.setSelected( true );
            break;
        default:
            radioTop.setSelected( true );
    }

    if( isAquaLaF ) {
        checkMultiRow.setSelected(false);
        checkMultiRow.setEnabled(false);
        radioLeft.setEnabled(false);
        radioRight.setEnabled(false);
        if( radioLeft.isSelected() || radioRight.isSelected() ) {
            radioTop.setSelected(true);
        }
    }
}
 
Example 10
Source File: TabTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static TabTableModel create( TabDataModel tabModel, int tabsLocation ) {
    if( tabsLocation == JTabbedPane.LEFT || tabsLocation == JTabbedPane.RIGHT )
        return new ColumnTableModel( tabModel );
    return new RowTableModel( tabModel );
}
 
Example 11
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);
}
 
Example 12
Source File: TabbedPaneRightTabState.java    From seaglass with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean isInState(JComponent c) {
    return (c instanceof JTabbedPane && ((JTabbedPane) c).getTabPlacement() == JTabbedPane.RIGHT);
}