Java Code Examples for javax.swing.JTabbedPane#LEFT

The following examples show how to use javax.swing.JTabbedPane#LEFT . 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: TabTest.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
public TabTest() {
	super(JTabbedPane.LEFT,JTabbedPane.SCROLL_TAB_LAYOUT);
	
	addOneTab("Az");
		addButton();
	addOneTab("Ba");
		addButton();
		addButton();
	addOneTab("Cb");
		addButton();
		addButton();
		addButton();
		addButton();
		addButton();
		addButton();
	addOneTab("Dc");
		addButton();
		addButton();
		addButton();
		addText();
}
 
Example 4
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 5
Source File: EnvironmentInspector.java    From jacamo with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void initFrame() {
    frame = new JFrame("..:: Environment Inspector ::..");
    allArtsPane = new JTabbedPane(JTabbedPane.LEFT);

    frame.getContentPane().setLayout(new BorderLayout());
    frame.add(BorderLayout.CENTER, allArtsPane);
    frame.pack();

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    guiCount = guiCount+30;
    frame.setBounds(0, 0, 800, (int)(screenSize.height * 0.8));
    frame.setLocation(
            (screenSize.width  / 2)-guiCount - frame.getWidth() / 2,
            (screenSize.height / 2)+guiCount - frame.getHeight() / 2);
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            frame.setVisible(true);
        }
    });
}
 
Example 6
Source File: PhoneControl.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) {
    try {
        String classname = UIManager.getSystemLookAndFeelClassName();

        if (classname.indexOf("Windows") != -1) {
            UIManager.setLookAndFeel(new com.jgoodies.looks.windows.WindowsLookAndFeel());
        } else if (classname.indexOf("mac") != -1 || classname.indexOf("apple") != -1) {
            UIManager.setLookAndFeel(classname);
        } else {
            UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel());
        }

    }
    catch (Exception e) {
        Log.error(e);
    }

    final JFrame f = new JFrame();

    JTabbedPane pane = new JTabbedPane(JTabbedPane.LEFT);
    //pane.addTab("Matt Tucker", PhoneRes.getImageIcon("ON_HOLD_IMAGE"), new PhoneControl("Matt Tucker", "503-972-6134"));
    //pane.addTab("Derek DeMoro", PhoneRes.getImageIcon("ON_PHONE_IMAGE"), new PhoneControl("Derek DeMoro", "503-972-6133"));
    //pane.addTab("Gato", PhoneRes.getImageIcon("ON_HOLD_IMAGE"), new PhoneControl("Gaston Dombiak", "503-976-LOVE"));

    f.getContentPane().add(pane);
    f.pack();
    f.setSize(400, 400);

    GraphicUtils.centerWindowOnScreen(f);
    f.setVisible(true);
}
 
Example 7
Source File: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected JTabbedPane createMainPanel() {
    this.tabbedPane = new JTabbedPane(JTabbedPane.LEFT);
    this.tabbedPane.setBorder(BorderFactory.createEmptyBorder());
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double widthRatio = 0.5;
    formWidth = Math.max((int) (screenSize.width * widthRatio), MIN_TABBED_WIDTH);
    double heightRatio = 0.5;
    int formHeight = Math.max((int) (screenSize.height * heightRatio), MIN_TABBED_HEIGHT);
    tabbedPane.setPreferredSize(new Dimension(formWidth, formHeight));
    getJDialog().setMinimumSize(new Dimension(formWidth + 16, formHeight + 72));

    addTab(tabbedPane, Bundle.CTL_Panel_OperatorDescriptor_Text(), createDescriptorTab());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_ConfigParams_Text(), createToolInfoPanel());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_PreProcessing_Border_TitleText(), createPreProcessingTab());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_OpParams_Border_TitleText(), createParametersTab(formWidth));
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_SysVar_Border_TitleText(), createVariablesPanel());
    currentIndex++;
    addTab(tabbedPane, Bundle.CTL_Panel_Bundle_TitleText(), createBundlePanel());
    currentIndex++;

    tabbedPane.setUI(new BasicTabbedPaneUI());

    formWidth = tabbedPane.getTabComponentAt(0).getWidth();

    return tabbedPane;
}
 
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: MASConsoleGUI.java    From jason with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void initMainPanel() {
    String tabbed = LogManager.getLogManager().getProperty(isTabbedPropField);
    if (tabbed != null && tabbed.equals("true")) {
        isTabbed = true;
    }
    pcenter = new JPanel(new BorderLayout());
    if (isTabbed) {
        tabPane = new JTabbedPane(JTabbedPane.LEFT);
        pcenter.add(BorderLayout.CENTER, tabPane);
    }
    frame.getContentPane().add(BorderLayout.CENTER, pcenter);
}
 
Example 10
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 11
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 12
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 13
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 14
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 15
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 16
Source File: TabbedPaneLeftTabState.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.LEFT);
}
 
Example 17
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);
        }
    }
}