classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OT: and now oceanButtonRect()


From: theUser BL
Subject: OT: and now oceanButtonRect()
Date: Sun, 13 Nov 2005 13:52:32 +0000

Ok, oceanButtonRect() is also not so hard, if it is only approximately like Suns button.

Have a look at the new screenshot (the old one I have deleted):
http://user.web-gear.com/theuserbl/screeny2.png

And here the new executable jar-archive with the included sources:
http://user.web-gear.com/theuserbl/screeny2.png

And again. Because I let the files only temporary there, here now oceanVuttonRect():



public void oceanButtonRect (int x, int y, int w, int h, Graphics g) {
 double i;
 double red, green, blue;
 Color savedColor = g.getColor();

 for (i=0; i<=h-1; i++) {

    if (i<=h/3) {
      red=0xdd+i/(h/3)*(0xff-0xdd);
      green=0xe8+i/(h/3)*(0xff-0xe8);
      blue=0xf3+i/(h/3)*(0xff-0xf3);
    } else {
      red=0xff-(i-(h/3))/(h*2/3)*(0xff-0xb9);
      green=0xff-(i-(h/3))/(h*2/3)*(0xff-0xcf);
      blue=0xff-(i-(h/3))/(h*2/3)*(0xff-0xe5);
   }

   if (red<0.0) red=0;
   if (green<0.0) green=0;
   if (blue<0.0) blue=0;
   if (red>255.0) red=255;
   if (green>255.0) green=255;
   if (blue>255.0) blue=255;

   g.setColor(new Color((int)red, (int) green, (int) blue));
   g.drawLine(x, y+(int)i, x+w-1, y+(int)i);
 }
 g.setColor(savedColor);
}



As I have that, this is - in contrast to oceanMenuRect() - only a approximated implementation of Suns version. But to be 100% compatibe to Sun, it would be A LOT of harder to create it.

But I think, that it looks at first good enough.

Greatings
theuserbl






reply via email to

[Prev in Thread] Current Thread [Next in Thread]