Somebody help me out

Ok this is a jigsaw applet that i added a timer but it keeps on blinking can someone tell me the problem?
--------Jigsaw.java--------
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
import java.util.*;
import java.awt.List;
import java.io.*;
import java.awt.image.*;
import java.awt.MediaTracker;
class JigsawCutter extends RGBImageFilter {
int dimValue,w,h,overlap;
int f0,f1,f2,f3,points[];
boolean grayScale;
public JigsawCutter(int dVal,boolean gray,int iW,int iH,int oLap,int fc0,int fc1,int fc2,int fc3,int pts[]) {
dimValue=dVal;
grayScale=gray;
overlap=oLap;
f0=fc0;
f1=fc1;
f2=fc2;
f3=fc3;
w=iW;
h=iH;
points=pts;
public int filterRGB(int x, int y, int rgb) {
int r=(rgb>>16) & 0xff;
int g=(rgb>>8) & 0xff;
int b=rgb & 0xff;
int posA,posB;
int olap2=overlap-3;
if (dimValue>0) {
if (grayScale==true) {
int tv=(int)((r+g+b)/3);
return(lightenRGB(tv,tv,tv,dimValue));
} else {
return(lightenRGB(r,g,b,dimValue));
} else {
// ********** HERE IS THE "MAIN" FILTER CODE *************
int olp=overlap/2;
int fc0=((f0>=0)?f0:0-f0);
int fc1=((f1>=0)?f1:0-f1);
int fc2=((f2>=0)?f2:0-f2);
int fc3=((f3>=0)?f3:0-f3);
if (x<olap2) {         // FACE-3
if (((y<olap2 && f0>0) || (y>=(h-olap2) && f2>0)) || ((y<fc3-olp || y>fc3+olp) && f3>0))
return(0);
else {
if ((y>=fc3-olp && y<=fc3+olp) && f3<0) {
return(holeCutter(3,fc3,x,y-(fc3-olp),r,g,b));
if ((y>=fc3-olp && y<=fc3+olp) && f3>0) {
return(stubCutter(3,fc3,x,y-(fc3-olp),r,g,b));
} if (x>=w-olap2) {    // FACE-1
if (((y<olap2 && f0>0) || (y>=(h-olap2) && f2>0)) || ((y<fc1-olp || y>fc1+olp) && f1>0))
return(0);
else {
if ((y>=fc1-olp && y<=fc1+olp) && f1<0) {
return(holeCutter(1,fc1,x-(w-overlap),y-(fc1-olp),r,g,b));
if ((y>=fc1-olp && y<=fc1+olp) && f1>0) {
return(stubCutter(1,fc1,x-(w-overlap),y-(fc1-olp),r,g,b));
} if (y<olap2) {       // FACE-0
if (((x<olap2 && f3>0) || (x>=(w-olap2) && f1>0)) || ((x<fc0-olp || x>fc0+olp) && f0>0))
return(0);
else {
if ((x>=fc0-olp && x<=fc0+olp) && f0<0) {
return(holeCutter(0,fc0,x-(fc0-olp),y,r,g,b));
if ((x>=fc0-olp && x<=fc0+olp) && f0>0) {
return(stubCutter(0,fc0,x-(fc0-olp),y,r,g,b));
} if (y>=h-olap2) {    // FACE-2
if (((x<olap2 && f3>0) || (x>=(w-olap2) && f1>0)) || ((x<fc2-olp || x>fc2+olp) && f2>0))
return(0);
else {
if ((x>=fc2-olp && x<=fc2+olp) && f2<0) {
return(holeCutter(2,fc2,x-(fc2-olp),y-(h-overlap),r,g,b));
if ((x>=fc2-olp && x<=fc2+olp) && f2>0) {
return(stubCutter(2,fc2,x-(fc2-olp),y-(h-overlap),r,g,b));
// Enhance the edges
// =================
// EDGE 0
if (((y==0 && f0<0) || (y==overlap-3 && f0>0 && (x<fc0-2 || x>fc0+2)) ))
return(darkenRGB(r,g,b,15));
else if (((y==1 && f0<=0) || (y==overlap-2 && f0>0 && (x<fc0-2 || x>fc0+2)) ))
return(lightenRGB(r,g,b,20));
else if (((y==2 && f0<=0) || (y==overlap-1 && f0>0 && (x<fc0-2 || x>fc0+2)) ))
return(lightenRGB(r,g,b,15));
// EDGE 1
if (((x==(w-1) && f1<=0) || (((w-1)-x)==overlap-3 && f1>0 && (y<fc1-2 || y>fc1+2)) ))
return(lightenRGB(r,g,b,20));
// EDGE 2
if (((y==(h-1) && f2<=0) || (((h-1)-y)==overlap-3 && f2>0 && (x<fc2-2 || x>fc2+2)) ))
return(lightenRGB(r,g,b,20));
// EDGE 3
if (((x==0 && f3<0) || (x==overlap-3 && f3>0 && (y<fc3-2 || y>fc3+2)) ))
return(darkenRGB(r,g,b,15));
else if (((x==1 && f3<=0) || (x==overlap-2 && f3>0 && (y<fc3-2 || y>fc3+2)) ))
return(lightenRGB(r,g,b,20));
else if (((x==2 && f3<=0) || (x==overlap-1 && f3>0 && (y<fc3-2 || y>fc3+2)) ))
return(lightenRGB(r,g,b,15));
else
return(rgb);
private int holeCutter(int face,int fcID,int x,int y,int r,int g,int b) {
int ol=overlap/2;
int tp1=0,tp2=0,p1=0,p2=0;
x++;
switch (face) {
case 0: tp1=y; tp2=x-1; p1=0; p2=3; break;
case 1: tp2=y-1; tp1=x-3; p1=0; p2=2; break;
case 2: tp1=y-2; tp2=x-1; p1=0; p2=2; break;
case 3: tp2=y-1; tp1=x-1; p1=0; p2=3; break;
if (tp1>=p1 && (tp1+p2)<22) {
if ((tp2>ol-points[tp1+p2]) && (tp2<ol+points[tp1+p2])) {
//return(0xffff0000);
return(0);
} else if ((tp2>=ol-points[tp1+p2]) && (tp2<=ol+points[tp1+p2])) {
return(darkenRGB(r,g,b,30));
//return(0xffffff00);
return (0xff000000 | (r << 16) | (g << 8) | (b << 0));
private int stubCutter(int face,int fcID,int x,int y,int r,int g,int b) {
int ol=overlap/2;
int tp1=0,tp2=0,p1=0,p2=0;
x++;
switch (face) {
case 0: tp1=y; tp2=x-1; p1=0; p2=3; break;
case 1: tp2=y-1; tp1=x-3; p1=0; p2=2; break;
case 2: tp1=y-2; tp2=x-1; p1=0; p2=2; break;
case 3: tp2=y-1; tp1=x-1; p1=0; p2=3; break;
if (tp1>=p1 && (tp1+p2)<23) {
if ((tp2>ol-points[tp1+p2]) && (tp2<ol+points[tp1+p2])) {
//return(0xffffff00);
return (0xff000000 | (r << 16) | (g << 8) | (b << 0));
} else if ((tp2>=ol-points[tp1+p2]) && (tp2<=ol+points[tp1+p2])) {
return(lightenRGB(r,g,b,30));
//return(0xffff0000);
return(0);
private int darkenRGB(int r,int g,int b,int perc) {
if ((r=(r*(100-perc)/100)-10)<0) r=0;
if ((g=(g*(100-perc)/100)-10)<0) g=0;
if ((b=(b*(100-perc)/100)-10)<0) b=0;
return (0xff000000 | (r << 16) | (g << 8) | (b << 0));
private int lightenRGB(int r,int g,int b,int perc) {
if ((r=10+(255-((255-r)*(100-perc)/100)))>255) r=255;
if ((g=10+(255-((255-g)*(100-perc)/100)))>255) g=255;
if ((b=10+(255-((255-b)*(100-perc)/100)))>255) b=255;
return (0xff000000 | (r << 16) | (g << 8) | (b << 0));
class JigsawPiece extends Canvas {
Image img;
int xPos,yPos,basePosX,basePosY,jPosX,jPosY,sizeW,sizeH,overlap,orient;
Random rNum=new Random();
int fc[];
JigsawPiece(Image baseImage,int oLap,int x,int y,int w,int h,int x1,int y1,int x2,int y2,int f0,int f1,int f2,int f3,int pts[],int orientation) {
basePosX=x+(jPosX=x1);
basePosY=y+(jPosY=y1);
xPos=x2;
yPos=y2;
fc=new int[4];
fc[0]=f0;
fc[1]=f1;
fc[2]=f2;
fc[3]=f3;
orient=orientation;
if (f0>0) {
if (f1!=0) {
if (f1>0) f1+=(oLap-3);
else f1-=(oLap-3);
if (f3!=0) {
if (f3>0) f3+=(oLap-3);
else f3-=(oLap-3);
if (f3>0) {
if (f0!=0) {
if (f0>0) f0+=(oLap-3);
else f0-=(oLap-3);
if (f2!=0) {
if (f2>0) f2+=(oLap-3);
else f2-=(oLap-3);
JigsawCutter jc=new JigsawCutter(0,false,sizeW=w,sizeH=h,overlap=oLap,f0,f1,f2,f3,pts);
Image tImg=createImage(new FilteredImageSource(baseImage.getSource(),new CropImageFilter(x,y,w,h)));
img=createImage(new FilteredImageSource(tImg.getSource(),jc));
setVisible(false);
public void setPosition(int x,int y) {
xPos=x;
yPos=y;
public void setOrientation(int orientation) {
if (orientation==0)
orient=0;
else {
orient+=1;
if (orient>3)
orient=0;
public Image getPiece() { return(img);  }
public int getX() { return(xPos); }
public int getY() { return(yPos); }
public int getW() { return(sizeW); }
public int getH() { return(sizeH); }
public int getBaseX() { return(basePosX); }
public int getBaseY() { return(basePosY); }
public int getFace(int f) { return(fc[f]); }
public int getOrientation() { return(orient); }
public boolean isOver(int mX,int mY) {
//if ((mX>=xPos+overlap && mX<=(xPos+sizeW)-overlap) && (mY>=yPos+overlap && mY<=(yPos+sizeH)-overlap))
if ((mX>=xPos && mX<=(xPos+sizeW)) && (mY>=yPos && mY<=(yPos+sizeH)))
return(true);
else
return(false);
public class Jigsaw extends Applet implements Runnable,ActionListener,MouseListener,MouseMotionListener,WindowListener {
int      wSize,hSize,rows,cols,iWidth,iHeight,jPosX,jPosY,appW,appH,hlpImgFade=-1;
boolean hlpImgGray=false,avoidCenter=false,canRotate=false,keepClear=false;
int      autoSnap=3,cutting=0,ts=0,overlap=16,totalPieces,points[],w=0,h=0,vAlign=1;
Color bgColor=Color.lightGray;
Color txColor=Color.black;
Color ofColor=Color.black;
Color ifColor=Color.black;
Color pkColor=Color.red;
Color bdColor=new Color(0xffbfbf);
boolean showSolve=true;
Thread runner=null;
AppletContext apc;
boolean bDoneSolve=false;
boolean isComplete=false;
boolean bImageLoaded=false;
MediaTracker tracker=new MediaTracker(this);
int selID=0;
boolean bCanReorder=true;
boolean bAutoShow=true;
Graphics offScrGr;
Image      offScrImg,img1=null,tImg=null,aImg=null;
String      imgName,sRunURL,sRunTarget;
String t[];
int iOrder[];
JigsawPiece      jp[],selPP=null;
Random rNum=new Random();
int xmOff=0,ymOff=0;
Label l1,l2,l3;
Button b1,b2,b3,b4;
int iNumPieces;
//Timer2     time;
Thread Clock_animation;
private Image Buffer;
private Graphics gBuffer;
long currTime;
long startTime;
long diffTime;
long pauseValue;
long timeSet;
int hours;
int minutes;
int seconds;
int runner2;
int soundRunner;
boolean pressedStart;
boolean pressedStop;
boolean pressedReset;
boolean pressedEnlarge;
boolean countDown;
boolean paused;
boolean enlarged;
boolean running;
boolean playSound;
boolean input;
boolean blink;
boolean framed;
boolean soundDelay;
int ox;
int oy;
double radians;
double cos;
double sin;
Font font1;
Font font2;
Font font3;
Font font4;
Font font5;
Color color1;
Color color2;
Color bgColor2;
SpinButton sb1;
SpinButton sb2;
SpinButton sb3;
CheckBox cb1;
CheckBox cb2;
CheckBox cb3;
String message;
public int STEP_SIZE=20;
public synchronized void start() {
if(Clock_animation == null)
Clock_animation = new Thread(this);
Clock_animation.start();
//     StartTimer();
runner = new Thread();
runner.start();
     public Jigsaw()
cos = 1.0D;
font1 = new Font("Dialog", 0, 14);
font2 = new Font("Dialog", 1, 11);
font3 = new Font("Helvetica", 1, 25);
font4 = new Font("Helvetica", 1, 9);
font5 = new Font("Helvetica", 1, 16);
color1 = new Color(25, 55, 135);
color2 = new Color(225, 225, 225);
bgColor2 = new Color(0, 0, 0);
void CalculateTime()
currTime = System.currentTimeMillis();
if(!countDown)
diffTime = (currTime - startTime) / 1000L + pauseValue;
else
diffTime = (timeSet - (currTime - startTime)) / 1000L - pauseValue;
hours = (int)(diffTime - diffTime % 3600L) / 3600;
minutes = (int)((diffTime - diffTime % 60L) / 60L) % 60;
seconds = (int)diffTime % 60;
System.out.println("Time:"+diffTime);
void StartTimer()
long h = sb1.GetNumber();
long m = sb2.GetNumber();
long s = sb3.GetNumber();
timeSet = (h * 3600L + m * 60L + s) * 1000L;
if((!running || paused) && (timeSet != 0L || !countDown))
paused = false;
running = true;
startTime = System.currentTimeMillis();
void StopTimer()
if(running)
if(!paused)
if(!countDown)
pauseValue = diffTime;
else
pauseValue = (currTime - startTime) / 1000L + pauseValue;
paused = true;
void ResetTimer()
running = false;
pauseValue = diffTime = 0L;
startTime = System.currentTimeMillis();
if(countDown)
long h = sb1.GetNumber();
long m = sb2.GetNumber();
long s = sb3.GetNumber();
timeSet = (h * 3600L + m * 60L + s) * 1000L;
hours = (int)h;
minutes = (int)m;
seconds = (int)s;
} else
hours = minutes = seconds = 0;
void DrawClock()
/* if(!blink)
gBuffer.setColor(Color.red);
else*/
//gBuffer.setColor(Color.white);
//gBuffer.fillRoundRect(38, 45, 112, 30, 15, 15);
//gBuffer.setFont(font3);
/* if(!blink)
gBuffer.setColor(Color.white);
else*/
//gBuffer.setColor(Color.black);
String s1;
if(hours < 10)
s1 = "0";
else
s1 = "";
String s2;
if(minutes < 10)
s2 = "0";
else
s2 = "";
String s3;
if(seconds < 10)
s3 = "0";
else
s3 = "";
String output = s1 + hours + ":" + s2 + minutes + ":" + s3 + seconds;
if(output.length() <= 8)
          l3.setText(output);
//gBuffer.drawString(output, 45, 69);
else
l3.setText("00:00:00");
//gBuffer.drawString("00:00:00", 45, 69);
public synchronized void stop() {
runner = null;
if(Clock_animation != null)
Clock_animation.stop();
Clock_animation = null;
StopTimer();
public void run() {
Thread me = Thread.currentThread();
repaint();
dloadImage(imgName);
repaint();
try {
tracker.waitForID(0);
} catch (InterruptedException e) {
return;
cutupPicture(tImg);
repaint();
try {
tracker.waitForAll();
} catch (InterruptedException e) {
return;
breakupPuzzle(false);
repaint();     
addMouseListener(this);
addMouseMotionListener(this);
do
try
Thread.sleep(100L);
catch(Exception exception) { }
runner2++;
if(runner2 > 5)
     runner2 = 0;
//if(runner2 < 3)
//blink = true;
//else
// blink = false;
sb1.Update();
sb2.Update();
sb3.Update();
DrawClock();
if(!paused && running)
CalculateTime();
repaint();
} while(true);
public void init() {
Buffer = createImage(size().width, size().height);
gBuffer = Buffer.getGraphics();
font1 = new Font("Dialog", 1, 14);
sb1 = new SpinButton(99);
sb2 = new SpinButton(59);
sb3 = new SpinButton(59);
currTime = startTime = diffTime = pauseValue = timeSet = 0L;
//message = getParameter("timer_name");
/*String clockColorStr = getParameter("clock_color");
String r = clockColorStr.substring(0, 2);
String g = clockColorStr.substring(2, 4);
String b = clockColorStr.substring(4);
int rt = Integer.parseInt(r, 16);
int gr = Integer.parseInt(g, 16);
int bl = Integer.parseInt(b, 16);
color1 = new Color(rt, gr, bl);
String bgColorStr = getParameter("bg_color");
r = bgColorStr.substring(0, 2);
g = bgColorStr.substring(2, 4);
b = bgColorStr.substring(4);
rt = Integer.parseInt(r, 16);
gr = Integer.parseInt(g, 16);
bl = Integer.parseInt(b, 16);
bgColor2 = new Color(rt, gr, bl);*/
StartTimer();
sRunURL=null;
sRunTarget=null;
//apc=this.getAppletContext();
if (aImg != null)
aImg.flush();
removeMouseListener(this);
removeMouseMotionListener(this);
Cursor btnCursor=new Cursor(Cursor.HAND_CURSOR);
appW=getBounds().width;
appH=getBounds().height;
offScrImg = createImage(appW, appH);
offScrGr = offScrImg.getGraphics();
setLayout(new FlowLayout(FlowLayout.LEFT,3,3));
t=new String[4];
t[0]=new String("Breakup");
t[1]=new String("Tidy Pieces");
t[2]=new String("Solve");
t[3]=new String(" Jigsaw solved ! ");
readParams();
if (STEP_SIZE==0)
STEP_SIZE=makeStepSize(iWidth,iHeight,rows,cols);
// add(b4=new Button("?"));
add(l3=new Label("00:00:00"));
add(b1=new Button(t[0]));
add(l2=new Label(""));
add(b2=new Button(t[1]));
if (showSolve==true) {
add(b3=new Button(t[2]));
b3.setCursor(btnCursor);
b3.addActionListener(this);
add(l1=new Label(t[3]));
//sb1 = new SpinButton(110, 280, 99);
// sb2 = new SpinButton(110, 300, 59);
//sb3 = new SpinButton(110, 320, 59);
//add(time=new Timer2());
//l1.setVisible(false);
b1.setCursor(btnCursor);
b2.setCursor(btnCursor);
//b4.setCursor(btnCursor);
// b4.setFont(new Font("helvetica",Font.BOLD,13));
//b4.setForeground(Color.white);
//b4.setBackground(Color.darkGray);
b1.addActionListener(this);
b2.addActionListener(this);
//b4.addActionListener(this);
setBackground(bgColor);
l1.setBackground(bgColor);
l2.setBackground(bgColor);
l1.setForeground(txColor);
l3.setFont(font1);
l3.setBackground(bgColor);
l3.setForeground(txColor);
     DrawClock();
validateKeepClear();
points=new int[STEP_SIZE+1];
int lc=0;
for (double t=0; t<Math.PI; t+=(Math.PI/STEP_SIZE),lc++) {
double dv=Math.sin(t);
points[lc]=(int) ((double)((STEP_SIZE-2)/2)*dv);
totalPieces=rows*cols;
jPosX=appW-iWidth-7;
//jPosX=(appW/2)-(iWidth/2);
switch (vAlign) {
case 0: jPosY=5; break;
case 4: jPosX=(appW/2)-(iWidth/2);
case 1: jPosY=(appH/2)-(iHeight/2); break;
case 2: jPosY=appH-iHeight-6; break;
case 3: jPosY=34; break;
iNumPieces=rows*cols;
jp=new JigsawPiece[iNumPieces];
iOrder= new int[iNumPieces];
System.out.println("Renumber="+iNumPieces);
repaint();
public void destroy() {
if (aImg != null)
aImg.flush();
b1.removeActionListener(this);
b2.removeActionListener(this);
b3.removeActionListener(this);
//b4.removeActionListener(this);
removeMouseListener(this);
removeMouseMotionListener(this);
public void actionPerformed(ActionEvent e) {
String aCmd=e.getActionCommand();
if (aCmd.equals(t[2])) {
for (int r=0; r<rows; r++) {
for (int c=0; c<cols; c++) {
JigsawPiece pJP=jp[(r*cols)+c];
pJP.setPosition(pJP.getBaseX(),pJP.getBaseY());
pJP.setOrientation(0);
if (aCmd.equals(t[0])) {
breakupPuzzle(false);
if (aCmd.equals(t[1])) {
breakupPuzzle(true);
// if (aCmd.equals("?")) {
//showAbout();
repaint();
private int makeStepSize(int iW,int iH, int iR,int iC) {
int iRetVal=16;
int iPieceW=(int)(iW/iC);
int iPieceH=(int)(iH/iR);
int iWork =(iPieceW>iPieceH)?iPieceH:iPieceW;
if (iWork<28) iRetVal=10;
else if (iWork<35) iRetVal=12;
else if (iWork<43) iRetVal=14;
else if (iWork<50) iRetVal=16;
else if (iWork<60) iRetVal=18;
else if (iWork<70) iRetVal=20;
else if (iWork<80) iRetVal=22;
else iRetVal=24;
return iRetVal;
private void validateKeepClear() {
w=iWidth/cols;
h=iHeight/rows;
int iLeftW=(appW-iWidth-20-overlap);
int iTopW =(appH-iHeight-20-overlap);
int iPieceW=(int)(iWidth/cols);
int iPieceH=(int)(iHeight/rows);
int iWork=(iPieceW>iPieceH)?iPieceW:iPieceH;
if ((iWork+5>iLeftW) && (iWork+5> iTopW)) {
keepClear=false;
b2.setVisible(false);
private void breakupPuzzle(boolean onlyTidy) {
int sPosX=0,sPosY=0;
int tX=0,tY=0;
for (int r=0; r<rows; r++) {
if (bCanReorder)
reorderList((int)(rNum.nextDouble()*iNumPieces));
for (int c=0; c<cols; c++) {
boolean doMe=true;
JigsawPiece j=jp[(r*cols)+c];
if (onlyTidy==true) {
tX=j.getX();
tY=j.getY();
if (tX>=jPosX && tX<=((jPosX+iWidth)-w) && tY>=jPosY && tY<=((jPosY+iHeight)-h))
doMe=false;
if (doMe==true) {
do {
if (!onlyTidy && canRotate) {
j.setOrientation((int)(rNum.nextDouble()*3));
sPosX=(int)(rNum.nextDouble()*(appW-w-20-overlap))+10;
sPosY=(int)(rNum.nextDouble()*(appH-h-20-overlap))+10;
} while ((keepClear || onlyTidy) && ((sPosX>(jPosX-w-overlap)) && sPosY>=jPosY-h-overlap && sPosY<=jPosY+iHeight));
j.setPosition(sPosX,sPosY);
public void dloadImage(String ImgName) {
try {
synchronized(this) {
tImg=(aImg=getImage(new URL(getDocumentBase(),ImgName)).getScaledInstance(iWidth,iHeight,Image.SCALE_FAST));
tracker.addImage(tImg,0);
if (hlpImgFade>-1) {
img1=createImage(new FilteredImageSource(tImg.getSource(),new JigsawCutter(hlpImgFade,hlpImgGray,0,0,0,0,0,0,0,points)));
//cutupPicture(tImg);
repaint();
} catch (MalformedURLException mfue) {
System.out.println("MalformedURLException: " + mfue);
private void readParams() {
String vStr;
//clrParam=Color.decode(vStr);
imgName=getParameter("Image");
if ((vStr=getParameter("ImgWidth")) !=null) iWidth =new Integer(vStr).intValue();
if ((vStr=getParameter("ImgHeight")) !=null) iHeight=new Integer(vStr).intValue();
if ((vStr=getParameter("Rows")) !=null) rows=new Integer(vStr).intValue();
if ((vStr=getParameter("Cols")) !=null) cols=new Integer(vStr).intValue();
if ((vStr=getParameter("DimHelpImage")) !=null) hlpImgFade=new Integer(vStr).intValue();
if ((vStr=getParameter("HelpImageGrayed")) !=null) if (vStr.equals("true")) hlpImgGray=true;
if ((vStr=getParameter("AutoSnap")) !=null) autoSnap=new Integer(vStr).intValue();
if ((vStr=getParameter("CanRotate")) !=null) if (vStr.equals("true")) canRotate=true;
if ((vStr=getParameter("KeepBoardClear")) !=null) if (vStr.equals("true")) keepClear=true;
if ((vStr=getParameter("BgColor")) !=null) bgColor=Color.decode(vStr);
if ((vStr=getParameter("TextColor")) !=null) txColor=Color.decode(vStr);
if ((vStr=getParameter("OuterFrameColor")) !=null) ofColor=Color.decode(vStr);
if ((vStr=getParameter("InnerFrameColor")) !=null) ifColor=Color.decode(vStr);
if ((vStr=getParameter("BoardColor")) !=null) bdColor=Color.decode(vStr);
if ((vStr=getParameter("SelectColor")) !=null) pkColor=Color.decode(vStr);
if ((vStr=getParameter("BreakupText")) !=null) t[0]=new String(vStr);
if ((vStr=getParameter("TidyText")) !=null) t[1]=new String(vStr);
if ((vStr=getParameter("SolveText")) !=null) t[2]=new String(vStr);
if ((vStr=getParameter("MessageText")) !=null) t[3]=new String(vStr);
if ((vStr=getParameter("RunURL")) !=null) sRunURL=new String(vStr);
if ((vStr=getParameter("RunTarget")) !=null) sRunTarget=new String(vStr);
if ((vStr=getParameter("AllowSolve")) !=null) if (vStr.equals("false")) showSolve=false;
if ((vStr=getParameter("LosePieces")) !=null) if (vStr.equals("true")) bCanReorder=false;
if ((vStr=getParameter("AutoShowPieces")) !=null) if (vStr.equals("false")) bAutoShow=false;
if ((vStr=getParameter("PictureAlign")) !=null) {
if (vStr.equals("top")) vAlign=0;
if (vStr.equals("spaced")) vAlign=3;
if (vStr.equals("bottom")) vAlign=2;
if (vStr.equals("center")) vAlign=4;
if ((vStr=getParameter("Connector")) !=null) {
switch(new Integer(vStr).intValue()) {
case -1: STEP_SIZE= 0; break;
case 0: STEP_SIZE=16; break;
case 1: STEP_SIZE=18; break;
case 2: STEP_SIZE=20; break;
case 3: STEP_SIZE=22; break;
case 4: STEP_SIZE=24; break;
if (autoSnap<0) autoSnap=0;
if (autoSnap>15) autoSnap=15;
if (hlpImgFade>100) hlpImgFade=100;
public void cutupPicture(Image baseImg) {
int pID=0,xPos=0,yPos=0,xOff=0,yOff=0,yOvr=0,xOvr=0;
int sPosX=0,sPosY=0;
int lastAdjX,xAdj;
int f[]=new int[4];
int CxPos=w/2;
int CyPos=h/2;
int bxOffset=0,byOffset=0;
overlap=STEP_SIZE-2;
for (int r=0; r<rows; r++) {
xPos=0;
for (int c=0; c<cols; c++) {
do {
sPosX=(int)(rNum.nextDouble()*(appW-w-10))+5;
sPosY=(int)(rNum.nextDouble()*(appH-h-10))+5;
} while (((sPosX<jPosX+iWidth+5 && sPosX>jPosX-w-5) && (sPosY<jPosY+iHeight+5 && sPosY>jPosY-h-5)) && avoidCenter);
if (r==0) {       // FACE- 0
f[0]=0;
} else {
JigsawPiece pJP=jp[((r-1)*cols)+(c)];
f[0]=0-pJP.getFace(2);
if (c==cols-1) {  // FACE-1
f[1]=0;
} else {
f[1]=((h)/2);
if (((rNum.nextDouble()*2)-1)<0)
f[1]=0-f[1];
if (f[0]>0) {
if (f[1]>0) f[1]+=(overlap-3);
else f[1]-=(overlap-3);
if (r==rows-1) {  // FACE-2
f[2]=0;
} else {
f[2]=((w)/2);
if (((rNum.nextDouble()*2)-1)<0)
f[2]=0-f[2];
if (c==0) {       // FACE- 3
f[3]=0;
} else {
JigsawPiece pJP=jp[((r)*cols)+(c-1)];
f[3]=0-pJP.getFace(1);
int o[]=new int[4];
for (int cnt=0; cnt<4; cnt++) {
o[cnt]=(f[cnt]>0)?overlap-3:0;
int orientation=(canRotate)?(int)(rNum.nextDouble()*3):0;
jp[pID]=new JigsawPiece(baseImg,overlap,xPos-o[3],yPos-o[0],w+o[3]+o[1],h+o[0]+o[2],jPosX,jPosY,sPosX,sPosY,f[0],f[1],f[2],f[3],points,orientation);
iOrder[pID]=pID;
tracker.addImage(jp[pID].getPiece(),pID+1);
pID++;
xPos+=w;
yPos+=h;
cutting=0;
private void reorderList(int iTopPiece) {
boolean bFound=false;
if (iTopPiece>iNumPieces)
iTopPiece=iNumPieces;
if (iOrder[iNumPieces-1]!=iTopPiece) {
System.out.println("looking for "+iTopPiece);
for (int i=0; i<iNumPieces-1; i++) {
if (!bFound && iOrder==iTopPiece)
bFound=true;
if (bFound==true)
iOrder[i]=iOrder[i+1];
if (bFound)
iOrder[iNumPieces-1]=iTopPiece;
public void randomizePosition(JigsawPiece j,boolean avoidMiddle) {
int w=iWidth/cols;
int h=iHeight/rows;
int sPosX=0,sPosY=0;
do {
sPosX=(int)(rNum.nextDouble()*(appW-w-20-overlap))+10;
sPosY=(int)(rNum.nextDouble()*(appH-h-20-overlap))+10;
} while ((sPosX<jPosX+iWidth+5+overlap && sPosX>jPosX-w-5) && (sPosY<jPosY+iHeight+5+overlap && sPosY>jPosY-h-5) && avoidMiddle);
j.setPosition(sPosX,sPosY);
//public void start() {
// repaint();
/*public void update(Graphics g) {
paint(g);
public void paint(Graphics g) {
     g.drawImage(Buffer, 0, 0, this);
int pID=0;
isComplete=true;
offScrGr.setColor(bgColor);
offScrGr.fillRect(0,0,appW,appH);
offScrGr.setColor(ofColor);
offScrGr.drawRect(0,0,appW-2,appH-2);
if (img1 != null)
offScrGr.drawImage(img1,jPosX,jPosY,this);
else {
offScrGr.setColor(bdColor);
offScrGr.fillRect(jPosX,jPosY,iWidth,iHeight);
offScrGr.setColor(ifColor);
offScrGr.drawRect(jPosX-1,jPosY-1,iWidth+2,iHeight+2);
for (pID=0; pID<iNumPieces; pID++) {
JigsawPiece j=jp[iOrder[pID]];
int xP=j.getX(),yP=j.getY();
if (tracker.statusID(iOrder[pID]+1, false) == MediaTracker.COMPLETE) {
Image img=j.getPiece();
int iWd=img.getWidth(this);
int iHt=img.getHeight(this);
switch(j.getOrientation()) {
case 0: offScrGr.drawImage(img,xP,yP,this); break;
case 1: offScrGr.drawImage(img,xP,yP,xP+iWd,yP+iHt,iWd,0,0,iHt,this); break;
case 2: offScrGr.drawImage(img,xP,yP,xP+iWd,yP+iHt,iWd,iHt,0,0,this); break;
case 3: offScrGr.drawImage(img,xP,yP,xP+iWd,yP+iHt,0,iHt,iWd,0,this); break;
if (isComplete) {
if (xP!=j.getBaseX() || yP!=j.getBaseY() || j.getOrientation()!=0)
isComplete=false;
if (selPP != null) {
int xP=selPP.getX(),yP=selPP.getY();
if (!bCanReorder || bAutoShow) {
Image img=selPP.getPiece();
int iWd=img.getWidth(thi

what happens when you uncomment this?/*public void update(Graphics g) {
paint(g);

Similar Messages

  • I connected my brand new iPod Classic 160 GB to my brand new Sony home entertainment system through the headphone jack (to the audio line in). The volume is ridiculously low. Can somebody help me out here?

    I connected my brand new iPod Classic 160 GB to my brand new Sony home entertainment system through the headphone jack (to the audio line in). The volume is ridiculously low. Can somebody help me out here?

    Make sure the volume on the iPod is turned up fully, since this will affect what you hear through the stereo.
    Make sure Volume Limit is set to full. (From Main Menu, Settings/Volume Limit)
    If you purchased your iPod inside the EU (European Union), then the maximum volume from the headphone jack is lower than elsewhere in the world. If this is the case, buy yourself a 30-pin Dock Connector to 3.5mm jack lead, such as the one linked here...
    http://www.amazon.co.uk/Decrescent-Connector-Stereo-Auxiliary-iPhone/dp/B007NIE5 EE/ref=sr_1_1?ie=UTF8&qid=1386012456&sr=8-1&keywords=30+pin+to+3.5mm
    That connector will take a higher volume out (than the European Union's output) and that will be louder (and hopefully loud enough) through your stereo.

  • Can somebody help me out? I need a Corel Draw (.cdr) graphic converted to Illustrator

    I'm trying to get a logo from brandsoftheworld.com but the one I want is in .CDR. I don't have Corel Draw (who does anymore) but I see that Illustrator 6 can open it. Unfortunately, I'm still on CS5.5. Can somebody help me out?

    Send it to me. I'll save it as an EPS file for you.
    Bob AT theindesignguy DOT com
    TwitchOSX <mailto:[email protected]>
    Thursday, January 24, 2013 7:11 PM
    >
          Can somebody help me out? I need a Corel Draw (.cdr) graphic
          converted to Illustrator
    created by TwitchOSX <http://forums.adobe.com/people/TwitchOSX> in
    /InDesign/ - View the full discussion
    <http://forums.adobe.com/message/5020999#5020999

  • Somebody help me out here!!!!!!! I cant figure out how to play games on mac

    evertime i put a pc game in it asks me to look for a file to open it and its onlys the system profiler and it dont work how the **** do you play games on the mac book pRO!!somebody help me out it!!!!

    The issue is that you are attempting to run software written for one operating system (Microsoft Windows) on another (Mac OS X). That doesn't work... However, that doesn't mean you're out of luck:
    1. Many popular PC games also happen to be available native for the Mac. Check if the particular games you want to play have a native Mac version. If they do, using that is best since it's easier to install and use and will perform best.
    2. Failing that, you can actually run Windows on the Mac in order to run the game. There are two supported methods to do this: dual-booting (selecting which environment to use when you start the computer), or virtualization (running Windows as an OS X application).
    For games, particularly ones heavily reliant on 3D graphics, dual-boot is currently the best option. This is accomplished using an application called "Boot Camp" (search the Apple site) to setup disk space for the two operating systems and installing a menu that appears when you boot where you can select which operating system to run. Any Windows game will run in this way (assuming you otherwise meet the hardware requirements of the game).
    The alternative is virtualization, and there are two packages for that: Parallels and VMWare Fusion (in beta testing). Both will eventually support hardware accelerated 3D, but its not really functional in either yet. However, these applications run Windows as an application under Mac OS X, meaning that you can be running the Windows and Mac OS X applications at the same time (as opposed to Boot Camp, where you have to select at boot time which to run).
    Note that all of the approaches require you to have a copy of Windows to install (preferably a legally licensed one). Most people don't have a copy to use since they receive a hardware-locked OEM version with their computer that isn't transferable.
    The advice above is applicable to Linux as well.

  • HT4623 after updating my iphone 3gs from os 4 to os 5.1.1, it left with activating the phone but i've been trying since and is still not activating, the notification given is ''activition server temporarly unavilable". can somebody help me out?

    after updating my iphone 3gs from os 4 to os 5.1.1, it left with activating the phone but i've been trying since and is still not activating, the notification given is ''activition server temporarly unavilable". can somebody help me out?

    First use JPanel not Panel.
    Panel panels[]=new Panel[4];becomes
    JPanel panels[]=new JPanel[4];Then refactor your code so that you use arrays correctly:
    panels=new Panel();
    panels.setLayout(new FlowLayout(FlowLayout.LEFT));becomes
    panels=new JPanel();
    panels[i].setLayout(new FlowLayout(FlowLayout.LEFT));
    I did the above changes to your code and it worked fine.
    Dave

  • Can somebody help me out please?

    I have no clue in php or mysql. Just tinker with 'free' softwares that makes my life interesting and learning.
    I am trying to use this software:
    http://stanxterm.aecom.yu.edu/secondary/stocks/index.php
    Which uses http://www.dadabik.org
    I installed. Everything looks fine. But when I go to admin.php, my pages are blank-white. With the following errors:
    Notice: Undefined variable: head_extra in ./header.php on line 110
    Laboratory of so and so - Laboratory of so and so - Lab inventory
    Notice: Undefined variable: log_status in ./header.php on line 129
    Notice: Undefined variable: business_logic_included in ./interface_creator/check_login.php on line 58
    Warning: Cannot modify header information - headers already sent by (output started at ./header.php:76) in ./interface_creator/check_login.php on line 63
    And in other places, there are many errors. like
    Notice: Undefined variable: table in ./header.php on line 133
    Could somebody please help me out?
    Thanks,
    drb

    Have you read the application README file and confirmed that you meet all the requirements for installing it? The best place to start would be your apache error_log, which on some systems is located in /var/log/httpd/error_log .. (assuming you're using Linux).
    Just as a side note, I tried using dadabik one time, and I couldn't get it working right away.. it wasn't setup to handle the 10g "easy" connection format, and the traditional connection format wasn't working, either. I had to hack around in a few of the scripts to get it running, at which point I was underwhelmed with what it could do. It requires one of the "magic quotes" settings to be turned on, which can be a security risk in certain situations.

  • Hi.. I keep getting error message " No sim card installed " .. Can somebody help me out in this issue ? please

    This message keeps coming almost now regularly too often .. Please somebody help me how to solve this .. I have tried removing the sim card but it is of no use ..

    Hello henry lfrommiami,
    Thanks for using Apple Support Communities.
    To troubleshoot this issue where your iPhone gives you the message "No SIM Card installed" please follow the steps below.
    Update your iPhone to the latest version of iOS.
    Turn airplane mode on and then off again.
    Restart your iPhone.
    Check for a carrier settings update. Go to Settings > General > About. Install any available update.
    Remove the SIM card and make sure that it's a valid SIM that your carrier provided. Also make sure that it's not damaged, worn, or modified. Then reinsert it.
    A SIM tray that comes with one iPhone model won't necessarily work with a different iPhone model. When you insert the correct SIM tray, the SIM tray should be flush with the device.
    If you have another SIM card, insert it. You can use a SIM card from any phone with the same format as your iPhone SIM card. If your iPhone works with that SIM card, contact the carrier that issued your original SIM card.
    Restore the iPhone.
    If you still see the issue, contact Apple support.
    If you see 'No SIM' alert on iPhone
    Cheers,
    Alex H.

  • Itunes 64 bit wont install on my Dell XPS due to Windows Installer problems. Can somebody help me out with this?

    I have Windows 7 home premium, running on a Dell XPS 15, with 64 bit OS, and when i went to install itunes for my new phone, it would almost install, but then say that it couldn't install due to issues with windows Installer. has anybody had this happen to them? can anybody help me out with this?

    Many thanks.
    "There is a problem with this Windows Installer Package. A program required for this install to complete could not be run. Contact your support personnel or package vendor".
    Perhaps let's first try updating your Apple Software Update.
    Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
    If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time?

  • Please, somebody help me out if possible!

    So i had a blackberry curve 9300 then it broke so when my girlfriend updated to a newer version she gave me her old one but the problem starts here :/
    The blackberry ID on both the phone i have now and the phone my girlfriend has are the same and when i try and change the ID on my phone it changes on hers! really annoying me now and i dunno what to do + i updated my version of BBM and it wont work because of my ID
    Any ideas how i could change it without messing up hers?

    Ill give it a go tomorrow, is this the only way? 
    Cheers man, ill let you know how i get on! 

  • Can somebody help me with Siebel and Fusion Integration

    Hi,
    I want to integrate Siebel with BPEL.
    I can't use the Oracle AS adapter available for Siebel for integration purpose.
    I have to integrate using web services.
    Can somebody help me out with any document of integration BPEL with Siebel using WebServices??

    Hi,
    Find attached the link/note for integration of BPEL with Siebel, hope this will be useful
    http://download-east.oracle.com/docs/cd/B31017_01/integrate.1013/b28999/intro.htm
    Oracle® Application Server
    Adapter for Siebel User's Guide
    10g Release 3 (10.1.3.1.0)
    B28999-01
    Rgds,
    Muru

  • Can somebody help me with understanding what is OSGi & JCR and how it completes CQ5 architecture

    I am a newbie to CQ5 development and I want to understand more about JCR and OSGi concepts before I deep dive into the technology. Can somebody help me out with explaining these terms with reference to CQ5 architecture in layman terms so that I can understand them better.

    Check out
    http://dev.day.com/docs/en/cq/current/exploring/concepts.html#CQ's%20Technical%20Foundatio n
    and
    http://dev.day.com/docs/en/cq/current/exploring/concepts.html

  • Networking probs somebody help!!

    I have OSX 10.5.2 and i am having a problem locating the windows pcs over the network. Sometimes I can see the pcs automatically in the finder window. But the windows pcs do not show up every time and there inconsistency. If i try to connect using go->connect to server i can access the shared folders of the respective pc.
    Another related problem is that when i connect to server, then i can view the shared folders of the pc, but they cant see my folders despite my smb file sharing enabled and despite the read and write permission on beside the files which have been shared.
    Somebody help me out!!!

    Hello!
    Shrenique is my friend who recently switched to the Mac platform. He stays in a college hostel where no one had ever even seen Macs prior to his buying one, so he's quite helpless out there.
    I try to sort out his issues for him but I have no idea how to help with this one. If someone would be kind enough to offer a helping hand, we'd be quite grateful. This is pretty much the last resort for him.
    Thank you!

  • Can somebody help me to figure out my program

    can somebody help to to check and correct my coding. There is Run Time Error message when I compile it... the error is at the line " input = Keyboard.readInt(); " plss help ... :(
    import cs1.Keyboard;
    public class error
    public static void main(String args[])
        int i=0;
        String input;
        boolean nameIsNumber = true;
        System.out.println("Enter your name : ");
        input = Keyboard.readInt(); // <-- Error at here..
        try
           i = Integer.parseInt(input);
        catch(Exception e)
           System.out.println("Error....");
           nameIsNumber = false;
        if(nameIsNumber)
           System.out.println("Name is Number");
          Thanks in advance

    Strike that... Not thinking far enough down the 'illogicality index'....
    The reason you get a Compile time error (not a runtime error) is that I'm guessing Keyboard.getInt() returns an int and you are assigning it to a string...
    you want something like this
    import cs1.Keyboard;
    public class Error {
      public static void main(String args[]) {
        String input;
        int inputValue;
        boolean nameIsNumber;
        System.out.print("Enter your name: ");
        input = Keyboard.getString();
        try {
          inputValue = Integer.parseInt(input);
          nameIsNumber = true;
        } catch(Exception e) {
          nameIsNumber = false;
          inputValue = 0;
        if(nameIsNumber) System.out.println("Name is Number");

  • Hello. is somebody here to help me out fix a problem

    is somebody here to help me out fix a problem

    Yep, lots of people here likely can help you fix your problem, as soon as you tell us what it is.

  • I have an unlocked 3GS and it is NOT jailbroken. It ran out of battery last night and when i charged it this morning it has got stuck on the apple logo wont do anything else. My computer doesnt pick it up either! Can somebody HELP please!!!

    I have an unlocked 3GS and it is NOT jailbroken. It ran out of battery last night and when i charged it this morning it has got stuck on the apple logo wont do anything else. My computer doesnt pick it up either! Can somebody HELP please!!!
    nb. i havent updated it for a while to its running a 3. something software.

    Connect the iPhone to your computer and launch iTunes, then restart the iPhone by holding down the on/off and the home buttons until you see the Apple logo. If that don't fix you problem take a look at this link, http://support.apple.com/kb/HT1414

Maybe you are looking for