/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The Metal subclass of BasicTabbedPaneUI.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Tom Santos
*/
// Background color for unselected tabs that don't have an explicitly
// set color.
private boolean tabsOpaque = true;
// Whether or not we're using ocean. This is cached as it is used
// extensively during painting.
private boolean ocean;
// Selected border color for ocean.
return new MetalTabbedPaneUI();
}
return super.createLayoutManager();
}
return new TabbedPaneLayout();
}
protected void installDefaults() {
super.installDefaults();
"TabbedPane.unselectedBackground");
if (ocean) {
"TabbedPane.borderHightlightColor");
}
}
int tabIndex, int x, int y, int w, int h,
boolean isSelected) {
int bottom = y + (h-1);
int right = x + (w-1);
switch ( tabPlacement ) {
case LEFT:
break;
case BOTTOM:
break;
case RIGHT:
break;
case TOP:
default:
}
}
int x, int y, int w, int h,
boolean isSelected ) {
int bottom = h - 1;
int right = w - 1;
//
// Paint Gap
//
g.translate( x, y );
if ( leftToRight ) {
} else {
}
g.translate( -x, -y );
}
g.translate( x, y );
//
// Paint Border
//
if (ocean && isSelected) {
}
else {
g.setColor( darkShadow );
}
if ( leftToRight ) {
// Paint slant
// Paint top
// Paint right
// last tab in run
}
}
// Paint left
// not the first tab in the last run
if (ocean && isSelected) {
g.setColor(darkShadow);
}
else {
}
} else {
// the first tab in the last run
}
} else {
// Paint slant
// Paint top
// Paint left
// last tab in run
}
// Paint right
}
else if (ocean && isSelected) {
if (tabIndex != 0) {
g.setColor(darkShadow);
}
}
else {
// not the first tab in the last run
} else {
// the first tab in the last run
}
}
}
//
// Paint Highlight
//
if ( leftToRight ) {
// Paint slant
// Paint top
// Paint left
// paint highlight in the gap on tab behind this one
// on the left end (where they all line up)
// first tab in run but not first tab in last run
// tab in front of selected tab
g.setColor( selectHighlight );
}
else {
// tab in front of normal tab
}
}
} else {
// Paint slant
// Paint top
// Paint left
// last tab in run
} else {
}
}
g.translate( -x, -y );
}
boolean result = false;
if (!tabsOpaque) {
return false;
}
// is the right edge of the last tab to the right
// of the left edge of the current tab?
return true;
}
} else {
int lastTabLeft = lastTabBounds.x;
// is the left edge of the last tab to the left
// of the right edge of the current tab?
return true;
}
}
} else {
// fill in gap for all other rows except last row
}
return result;
}
final int shadowWidth = 4;
int tabOverGap = -1;
// Check each tab in the row that is 'on top' of this row
for ( int i = startIndex; i <= endIndex; ++i ) {
// Check to see if this tab is over the gap
}
}
else {
}
}
}
return tabPane.getBackground();
}
int x, int y, int w, int h,
boolean isSelected ) {
g.translate( x, y );
int bottom = h - 1;
int right = w - 1;
//
// Paint part of the tab above
//
}
//
// Paint Highlight
//
if (ocean) {
}
else {
}
// Paint slant
// Paint left
// Paint top
if ( tabIndex != firstIndex ) {
} else {
}
}
//
// Paint Border
//
if (ocean) {
if (isSelected) {
}
else {
g.setColor( darkShadow );
}
}
else {
g.setColor( darkShadow );
}
// Paint slant
// Paint top
// Paint bottom
}
// Paint left
if (ocean) {
}
else if (isSelected) {
if (tabIndex != 0) {
g.setColor(darkShadow);
}
}
else if ( tabIndex != firstIndex ) {
} else {
}
}
else { // metal
if ( tabIndex != firstIndex ) {
} else {
}
}
g.translate( -x, -y );
}
int x, int y, int w, int h,
boolean isSelected ) {
int bottom = h - 1;
int right = w - 1;
//
// Paint Gap
//
g.translate( x, y );
if ( leftToRight ) {
} else {
}
g.translate( -x, -y );
}
g.translate( x, y );
//
// Paint Border
//
if (ocean && isSelected) {
}
else {
g.setColor( darkShadow );
}
if ( leftToRight ) {
// Paint slant
// Paint bottom
// Paint right
}
// Paint left
if (ocean && isSelected) {
g.setColor(darkShadow);
}
}
else {
}
} else {
}
}
} else {
// Paint slant
// Paint bottom
// Paint left
// last tab in run
}
// Paint right
}
else if (ocean && isSelected) {
if (tabIndex != firstIndex) {
g.setColor(darkShadow);
}
}
// not the first tab in the last run
} else {
// the first tab in the last run
}
}
//
// Paint Highlight
//
if ( leftToRight ) {
// Paint slant
// Paint left
// paint highlight in the gap on tab behind this one
// on the left end (where they all line up)
// first tab in run but not first tab in last run
// tab in front of selected tab
g.setColor( selectHighlight );
}
else {
// tab in front of normal tab
}
}
} else {
// Paint left
// last tab in run
} else {
}
}
g.translate( -x, -y );
}
int x, int y, int w, int h,
boolean isSelected ) {
g.translate( x, y );
int bottom = h - 1;
int right = w - 1;
//
// Paint part of the tab above
//
}
//
// Paint Highlight
//
// Paint slant
// Paint top
// Paint left
if ( !isSelected ) {
}
//
// Paint Border
//
if (ocean && isSelected) {
}
else {
g.setColor( darkShadow );
}
// Paint bottom
}
// Paint slant
}
// Paint top
// Paint right
if (ocean && isSelected) {
if (tabIndex != firstIndex) {
g.setColor(darkShadow);
}
}
g.setColor(darkShadow);
}
else if ( tabIndex != firstIndex ) {
} else {
}
g.translate( -x, -y );
}
if ( c.isOpaque() ) {
g.setColor( tabAreaBackground );
}
paint( g, c );
}
int tabIndex, int x, int y, int w, int h, boolean isSelected ) {
int slantWidth = h / 2;
if ( isSelected ) {
g.setColor( selectColor );
} else {
}
switch ( tabPlacement ) {
case LEFT:
break;
case BOTTOM:
break;
case RIGHT:
break;
case TOP:
default:
}
} else {
switch ( tabPlacement ) {
case LEFT:
break;
case BOTTOM:
break;
case RIGHT:
break;
case TOP:
default:
}
}
}
/**
* Overridden to do nothing for the Java L&F.
*/
return 0;
}
/**
* Overridden to do nothing for the Java L&F.
*/
return 0;
}
/**
* {@inheritDoc}
*
* @since 1.6
*/
protected int getBaselineOffset() {
return 0;
}
// Paint the background for the tab area
}
else {
g.setColor( c.getBackground() );
}
switch ( tabPlacement ) {
case LEFT:
break;
case BOTTOM:
break;
case RIGHT:
break;
case TOP:
default:
}
}
super.paint( g, c );
}
protected void paintHighlightBelowTab( ) {
}
boolean isSelected) {
switch ( tabPlacement ) {
case RIGHT:
break;
case BOTTOM:
if ( leftToRight ) {
} else {
if ( lastInRun ) {
// last tab in run
} else {
}
}
break;
case LEFT:
break;
case TOP:
default:
if ( leftToRight ) {
}
else {
if ( lastInRun ) {
// last tab in run
}
else {
}
}
}
}
}
int selectedIndex,
int x, int y, int w, int h ) {
int right = x + w - 1;
if (ocean) {
}
else {
}
// Draw unbroken line if tabs are not on TOP, OR
// selected tab is not in run adjacent to content, OR
// selected tab is not visible (SCROLL_TAB_LAYOUT)
//
g.drawLine(x, y, x+w-2, y);
}
} else {
// Break line to show visual connection to selected tab
if ( leftToRight || lastInRun ) {
} else {
}
if ( leftToRight && !lastInRun ) {
} else {
}
} else {
}
if (ocean) {
if ( leftToRight || lastInRun ) {
} else {
}
if ( leftToRight && !lastInRun ) {
} else {
}
} else {
}
}
}
}
int selectedIndex,
int x, int y, int w, int h) {
int bottom = y + h - 1;
int right = x + w - 1;
g.setColor(darkShadow);
// Draw unbroken line if tabs are not on BOTTOM, OR
// selected tab is not in run adjacent to content, OR
// selected tab is not visible (SCROLL_TAB_LAYOUT)
//
(selRect.y - 1 > h) ||
}
} else {
// Break line to show visual connection to selected tab
if (ocean) {
}
if ( leftToRight || lastInRun ) {
} else {
}
if ( leftToRight && !lastInRun ) {
} else {
}
}
}
}
int selectedIndex,
int x, int y, int w, int h) {
if (ocean) {
}
else {
}
// Draw unbroken line if tabs are not on LEFT, OR
// selected tab is not in run adjacent to content, OR
// selected tab is not visible (SCROLL_TAB_LAYOUT)
//
}
} else {
// Break line to show visual connection to selected tab
x, y+h+2);
}
if (ocean) {
x + 1, y+h+2);
}
}
}
}
int selectedIndex,
int x, int y, int w, int h) {
g.setColor(darkShadow);
// Draw unbroken line if tabs are not on RIGHT, OR
// selected tab is not in run adjacent to content, OR
// selected tab is not visible (SCROLL_TAB_LAYOUT)
//
(selRect.x - 1 > w) ||
}
} else {
// Break line to show visual connection to selected tab
if (ocean) {
}
x+w-1, y+h-2);
}
}
}
boolean tallerIcons = false;
tallerIcons = true;
break;
}
}
}
return super.calculateMaxTabHeight( tabPlacement ) -
}
// Tab runs laid out vertically should overlap
// at least as much as the largest slant
return maxTabHeight / 2;
}
return 0;
}
// Don't rotate runs!
return false;
}
// Don't pad last run
}
}
/**
* Returns the color to use for the specified tab.
*/
if (color instanceof UIResource) {
if (unselectedBackground != null) {
return unselectedBackground;
}
}
return color;
}
/**
* Returns the tab index of JTabbedPane the mouse is currently over
*/
int getRolloverTabIndex() {
return getRolloverTab();
}
/**
* This class should be treated as a "protected" inner class.
* Instantiate it only within subclasses of {@code MetalTabbedPaneUI}.
*/
public TabbedPaneLayout() {
MetalTabbedPaneUI.this.super();
}
// Only normalize the runs for top & bottom; normalizing
// doesn't look right for Metal's vertical tabs
// because the last run isn't padded and it looks odd to have
// fat tabs in the first vertical runs, but slimmer ones in the
// last (this effect isn't noticeable for horizontal tabs).
}
}
// Don't rotate runs!
}
// Don't pad selected tab
}
}
}