Where do I put images for java program to input? - java

I've been following a tutorial to learn graphics and in one program the author uses images to make texture paints. I have copied his code however I dont know where to actually put the images for it to read. I have tried making a resources folder in eclipse and setting it as a source folder build path but this didnt work. The code is below:
EDIT:
Okay, I figured out that it is taking images from the source of the class. However, lets say I wanted to pull an image from my desktop, or some other location on my hard drive, how would i do this?
class Surface extends JPanel {
private BufferedImage slate;
private BufferedImage java;
private BufferedImage pane;
private TexturePaint slatetp;
private TexturePaint javatp;
private TexturePaint panetp;
public Surface() {
loadImages();
}
private void loadImages() {
try {
slate = ImageIO.read(new File("slate.png"));
java = ImageIO.read(new File("java.png"));
pane = ImageIO.read(new File("pane.png"));
} catch (IOException ex) {
Logger.getLogger(Surface.class.getName()).log(
Level.SEVERE, null, ex);
}
}
private void doDrawing(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
slatetp = new TexturePaint(slate, new Rectangle(0, 0, 90, 60));
javatp = new TexturePaint(java, new Rectangle(0, 0, 90, 60));
panetp = new TexturePaint(pane, new Rectangle(0, 0, 90, 60));
g2d.setPaint(slatetp);
g2d.fillRect(10, 15, 90, 60);
g2d.setPaint(javatp);
g2d.fillRect(130, 15, 90, 60);
g2d.setPaint(panetp);
g2d.fillRect(250, 15, 90, 60);
g2d.dispose();
}
#Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
doDrawing(g);
}
}

This can be helpful. Or just use absolute PATH to file. linux: /home/user/... widndows: C:/Users/..

Related

Set location to image using paintComponent

I have the next code:
public class GalleryPrinter extends JPanel {
private BufferedImage image;
public GalleryPrinter() {
}
public GalleryPrinter(LinkedList<String> paths) {
for(int i = 0; i < paths.size(); i++ ) {
try {
image = ImageIO.read(new File(paths.get(i)));
} catch (IOException ex) {
Logger.getLogger(GalleryPrinter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
#Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
//g.drawImage(image, 25, 25, this); // see javadoc for more info on the parameters
g.drawImage(image, 0, 0, 140, 200, this);
}
}
But is printing all the images in the same place, defined here:
g.drawImage(image, 0, 0, 140, 200, this);
How I can make this position dynamic? Something like:
If is the first image
g.drawImage(image, 0, 0, 140, 200 * index, this);
To create a vertical image gallery.
Someone can help me with that?

Rounded Image in a java swing Jlabel

I have been banging my head since morning on a a Jlabel issue; I would like to have an round image instead of the normal rectangular image for a label as shown in the image below.
I have tried overriding paintComponent in the label but the image would not display at all. I have not found a very concrete answer on previous SO posts. Your help is welcome. Thanks in advance.
My code is as below:
jLabelPic = new javax.swing.JLabel(){
BufferedImage image= null;
private Ellipse2D.Double border = new Ellipse2D.Double();
private int width=140, height=140;
#Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
try {
image= ImageIO.read(getClass().getResource("/resources/image.jpg"));
} catch (IOException ex) {
ex.printStackTrace();
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setPaint(Color.RED);
g2d.fillRect(0, 0, width, height);
border.setFrame(0, 0, width, height);
g2d.setClip(border);
g2d.drawImage(image, 0, 0, width, height, this);
}
};

How to retrieve image from project folder

I am trying to shuffle image from my folder image which I am able to do. what I have to pass the name of image but I don't want pass the name of image I just want to give the name of folder and all image should from there how can I do this
Here is my code
public class main1 extends javax.swing.JFrame {
private JLabel ecause = new JLabel();
private List<BufferedImage> list = new ArrayList<BufferedImage>();
private List<BufferedImage> shuffled;
private JLabel label = new JLabel();
private int width = 700;
private int height = 700;
private Timer timer = new Timer(4000, new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
update();
}
});
public main1() {
this.getContentPane().setBackground(new java.awt.Color(153, 153, 0));
this.setUndecorated(true);
ecause.setText(" eCause List");
ecause.setBounds(0, 1278, 496, 88);
ecause.setFont(new java.awt.Font("Times New Roman", 1, 40));
ecause.setBackground(new java.awt.Color(255, 153, 0));
ecause.setOpaque(true);
this.add(ecause);
initComponents();
try {
list.add(resizeImage(ImageIO.read(new File("images\\Picture2.png"))));
list.add(resizeImage(ImageIO.read(new File("images\\Picture3.png"))));
list.add(resizeImage(ImageIO.read(new File("images\\Picture4.png"))));
list.add(resizeImage(ImageIO.read(new File("images\\Picture5.png"))));
} catch (IOException e) {
e.printStackTrace();
}
shuffled = new ArrayList<BufferedImage>(list);
Collections.shuffle(shuffled);
timer.start();
}
private BufferedImage resizeImage(BufferedImage originalImage) throws IOException {
BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, width, height, null);
g.dispose();
return resizedImage;
}
private void update() {
if (shuffled.isEmpty()) {
shuffled = new ArrayList<BufferedImage>(list);
Collections.shuffle(shuffled);
}
BufferedImage icon = shuffled.remove(0);
jLabel3.setIcon(new ImageIcon(icon));
}
}
How can I achieve my output?
You can list every file contained in the folder like this :
File[] files = new File("images/").listFiles();
Note that it will also give the subdirectories.
So instead of
list.add(resizeImage(ImageIO.read(new File("images\\Picture2.png"))));
list.add(resizeImage(ImageIO.read(new File("images\\Picture3.png"))));
list.add(resizeImage(ImageIO.read(new File("images\\Picture4.png"))));
list.add(resizeImage(ImageIO.read(new File("images\\Picture5.png"))));
You can simply loop over each files given by listFiles method. You could also use listFiles(FileFilter) in order to filter out each file that isn't an image.
I would add this as a comment but don't have the rep yet - doing
new File("images/myimage.png")
will not work if you package your code into a jar. To do this, you will need to use getResourceAsStream (http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html) and if your images folder is at your project root, you would do:
this.getClass().getResourceAsStream("/images")
The first slash here is important - it denotes the fact that you are going from the project root. If you just put "images", it would look from whatever class you put this code in (say you were in com.somepackage.blah, it would look in the blah package for your image).
Hope this helps!

