~ubuntu-branches/ubuntu/trusty/drmips/trusty-backports

« back to all changes in this revision

Viewing changes to src/pc/DrMIPS/src/com/jtattoo/plaf/fast/FastScrollBarUI.java

  • Committer: Package Import Robot
  • Author(s): Bruno Nova
  • Date: 2014-09-27 12:24:17 UTC
  • Revision ID: package-import@ubuntu.com-20140927122417-2gadkwt9k0u7j4zu
Tags: upstream-1.2.3
Import upstream version 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* Copyright (c) 2002 and later by MH Software-Entwicklung. All Rights Reserved.
 
3
*  
 
4
* JTattoo is multiple licensed. If your are an open source developer you can use
 
5
* it under the terms and conditions of the GNU General Public License version 2.0
 
6
* or later as published by the Free Software Foundation.
 
7
*  
 
8
* see: gpl-2.0.txt
 
9
 
10
* If you pay for a license you will become a registered user who could use the
 
11
* software under the terms and conditions of the GNU Lesser General Public License
 
12
* version 2.0 or later with classpath exception as published by the Free Software
 
13
* Foundation.
 
14
 
15
* see: lgpl-2.0.txt
 
16
* see: classpath-exception.txt
 
17
 
18
* Registered users could also use JTattoo under the terms and conditions of the 
 
19
* Apache License, Version 2.0 as published by the Apache Software Foundation.
 
20
*  
 
21
* see: APACHE-LICENSE-2.0.txt
 
22
*/
 
23
 
 
24
package com.jtattoo.plaf.fast;
 
25
 
 
26
import com.jtattoo.plaf.*;
 
27
import java.awt.*;
 
28
import javax.swing.JButton;
 
29
import javax.swing.JComponent;
 
30
import javax.swing.plaf.ComponentUI;
 
31
 
 
32
/**
 
33
 * @author Michael Hagen
 
34
 */
 
35
public class FastScrollBarUI extends BaseScrollBarUI {
 
36
 
 
37
    public static ComponentUI createUI(JComponent c) {
 
38
        return new FastScrollBarUI();
 
39
    }
 
40
 
 
41
    protected JButton createDecreaseButton(int orientation) {
 
42
        if (AbstractLookAndFeel.getTheme().isMacStyleScrollBarOn()) {
 
43
            return super.createDecreaseButton(orientation);
 
44
        } else {
 
45
            return new FastScrollButton(orientation, scrollBarWidth);
 
46
        }
 
47
    }
 
48
 
 
49
    protected JButton createIncreaseButton(int orientation) {
 
50
        if (AbstractLookAndFeel.getTheme().isMacStyleScrollBarOn()) {
 
51
            return super.createDecreaseButton(orientation);
 
52
        } else {
 
53
            return new FastScrollButton(orientation, scrollBarWidth);
 
54
        }
 
55
    }
 
56
 
 
57
    protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
 
58
        g.setColor(AbstractLookAndFeel.getControlColorLight());
 
59
        g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
 
60
    }
 
61
 
 
62
    protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
 
63
        if (!c.isEnabled()) {
 
64
            return;
 
65
        }
 
66
 
 
67
        g.translate(thumbBounds.x, thumbBounds.y);
 
68
 
 
69
        Color backColor = AbstractLookAndFeel.getTheme().getControlBackgroundColor();
 
70
        if (!JTattooUtilities.isActive(c)) {
 
71
            backColor = ColorHelper.brighter(backColor, 50);
 
72
        }
 
73
        Color frameColorHi = ColorHelper.brighter(backColor, 40);
 
74
        Color frameColorLo = ColorHelper.darker(backColor, 30);
 
75
        g.setColor(backColor);
 
76
        g.fillRect(1, 1, thumbBounds.width - 1, thumbBounds.height - 1);
 
77
        g.setColor(frameColorLo);
 
78
        g.drawRect(0, 0, thumbBounds.width - 1, thumbBounds.height - 1);
 
79
        g.setColor(frameColorHi);
 
80
        g.drawLine(1, 1, thumbBounds.width - 2, 1);
 
81
        g.drawLine(1, 1, 1, thumbBounds.height - 2);
 
82
        g.translate(-thumbBounds.x, -thumbBounds.y);
 
83
    }
 
84
}
 
 
b'\\ No newline at end of file'