/*
* 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.
*/
/**
* Implementation of ScrollBarUI for the Metal Look and Feel
* <p>
*
* @author Tom Santos
* @author Steve Wilson
*/
{
protected int scrollBarWidth;
protected boolean isFreeStanding = true;
{
return new MetalScrollBarUI();
}
protected void installDefaults() {
super.installDefaults();
}
protected void installListeners(){
super.installListeners();
((ScrollBarListener)propertyChangeListener).handlePropertyChange( scrollbar.getClientProperty( FREE_STANDING_PROP ) );
}
return new ScrollBarListener();
}
protected void configureScrollBarColors()
{
super.configureScrollBarColors();
}
{
{
}
else // Horizontal
{
}
}
/** Returns the view that represents the decrease view.
*/
{
return decreaseButton;
}
/** Returns the view that represents the increase view. */
{
return increaseButton;
}
{
{
if ( !isFreeStanding ) {
if ( !leftToRight ) {
}
}
if ( c.isEnabled() ) {
g.setColor( darkShadowColor );
g.setColor( shadowColor );
// g.setColor( Color.red);
}
} else {
}
if ( !isFreeStanding ) {
if ( !leftToRight ) {
}
}
}
else // HORIZONTAL
{
if ( !isFreeStanding ) {
}
if ( c.isEnabled() ) {
g.setColor( darkShadowColor );
g.setColor( shadowColor );
// g.setColor( Color.red);
}
} else {
}
if ( !isFreeStanding ) {
}
}
}
{
if (!c.isEnabled()) {
return;
}
if (MetalLookAndFeel.usingOcean()) {
oceanPaintThumb(g, c, thumbBounds);
return;
}
{
if ( !isFreeStanding ) {
if ( !leftToRight ) {
}
}
g.setColor( thumbColor );
g.setColor( thumbShadow );
g.setColor( thumbHighlightColor );
if ( !isFreeStanding ) {
if ( !leftToRight ) {
}
}
}
else // HORIZONTAL
{
if ( !isFreeStanding ) {
}
g.setColor( thumbColor );
g.setColor( thumbShadow );
g.setColor( thumbHighlightColor );
if ( !isFreeStanding ) {
}
}
}
if (!isFreeStanding) {
if (!leftToRight) {
}
}
if (thumbColor != null) {
g.setColor(thumbColor);
}
g.setColor(thumbShadow);
}
gripY++;
}
}
if (!isFreeStanding) {
if (!leftToRight) {
}
}
}
else { // HORIZONTAL
if (!isFreeStanding) {
}
if (thumbColor != null) {
g.setColor(thumbColor);
}
g.setColor(thumbShadow);
}
gripX++;
}
}
if (!isFreeStanding) {
}
}
}
{
}
/**
* This is overridden only to increase the invalid area. This
* ensures that the "Shadow" below the thumb is invalidated
*/
{
/* If the thumbs bounds haven't changed, we're done.
*/
if ((thumbRect.x == x) &&
(thumbRect.y == y) &&
return;
}
/* Update thumbRect, and repaint the union of x,y,w,h and
* the old thumbRect.
*/
}
{
{
{
handlePropertyChange( e.getNewValue() );
}
else {
super.propertyChange( e );
}
}
{
{
if ( becameFlush ) {
toFlush();
}
else if ( becameNormal ) {
}
}
else
{
if ( !isFreeStanding ) {
isFreeStanding = true;
}
// This commented-out block is used for testing flush scrollbars.
/*
if ( isFreeStanding ) {
isFreeStanding = false;
toFlush();
}
*/
}
if ( increaseButton != null )
{
}
if ( decreaseButton != null )
{
}
}
protected void toFlush() {
scrollBarWidth -= 2;
}
protected void toFreeStanding() {
scrollBarWidth += 2;
}
} // end class ScrollBarListener
}