Darkening image using Graphics2D issue in Windows 7 64-bit

My small Java program is trying to darken a png image. It's working fine on my Mac but when I try to run it on a Windows PC with java 1.7_07 installed but it doesn't show anything at all except an empty JPanel, the image is completely disappeared.
Here is the code:
class MapCanvas extends JPanel {
private Color color;
RescaleOp op;
BufferedImage sourceImage, bi;
public MapCanvas() {
try {
sourceImage = ImageIO.read(new File(MAP_FILENAME));
bi = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
op = new RescaleOp(.8f, 0, null);
bi = op.filter(bi, null);
Graphics2D g = bi.createGraphics();
g.drawImage(sourceImage, 0, 0, 500, 382, null);
g.dispose();
} catch (Exception e) {
e.printStackTrace();
}
// set size for the panel
Dimension size = new Dimension(500, 382);
this.setBackground(new Color(34, 102, 187));
setPreferredSize(size);
setSize(size);
setLayout(null);
}
#Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g2d = (Graphics2D) g;
g2d.drawImage(bi, op, 0, 0);
}
}
Anyone know why I'm getting this? Many thanks.
I don't seem to have any issues, BUT, several things jump out at me about this example...
Firstly, I don't see why you've done this...
try {
sourceImage = ImageIO.read(new File("C:/Users/shane/Dropbox/issue453.jpg"));
bi = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
op = new RescaleOp(.1f, 0, null);
bi = op.filter(bi, null);
Graphics2D g = bi.createGraphics();
g.drawImage(sourceImage, 0, 0, 500, 382, null);
g.dispose();
} catch (Exception e) {
e.printStackTrace();
}
Then done this...
public void paintComponent(Graphics g) {
super.paintComponent(g);
g2d = (Graphics2D) g;
g2d.drawImage(bi, op, 0, 0);
}
You're basically double apply the RescaleOp.
It could simply just apply the RescaleOp directly to the sourceImage...
public void paintComponent(Graphics g) {
super.paintComponent(g);
g2d = (Graphics2D) g;
g2d.drawImage(sourceImage, op, 0, 0);
}
Unless you're concerned about performance, in which case you should simple draw the bi without any BufferedImageOp
g2d.drawImage(bi, 0, 0, this);
Secondly, your example won't compile because you've not defined g2d in your paintComponent method. This is either an oversight (which is fine) OR you are caching the Graphics object, which is not fine.
Graphics objects are stateless, they do not persist between repaints, you should NEVER cache them or rely on getGraphics.
Thank you for pointing out my mistakes. There is some missing code in my question (the Graphics2D g2d - it's just an unassigned variable) so it doesn't compile. Sorry about that.
This is how I fixed it:
`sourceImage = ImageIO.read(new File(MAP_FILENAME));
bi = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
float[] scales = { .5f, .5f, .5f, 1f };
float[] offsets = new float[4];
op = new RescaleOp(scales, offsets, null);
Graphics2D g1 = bi.createGraphics();
g1.drawImage(sourceImage, 0, 0, 500, 382, null);
g1.dispose();
op.filter(sourceImage, bi);`
I just use the same value for RGB in the scales array (that's how it supposed to be) then draw the filtered image.
`g2d.drawImage(bi, 0, 0, 500, 382, null);`
Cheers

Gradient problems in Java

In my program I wanted to have a translucent white to transparent gradient on my JFrame to overlay a yellow background. This works fine and it needs to be a white to transparent because of how my settings for the program work for the user. However, when I take the program into college (JRE7 to my JRE6) the gradient goes white to blackish then transparent... It isn't so bad until you start to increase the opacity of the white colour... is there anyway I can fix this?
here is the relevant code from the top of my JFrame code.
public class DictionaryGUI extends JFrame
{
protected JPanel pGradientPane;
//Interface gradient specification
private Color pInterfaceColour = new Color(255, 245, 62);
protected int iDegreeWhite = 180
protected int iDegreeBlack = 0
DictionaryGUI(int iWidth, int iHeight)
{
/*General definitions*/
super(String.format("French Verb Conjugator - Version %s", MainLauncher.version));
setSize(iWidth, iHeight);
new Menu(this);
this.iWidth = iWidth;
this.iHeight = iHeight;
getContentPane().setBackground(pInterfaceColour);
pGradientPane = new JPanel(new GridBagLayout())
{
private static final long serialVersionUID = 1L;
protected void paintComponent(Graphics pGraphics)
{
Graphics2D pGraphicsGradientRender = (Graphics2D) pGraphics;
pGraphicsGradientRender.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255, 255, 255, iDegreeWhite), 0, getHeight(), new Color(0, 0, 0, iDegreeBlack));
pGraphicsGradientRender.setPaint(pGradient);
pGraphicsGradientRender.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(pGraphics);
}
};
pGradientPane.setOpaque(false);
pGradientPane.setPreferredSize(new Dimension(iWidth - 16, iHeight - 62));
/*components added to pGradientPane here!*/
add(pGradientPane);
}
And the mainclass aswell:
public class MainLauncher
{
static int iHeight = 400;
static int iWidth = 730;
static String version = "0A3B6";
public static void main(String[] args)
{
try
{
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
{
if ("Nimbus".equals(info.getName()))
{
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {e.printStackTrace();}
DictionaryGUI window = new DictionaryGUI(iWidth, iHeight);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLocationByPlatform(true);
window.setVisible(true);
}
Is it just some difference between JRE6 and JRE7? should I make the bottom colour to white aswell? (was black incase people want to darken the colour at the bottom.)
I can post some screenshots tommorrow if anybody needs them....
Thanks
Jamie
EDIT:
I changed the second (transparent) colour in the gradient to white and it fixes the problem. However, I am still troubled to why the transparent black colour shows through in the middle? it must be something to do with JRE7 because thats where it occurs... maybe they changed something with how transparency in gradients work. Does anybody know how to eliminate this problem while keeping the colour black?
Here is my version of your code as an sscce:
import java.awt.*;
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
public class MainLauncher {
static int iHeight = 400;
static int iWidth = 730;
static String version = "0A3B6";
public static void main(String[] args) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
DictionaryGUI window = new DictionaryGUI(iWidth, iHeight);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLocationByPlatform(true);
window.setVisible(true);
}
}
class DictionaryGUI extends JFrame {
protected JPanel pGradientPane;
// Interface gradient specification
private Color pInterfaceColour = new Color(255, 245, 62);
protected int iDegreeWhite = 180;
protected int iDegreeBlack = 0;
DictionaryGUI(int iWidth, int iHeight) {
/* General definitions */
super(String.format("French Verb Conjugator - Version %s",
MainLauncher.version));
setSize(iWidth, iHeight);
getContentPane().setBackground(pInterfaceColour);
pGradientPane = new JPanel() {
private static final long serialVersionUID = 1L;
protected void paintComponent(Graphics pGraphics) {
Graphics2D pGraphicsGradientRender = (Graphics2D) pGraphics;
pGraphicsGradientRender.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255,
255, 255, iDegreeWhite), 0, getHeight(), new Color(0, 0, 0,
iDegreeBlack));
pGraphicsGradientRender.setPaint(pGradient);
pGraphicsGradientRender.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(pGraphics);
}
};
pGradientPane.setOpaque(false);
pGradientPane.setPreferredSize(new Dimension(iWidth - 16, iHeight - 62));
/* components added to pGradientPane here! */
add(pGradientPane);
}
}
But again this doesn't demonstrate your problem. I'm guessing though that your problem is one of using transparent backgrounds with Swing GUI where painting artifacts are not corrected fully. If so, please read what Rob Camick has to say about this on his blog: Backgrounds With Transparency
The problem with the code is this line:
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255, 255, 255, iDegreeWhite), 0, getHeight(), new Color(0, 0, 0, iDegreeBlack));
should be this:
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255, 255, 255, iDegreeWhite), 0, getHeight(), new Color(255, 245, 62, iDegreeWhite));
Looking back at your question, I see you've basically found the solution - but it's a little different. Here's why:
When blending the colors in the gradient, your blending all aspects of the color: RBGA
You see, until you reach the full second color, you are mixing black into the color gradient and that mix won't be at the full transparency. So 20% of the way down the page, you'll have this color: 204,204,204,144 (that's 80% white, 20% black, and 56% opaque).
The easiest solution is to avoid translucency completely if you're not using it - just blend from the light yellow at the top to the dark yellow at the bottom. It takes less resources this way too.
But since you're using transparency, the solution I've provided uses transparency as well. You'll be blending from the white to the yellow using a consistent transparency.
If you blend from white to white (transparent), you'll have the same problem as before only with white (which will be less noticeable since it's one of the colors you're using): The gradient will have a white "streak" until the second color reaches full transparency.
As far as why it acts different on different JVMs, I'd guess that Oracle may have changed the way alpha's are blended. Better alpha support seems to be something they've been working on for a while, and this is a logical step in that direction. I don't have any proof on this statement though - it's just based on other changes I've seen with alpha's (like transparent windowing).
EDIT
This SSCCE demos both the problem and the solution:
import java.awt.*;
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
public class TransparencyDemo extends Box{
protected JPanel pGradientPane;
//Interface gradient specification
private Color pInterfaceColour = new Color(255, 245, 62);
protected int iDegreeWhite = 180;
protected int iDegreeBlack = 0;
public TransparencyDemo() {
super(BoxLayout.X_AXIS);
setOpaque(true);
//Incorrect Solution
pGradientPane = new JPanel(new GridBagLayout())
{
private static final long serialVersionUID = 1L;
protected void paintComponent(Graphics pGraphics)
{
Graphics2D pGraphicsGradientRender = (Graphics2D) pGraphics;
pGraphicsGradientRender.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255, 255, 255, iDegreeWhite), 0, getHeight(), new Color(0, 0, 0, iDegreeBlack));
pGraphicsGradientRender.setPaint(pGradient);
pGraphicsGradientRender.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(pGraphics);
}
};
pGradientPane.setOpaque(false);
add(pGradientPane);
//Correct Solution
JPanel pGradientPane2 = new JPanel(new GridBagLayout())
{
private static final long serialVersionUID = 1L;
protected void paintComponent(Graphics pGraphics)
{
Graphics2D pGraphicsGradientRender = (Graphics2D) pGraphics;
pGraphicsGradientRender.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255, 255, 255, iDegreeWhite), 0, getHeight(), new Color(255, 245, 62, iDegreeWhite));
pGraphicsGradientRender.setPaint(pGradient);
pGraphicsGradientRender.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(pGraphics);
}
};
pGradientPane2.setOpaque(false);
add(pGradientPane2);
setBackground(pInterfaceColour);
}
public static void main(String[] args){
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new TransparencyDemo());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
My guess is that it's about the 'graphics pipeline' that's being used on the different computers.
Java has several different pipelines, here is some information about them.
On my computer I can use the X11 pipeline, or the OpenGL pipeline. With the X11 pipeline the darkness occurs; on OpenGL, it doesn't.
On Windows you can choose from 3 different pipelines, and even then (looking at the link above), there can be differences.
I can't immediately imagine what's the configuration your school has, and why it's different, but you can try to investigate.
You might want to file this difference as a bug.
I have got fatamorgana, I'm sure that GradientPaint is darker and darker and darker, phaaa crazy eye illusion, brrrr
//http://stackoverflow.com/questions/13748810/gradient-problems-in-java/13806210#comment18995490_13806210
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.RepaintManager;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
public class MainLauncher {
private JFrame window = new JFrame();
public MainLauncher() {
GradientPane pane = new GradientPane();
pane.setLayout(new GridLayout(6, 4, 15, 15));
for (int i = 1; i <= 24; i++) {
pane.add(createButton(i));
}
pane.setOpaque(false);
window.add(pane);
RepaintManager.setCurrentManager(new RepaintManager() {
#Override
public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
Container con = c.getParent();
while (con instanceof JComponent) {
if (!con.isVisible()) {
return;
}
if (con instanceof GradientPane) {
c = (JComponent) con;
x = 0;
y = 0;
w = con.getWidth();
h = con.getHeight();
}
con = con.getParent();
}
super.addDirtyRegion(c, x, y, w, h);
}
});
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLocationByPlatform(true);
window.setSize(400, 300);
//window.pack();
window.setVisible(true);
}
private JButton createButton(final int text) {
JButton button = new JButton(Integer.toString(text));
return button;
}
class GradientPane extends JPanel {
private static final long serialVersionUID = 1L;
private final int h = 150;
private BufferedImage img = null;
private BufferedImage shadow = new BufferedImage(1, h, BufferedImage.TYPE_INT_ARGB);
public GradientPane() {
paintBackGround(new Color(150, 250, 150));
}
public void paintBackGround(Color g) {
Graphics2D g2 = shadow.createGraphics();
g2.setPaint(g);
g2.fillRect(0, 0, 1, h);
g2.setComposite(AlphaComposite.DstIn);
g2.setPaint(new GradientPaint(0, 0, new Color(0, 0, 0, 0f), 0, h, new Color(0.1f, 0.8f, 0.8f, 0.5f)));
g2.fillRect(0, 0, 1, h);
g2.dispose();
}
#Override
public void paintComponent(Graphics g) {
if (img == null || img.getWidth() != getWidth() || img.getHeight() != getHeight()) {
img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
}
Graphics2D g2 = img.createGraphics();
super.paintComponent(g2);
Rectangle bounds = this.getVisibleRect();
g2.scale(bounds.getWidth(), -1);
g2.drawImage(shadow, bounds.x, -bounds.y - h, null);
g2.scale(1, -1);
g2.drawImage(shadow, bounds.x, bounds.y + bounds.height - h, null);
g2.dispose();
g.drawImage(img, 0, 0, null);
}
}
public static void main(String[] args) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
#Override
public void run() {
MainLauncher ml = new MainLauncher();
}
});
}
}
As Nick pointed out, the problem is that you are using transparent black rather than transparent white. So the translucent colours are a shade between white and black.
Try replacing with this line in your code:
GradientPaint pGradient = new GradientPaint(0, 0, new Color(255, 255, 255, iDegreeWhite), 0, getHeight(), new Color(255, 255, 255, iDegreeBlack));

Categories