Tue Nov 11, 2008 6:16 pm
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.geom.*;
public class DrawDashedOval extends JApplet {
public void init() {
setBackground(Color.white);
}
float fl[] = { 12.0f };
BasicStroke basicStroke = new BasicStroke(2.0f,
BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 12.0f,
fl, 0.0f);
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(Color.gray);
g2d.setStroke(basicStroke);
g2d.draw(new Ellipse2D.Double(50, 50, 250, 250));
}
public static void main(String args[]) {
JFrame frame = new JFrame("Show Dashed Oval");
DrawDashedOval dashedOval= new DrawDashedOval();
frame.getContentPane().add("Center", dashedOval);
dashedOval.init();
frame.setSize(350, 350);
frame.setVisible(true);
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.