September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -16,21 +16,22 @@ public class Greybars extends JFrame {
|
|||
|
||||
public void paint ( Graphics g ) {
|
||||
int run = 0 ;
|
||||
int colorcomp = 0 ; //component of the color
|
||||
double colorcomp = 0.0 ; //component of the color
|
||||
for ( int columncount = 8 ; columncount < 128 ; columncount *= 2 ) {
|
||||
int colorgap = 255 / columncount ; //by this gap we change the background color
|
||||
double colorgap = 255.0 / (columncount - 1) ; //by this gap we change the background color
|
||||
int columnwidth = width / columncount ;
|
||||
int columnheight = height / 4 ;
|
||||
if ( run % 2 == 0 ) //switches color directions with every for loop
|
||||
colorcomp = 0 ;
|
||||
colorcomp = 0.0 ;
|
||||
else {
|
||||
colorcomp = 255 ;
|
||||
colorgap *= -1 ;
|
||||
colorcomp = 255.0 ;
|
||||
colorgap *= -1.0 ;
|
||||
}
|
||||
int ystart = 0 + columnheight * run ;
|
||||
int xstart = 0 ;
|
||||
for ( int i = 0 ; i < columncount ; i++ ) {
|
||||
Color nextColor = new Color( colorcomp, colorcomp, colorcomp ) ;
|
||||
int icolor = (int)Math.round(colorcomp) ; //round to nearer integer
|
||||
Color nextColor = new Color( icolor , icolor, icolor ) ;
|
||||
g.setColor( nextColor ) ;
|
||||
g.fillRect( xstart , ystart , columnwidth , columnheight ) ;
|
||||
xstart += columnwidth ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue