Java 2D Graphics final TextBouncer bouncer = new
Java 2D Graphics else if (mY + mHeight >= d.height) mY = d.height - mHeight - 1; } }); } public void setSwitch(int item, boolean value) { switch(item) { case ANTIALIASING: mAntialiasing = value; break; case GRADIENT: mGradient = value; break; case SHEAR: mShear = value; break; case ROTATE: mRotate = value; break; case AXES: mAxes = value; break; default: break; } } protected Checkbox createCheckbox(String label, final int item) { Checkbox check = new Checkbox(label); check.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { setSwitch(item, (ie.getStateChange() == ie.SELECTED)); } }); return check; } public void timeStep() { Dimension d = getSize(); if (mX + mDeltaX < 0) mDeltaX = -mDeltaX; else if (mX + mWidth + mDeltaX >= d.width) mDeltaX = -mDeltaX; if (mY + mDeltaY < 0) mDeltaY = -mDeltaY; else if (mY + mHeight + mDeltaY >= d.height) mDeltaY = -mDeltaY; mX += mDeltaX; mY += mDeltaY; mTheta += Math.PI / 192; if (mTheta > (2 * Math.PI)) mTheta -= (2 * Math.PI); if (mShearX + mShearDeltaX > .5) mShearDeltaX = -mShearDeltaX; else if (mShearX + mShearDeltaX < -.5) mShearDeltaX = -mShearDeltaX; if (mShearY + mShearDeltaY > .5) mShearDeltaY = -mShearDeltaY; else if (mShearY + mShearDeltaY < -.5) mShearDeltaY = -mShearDeltaY; mShearX += mShearDeltaX; mShearY += mShearDeltaY; } public void paint(Graphics g) { Graphics2D g2 = (Graphics2D)g; setAntialiasing(g2); setTransform(g2); setPaint(g2); // Draw the string. g2.setFont(getFont()); g2.drawString(mString, mX, mY + mHeight); drawAxes(g2); } protected void setAntialiasing(Graphics2D g2) { if (mAntialiasing == false) return; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } protected void setTransform(Graphics2D g2) { page 265
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services