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

« back to all changes in this revision

Viewing changes to src/pc/DrMIPS/src/com/jtattoo/plaf/bernstein/BernsteinUtils.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.bernstein;
 
25
 
 
26
import com.jtattoo.plaf.*;
 
27
import java.awt.*;
 
28
import javax.swing.Icon;
 
29
 
 
30
/**
 
31
 * @author  Michael Hagen
 
32
 */
 
33
public class BernsteinUtils {
 
34
 
 
35
    private static final Icon BG_IMAGE = new LazyImageIcon("bernstein/icons/background.jpg");
 
36
    private static final int IMAGE_WIDTH = BG_IMAGE.getIconWidth();
 
37
    private static final int IMAGE_HEIGHT = BG_IMAGE.getIconHeight();
 
38
 
 
39
    private BernsteinUtils() {
 
40
    }
 
41
 
 
42
    public static void fillComponent(Graphics g, Component c) {
 
43
        if (AbstractLookAndFeel.getTheme().isBackgroundPatternOn()) {
 
44
            int w = c.getWidth();
 
45
            int h = c.getHeight();
 
46
            Point p = JTattooUtilities.getRelLocation(c);
 
47
            int y = -p.y;
 
48
            while (y < h) {
 
49
                int x = -p.x;
 
50
                while (x < w) {
 
51
                    BG_IMAGE.paintIcon(c, g, x, y);
 
52
                    x += IMAGE_WIDTH;
 
53
                }
 
54
                y += IMAGE_HEIGHT;
 
55
            }
 
56
        } else {
 
57
            g.setColor(c.getBackground());
 
58
            g.fillRect(0, 0, c.getWidth(), c.getHeight());
 
59
        }
 
60
 
 
61
    }
 
62
}