[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OT: oceanMenuRect()
From: |
theUser BL |
Subject: |
OT: oceanMenuRect() |
Date: |
Sat, 12 Nov 2005 14:24:51 +0000 |
I know, that it is a litte bit off topic, because it have nothing to do with
Java 1.4 (which is the current goal to be compatible with it).
But I have yesterday tried a litte bit out to create the 1.5 menu and 1.5
button as field or rect.
As I have previous said, OOP is for me something crypitic. So I have tried
to create functions, which create the color gradent of it.
At http://user.web-gear.com/theuserbl/bdraw.jar is my trying. The code in my
functions oceanMenuRect and oceanButtonRect comming from me. And all the
other code come from GNU Classpath (mostly from the AWT Demo).
At http://user.web-gear.com/theuserbl/screeny.png you can see a screenshot
of it.
As you can see, on te left side, there is a screenshot-part of a real Java
1.5 program runnig the Swing example. On the right side, I tried to recreate
the color gradient of the menu and the buttons.
oceanMenuRect(x,y,w,h,g);
and
buttonMenuRect(x,y,w,h,g);
filled exacty the same area like
g.fillRec(x,y,w,h);
I have no experiece with OOP and so, I am not sure, if my function can be
useful.
At first here my oceanMenuRect (because the files in the links I will later
delete. So this believes longer here) :
public void oceanMenuRect (int x, int y, int w, int h, Graphics g) {
double i;
double color;
Color savedColor = g.getColor();
for (i=0; i<=h-2; i++) {
color=0xff-i/h*(0xff-0xda);
if (color<0.0) color=0;
if (color>255.0) color=255;
g.setColor(new Color((int)color, (int) color, (int) color));
g.drawLine(x, y+(int)i, x+w-1, y+(int)i);
}
g.setColor(new Color(0xee,0xee,0xee));
g.drawLine(x, y+h-2, x+w-1, y+h-2);
g.setColor(new Color(0xcc,0xcc,0xcc));
g.drawLine(x, y+h-1, x+w-1, y+h-1);
g.setColor(savedColor);
}
Ok, this was very easy to create it. I wanted only to say, that I also try
now out the same for buttons.
At the moment it looks more violette as blue. :-/
Greatings
theuserbl
- OT: oceanMenuRect(),
theUser BL <=