十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
public class JPanel_aXa extends JFrame {
成都創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供兩當(dāng)網(wǎng)站建設(shè)、兩當(dāng)做網(wǎng)站、兩當(dāng)網(wǎng)站設(shè)計(jì)、兩當(dāng)網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、兩當(dāng)企業(yè)網(wǎng)站模板建站服務(wù),10多年兩當(dāng)做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
public JPanel_aXa(){
super("n x n");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1024, 600);
setVisible(true);
}
public void paint(Graphics g){
super.paint(g);
g.setColor(Color.RED);
int lastX=0, lastY=0;
for(int x=0; x40; x+=1){
int y=getHeight()-x*x;
g.drawLine(lastX, lastY, x+1, y+1);
lastX=x;
lastY=y;
}
}
public static void main(String[] args) {
new JPanel_aXa();
}
}
曲線畫不了多少,因?yàn)閤 *x 挺大的
首先使用JXL讀取excel的數(shù)據(jù) 然后使用JFreeChart把數(shù)據(jù)轉(zhuǎn)成曲線圖 說明: jxl.jar是通過java操作excel表格的工具類庫支持Excel 95-2000的所有版本 JFreeChart是JAVA平臺上的一個(gè)開放的圖表繪制類庫. 效果圖
用極坐標(biāo)方程,一個(gè)點(diǎn)一個(gè)點(diǎn)的畫。給你段我以前寫的程序,雖然不是螺旋曲線,但也差不多。import java.awt.*;
import javax.swing.*;public class Spirograph extends JApplet {
public static void main(String s[]) {
JFrame frame = new JFrame();
frame.setTitle("Spirograph");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JApplet applet = new Spirograph();
applet.init();
frame.getContentPane().add(applet);
frame.pack();
frame.setVisible(true);
}
public void init() {
JPanel panel = new SpiroPanel();
getContentPane().add(panel);
}
}class SpiroPanel extends JPanel{
int nPoints = 1000;
double r1 = 60;
double r2 = 50;
double p = 70;
public SpiroPanel() {
setPreferredSize(new Dimension(400, 400));
setBackground(Color.white);
} public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.translate(200,200);
int x1=(int)(r1+r2-p);
int y1=0;
int x2;
int y2;
for (int i=0; inPoints; i++) {
double t = i*Math.PI/90;
x2 = (int)((r1+r2)*Math.cos(t)-p*Math.cos((r1+r2)*t/r2));
y2 = (int)((r1+r2)*Math.sin(t)-p*Math.sin((r1+r2)*t/r2));
g2.drawLine(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
}
}
}
1、自己編寫java程序,也就幾十行代碼,先訪問數(shù)據(jù)庫取數(shù),再封裝數(shù)據(jù).
2、很多啊,eclipse,myeclipse,jbuilder。。。
3、getconnection()
String DBDriver = SysConfig.getProperty("database.defaultProvider.driver");
String DBUser = SysConfig.getProperty("database.defaultProvider.username");
String DBPassword = SysConfig.getProperty("database.defaultProvider.password");
String DBUrl = SysConfig.getProperty("database.defaultProvider.serverURL");
//
Class.forName(DBDriver);
Properties myprop = System.getProperties();
myprop.setProperty("user",DBUser);
myprop.setProperty("password",DBPassword);
conn = DriverManager.getConnection(DBUrl,myprop);
..........
PreparedStatement pstmt = conn.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
.......
4.下載jfreechart的jar包,調(diào)用里面的方法,參考它的api,就是一步一步的多試驗(yàn)下