jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java
author rupashka
Thu, 16 Feb 2012 17:42:09 +0400
changeset 11975 d3620e28371c
parent 5506 202f599c92aa
permissions -rw-r--r--
7089914: Focus on image icons are not visible in javaws cache with high contrast mode Reviewed-by: rupashka Contributed-by: Sean Chou <zhouyx@linux.vnet.ibm.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
     2
 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.java.swing.plaf.windows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.plaf.basic.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.HashSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import static com.sun.java.swing.plaf.windows.TMSchema.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * Windows rendition of the component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * future Swing releases.  The current serialization support is appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * for short term storage or RMI between applications running the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * version of Swing.  A future release of Swing will provide support for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * long term persistence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * Keys to use for forward focus traversal when the JComponent is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * managing focus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     */
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 2
diff changeset
    56
    private static Set<KeyStroke> managingFocusForwardTraversalKeys;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Keys to use for backward focus traversal when the JComponent is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * managing focus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 2
diff changeset
    62
    private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    private boolean contentOpaque = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    protected void installDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        super.installDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        contentOpaque = UIManager.getBoolean("TabbedPane.contentOpaque");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        // focus forward traversal key
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        if (managingFocusForwardTraversalKeys==null) {
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 2
diff changeset
    72
            managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        // focus backward traversal key
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        if (managingFocusBackwardTraversalKeys==null) {
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 2
diff changeset
    78
            managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            managingFocusBackwardTraversalKeys.add( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    protected void uninstallDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        // sets the focus forward and backward traversal keys to null
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        // to restore the defaults
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        super.uninstallDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public static ComponentUI createUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        return new WindowsTabbedPaneUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    protected void setRolloverTab(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        // Rollover is only supported on XP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        if (XPStyle.getXP() != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            int oldRolloverTab = getRolloverTab();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            super.setRolloverTab(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            Rectangle r1 = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            Rectangle r2 = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            if ( (oldRolloverTab >= 0) && (oldRolloverTab < tabPane.getTabCount()) ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                r1 = getTabBounds(tabPane, oldRolloverTab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            if (index >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                r2 = getTabBounds(tabPane, index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            if (r1 != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                if (r2 != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                    tabPane.repaint(r1.union(r2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                    tabPane.repaint(r1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            } else if (r2 != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                tabPane.repaint(r2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        XPStyle xp = XPStyle.getXP();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        if (xp != null && (contentOpaque || tabPane.isOpaque())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            Skin skin = xp.getSkin(tabPane, Part.TABP_PANE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            if (skin != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                Insets insets = tabPane.getInsets();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                // Note: don't call getTabAreaInsets(), because it causes rotation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                // Make sure "TabbedPane.tabsOverlapBorder" is set to true in WindowsLookAndFeel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                Insets tabAreaInsets = UIManager.getInsets("TabbedPane.tabAreaInsets");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                int x = insets.left;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                int y = insets.top;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                int w = tabPane.getWidth() - insets.right - insets.left;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                int h = tabPane.getHeight() - insets.top - insets.bottom;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                // Expand area by tabAreaInsets.bottom to allow tabs to overlap onto the border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                if (tabPlacement == LEFT || tabPlacement == RIGHT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                    int tabWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    if (tabPlacement == LEFT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                        x += (tabWidth - tabAreaInsets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                    w -= (tabWidth - tabAreaInsets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                    int tabHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                    if (tabPlacement == TOP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                        y += (tabHeight - tabAreaInsets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                    h -= (tabHeight - tabAreaInsets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                paintRotatedSkin(g, skin, tabPlacement, x, y, w, h, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        super.paintContentBorder(g, tabPlacement, selectedIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                                      int x, int y, int w, int h, boolean isSelected ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        if (XPStyle.getXP() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            super.paintTabBackground(g, tabPlacement, tabIndex, x, y, w, h, isSelected);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                                  int x, int y, int w, int h, boolean isSelected ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        XPStyle xp = XPStyle.getXP();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        if (xp != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            Part part;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            int tabCount = tabPane.getTabCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            int tabRun = getRunForTab(tabCount, tabIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            if (tabRuns[tabRun] == tabIndex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                part = Part.TABP_TABITEMLEFTEDGE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            } else if (tabCount > 1 && lastTabInRun(tabCount, tabRun) == tabIndex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                part = Part.TABP_TABITEMRIGHTEDGE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                if (isSelected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    // Align with right edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                    if (tabPlacement == TOP || tabPlacement == BOTTOM) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                        w++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                        h++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                part = Part.TABP_TABITEM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            State state = State.NORMAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            if (isSelected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                state = State.SELECTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            } else if (tabIndex == getRolloverTab()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                state = State.HOT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            paintRotatedSkin(g, xp.getSkin(tabPane, part), tabPlacement, x, y, w, h, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            super.paintTabBorder(g, tabPlacement, tabIndex, x, y, w, h, isSelected);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    private void paintRotatedSkin(Graphics g, Skin skin, int tabPlacement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                                  int x, int y, int w, int h, State state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        Graphics2D g2d = (Graphics2D)g.create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        g2d.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        switch (tabPlacement) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
           case RIGHT:  g2d.translate(w, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                        g2d.rotate(Math.toRadians(90.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                        skin.paintSkin(g2d, 0, 0, h, w, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
           case LEFT:   g2d.scale(-1.0, 1.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                        g2d.rotate(Math.toRadians(90.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                        skin.paintSkin(g2d, 0, 0, h, w, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
           case BOTTOM: g2d.translate(0, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                        g2d.scale(-1.0, 1.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                        g2d.rotate(Math.toRadians(180.0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                        skin.paintSkin(g2d, 0, 0, w, h, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
           case TOP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
           default:     skin.paintSkin(g2d, 0, 0, w, h, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        g2d.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
}