summaryrefslogtreecommitdiffstats
path: root/src/cppcheckplus/toolbar/MyToolBarRoverButton.java
blob: 9ab1dc841e712c2c28e98d4a04c75e35fbdbdfb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

package cppcheckplus.toolbar;

import java.awt.Color;
import javax.swing.Icon;
import javax.swing.ImageIcon;

import cppcheckplus.control.MyContorlUtil;


public class MyToolBarRoverButton extends MyToolBarButton
{
	private Color roverDyeColor;

	public MyToolBarRoverButton()
	{
		roverDyeColor = new Color(86, 146, 61);
	}

	public void setIcon(Icon icon)
	{
		super.setIcon(icon);
		if (icon == null)
		{
			setPressedIcon(null);
			setRolloverIcon(null);
		} else
		{
			java.awt.Image image = MyContorlUtil.iconToImage(icon);
			Icon roverIcon = MyContorlUtil.createDyedIcon(new ImageIcon(image), roverDyeColor);
			Icon pressedIcon = MyContorlUtil.createMovedIcon(roverIcon);
			setRolloverIcon(roverIcon);
			setPressedIcon(pressedIcon);
		}
	}
}