java 怎么画圆啊
我现在想画一个类似雷达的图,要画一组同心圆,要怎么画啊,最好圆的边框能是虚线.
我现在想画一个类似雷达的图,要画一组同心圆,要怎么画啊,最好圆的边框能是虚线.
解决方案 »
- 接口属性问题,求高手指教
- 如何删除文件中某些特定的字符
- 怎么在磁盘中查找我要文件
- 我才写了19行代码就报错了
- package 命名的bug?
- JAVA串口出现这个错误javax.comm.NoSuchPortException
- 一个基础概念问题
- 怎么判断出每一年中的春节是那一天?
- 请问有人知道Google里面的calendar是通过什么机制来实现的??有兴趣的请进来...
- 请问,我如何动态按我String中字符的名称来定义一个ArrayList.如何通过这个名称字符来查找到这个ArrayList类?
- java 线程能够实现AJAX的功能么
- 编写一个Java程序,模仿Notepad记事本的功能,在输入框中输入文字,单击“保存”按钮时自动将文字保存到testout.txt文件中
public class TestFrame extends JFrame { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TestFrame frame=new TestFrame();
frame.setBounds(0, 0, 200, 200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getGraphics().setColor(java.awt.Color.BLUE);
frame.getGraphics().drawOval(10, 60, 100, 100);
}}
import java.awt.Dimension;
import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.PolarPlot;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
public class PolarChartDemo1 extends ApplicationFrame
{
public PolarChartDemo1(String s)
{
super(s);
JPanel jpanel = createDemoPanel();
jpanel.setPreferredSize(new Dimension(600, 500));
setContentPane(jpanel);
}
private static XYDataset createDataset()
{
XYSeriesCollection xyseriescollection = new XYSeriesCollection();
XYSeries xyseries = new XYSeries("Series 1");
xyseries.add(0.0D, 2D);
xyseries.add(90D, 13D);
xyseries.add(180D, 9D);
xyseries.add(270D, 8D);
xyseriescollection.addSeries(xyseries);
XYSeries xyseries1 = new XYSeries("Series 2");
xyseries1.add(90D, -11.199999999999999D);
xyseries1.add(180D, 21.399999999999999D);
xyseries1.add(250D, 17.300000000000001D);
xyseries1.add(355D, 10.9D);
xyseriescollection.addSeries(xyseries1);
return xyseriescollection;
}
private static JFreeChart createChart(XYDataset xydataset)
{
JFreeChart jfreechart = ChartFactory.createPolarChart("Polar Chart Demo 1", xydataset, true, false, false);
jfreechart.setBackgroundPaint(Color.white);
PolarPlot polarplot = (PolarPlot)jfreechart.getPlot();
polarplot.setBackgroundPaint(Color.lightGray);
polarplot.addCornerTextItem("Corner Item 1");
polarplot.addCornerTextItem("Corner Item 2");
NumberAxis numberaxis = (NumberAxis)polarplot.getAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
return jfreechart;
}
public static JPanel createDemoPanel()
{
JFreeChart jfreechart = createChart(createDataset());
ChartPanel chartpanel = new ChartPanel(jfreechart);
chartpanel.setMouseZoomable(false);
return chartpanel;
}
public static void main(String args[])
{
PolarChartDemo1 polarchartdemo1 = new PolarChartDemo1("Polar Chart Demo");
polarchartdemo1.pack();
RefineryUtilities.centerFrameOnScreen(polarchartdemo1);
polarchartdemo1.setVisible(true);
}
}
public static void main(String[] args) {
System.out.println('圆');
System.out.println('○');
System.out.println('●');
System.out.println('◎');
System.out.println('㊤');
System.out.println('㊦');
System.out.println('㊥');
System.out.println('㊧');
System.out.println('㊨');
}}
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import java.awt.RenderingHints;
import java.awt.geom.Arc2D;
import javax.swing.JPanel;public class VA extends JPanel {
private static final long serialVersionUID = 1L; public static void main(String[] args) {
} public VA() {
super();
initialize();
} private void initialize() {
this.setSize(300, 200);
this.setLayout(new GridBagLayout());
} public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
super.paint(g2);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
double c[] = { 100, 100 };
double r = 50;
double alf = Math.PI / 3.;
for (double r2 = r; r2 >= 0; r2 -= 10)
g2
.draw(new Arc2D.Double(c[0] - r2, c[1] - r2, 2 * r2, 2 * r2, -Math.toDegrees(Math.PI / 2. - alf / 2.), Math.toDegrees(2 * Math.PI - alf),
Arc2D.OPEN));
}
}
public static void main(String[] args) {
System.out.println('圆');
System.out.println('○');
System.out.println('●');
System.out.println('◎');
System.out.println('㊤');
System.out.println('㊦');
System.out.println('㊥');
System.out.println('㊧');
System.out.println('㊨');
}}
///////////////////////////////
太强了,红内裤外穿的超人啊。