EMMA Coverage Report (generated Tue Feb 12 22:23:49 ICT 2008)
[all classes][net.sourceforge.hivegui.component]

COVERAGE SUMMARY FOR SOURCE FILE [FixedSizeColorIcon.java]

nameclass, %method, %block, %line, %
FixedSizeColorIcon.java0%   (0/1)0%   (0/9)0%   (0/73)0%   (0/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FixedSizeColorIcon0%   (0/1)0%   (0/9)0%   (0/73)0%   (0/20)
FixedSizeColorIcon (): void 0%   (0/1)0%   (0/4)0%   (0/2)
FixedSizeColorIcon (int): void 0%   (0/1)0%   (0/5)0%   (0/2)
FixedSizeColorIcon (int, int): void 0%   (0/1)0%   (0/7)0%   (0/2)
FixedSizeColorIcon (int, int, int, int): void 0%   (0/1)0%   (0/15)0%   (0/6)
getColor (): Color 0%   (0/1)0%   (0/3)0%   (0/1)
getIconHeight (): int 0%   (0/1)0%   (0/8)0%   (0/1)
getIconWidth (): int 0%   (0/1)0%   (0/8)0%   (0/1)
paintIcon (Component, Graphics, int, int): void 0%   (0/1)0%   (0/19)0%   (0/3)
setColor (Color): void 0%   (0/1)0%   (0/4)0%   (0/2)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hivegui.component;
16 
17import java.awt.Color;
18import java.awt.Component;
19import java.awt.Graphics;
20 
21/**
22 * Specific Icon implementation that simply displays as a rectangle of a given
23 * color (which is settable).
24 * This is particularly useful for creating a colored JToggleButton in a
25 * JToolBar.
26 *
27 * @author jean-Francois Poilpret
28 */
29public class FixedSizeColorIcon implements ColorIcon
30{
31        public FixedSizeColorIcon()
32        {
33                this(DEFAULT_SIZE);
34        }
35 
36        public FixedSizeColorIcon(int size)
37        {
38                this(size, size);
39        }
40        
41        public FixedSizeColorIcon(int width, int height)
42        {
43                this(width, height, DEFAULT_INSET, DEFAULT_INSET);
44        }
45 
46        public FixedSizeColorIcon(int width, int height, int insetX, int insetY)
47        {
48                _insetX = insetX;
49                _insetY = insetY;
50                _width = width;
51                _height = height;
52        }
53 
54        public void                setColor(Color color)
55        {
56                _color = color;
57        }
58        
59        public Color        getColor()
60        {
61                return _color;
62        }
63        
64        public int        getIconWidth()
65        {
66                return _width + 2 * _insetX;
67        }
68        
69        public int        getIconHeight()
70        {
71                return _height + 2 * _insetY;
72        }
73 
74        public void        paintIcon(Component c, Graphics g, int x, int y)
75        {
76                g.setColor(_color);
77                g.fillRect(x + _insetX, y + _insetY, _width, _height);
78        }
79 
80        private final int                _insetX;
81        private final int                _insetY;
82        private final int                _width;
83        private final int                _height;
84        private Color                        _color;
85        
86        static private final int        DEFAULT_INSET        = 2;
87        static private final int        DEFAULT_SIZE        = 20;
88}

[all classes][net.sourceforge.hivegui.component]
EMMA 2.0.5312 (C) Vladimir Roubtsov