表盘式时钟,并显import java.awt.*; import java.awt.event.*; import javax.swing.*; import sun.util.calendar.Gregorian; import java.util.Calendar; import java.util.GregorianCalendar; public class Clock extends JFrame implements ActionListener{ int x, y, x0, y
Java绘制不规则几何图形,比如划曲线,写字,线条随意画,如截图所示,甚至可以写出文字: 不规则图形的绘制代码: public class IrregularShapeDemo extends JFrame { GeneralPath gPath= new GeneralPath(); //GeneralPath对象实例 //构造函数 public IrregularShapeDemo() { super("不规则图形的绘制"); //调用父类构造函数 ena
主要代码:
Override
public void paintIcon(Component cmp, Graphics g, int x, int y)
{
Color lowerColor = new Color(235,255,235);
Color highColor = new Color(81,184,77);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(