到你安裝的JDK目錄先找demo文件夾看看...如果沒有的話,那就安裝一個(gè)帶有demo的JDK版本。

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供常寧網(wǎng)站建設(shè)、常寧做網(wǎng)站、常寧網(wǎng)站設(shè)計(jì)、常寧網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、常寧企業(yè)網(wǎng)站模板建站服務(wù),10多年常寧做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
這里全都是官方示例,絕對(duì)值得參考學(xué)習(xí)。
可參考 孫博文 的一本書 分形算法與程序設(shè)計(jì): Java實(shí)現(xiàn) 里面有3D的內(nèi)容
貌似要下載 JAVA3D 的msi安裝包 解壓后得到j(luò)ar包 JAVA 3D已經(jīng)被淘汰 可能有點(diǎn)難找
用Java3D編程就行了 你先把那書上關(guān)于3D的代碼 稍微看一下 編程的思路也就是 先建立一個(gè)場(chǎng)景(有光) 然后空間描點(diǎn) 畫線 著色 之類的 可以參考具體的Java 3D 的書 貌似大多是英文的
編程也可以參考官方API文檔
如果認(rèn)可,請(qǐng)加分到100分,謝謝
import?javax.swing.*;
import?java.awt.*;
import?java.awt.event.*;
import?java.awt.image.*;
import?java.util.*;
/**
*?點(diǎn)擊按鈕繪制圓點(diǎn)
*?@author?Hardneedl
*/
final?class?PaintDemo?extends?JFrame?{
public?String?getTitle()?{return?"PaintDemo";}
static?private?final?Dimension?size?=?new?Dimension(600,400);
public?Dimension?getPreferredSize()?{return?size;}
public?Dimension?getMaximumSize()?{return?size;}
public?Dimension?getMinimumSize()?{return?size;}
public?Dimension?getSize(){return?size;}
/*畫筆*/
private?interface?Brush?{void?paint(Graphics?g);}
private?class?_Brush?implements?Brush,Observer?{
private?Point?p;
public?void?paint(Graphics?g)?{
if(p==null)return;
Graphics?g2=g.create();
//抗鋸齒
((Graphics2D)g2).setRenderingHint(RenderingHints.KEY_ANTIALIASING,?RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(Color.YELLOW);
g2.fillArc(p.x,p.y,?10,10?,0,360);
g2.dispose();
}
public?void?update(Observable?o,?Object?arg)?{
if?(arg?instanceof?Point)p=?(Point)?arg;
}
}
private?class?PaintCanvas?extends?JComponent?implements?Observer{
private?BufferedImage?img?=?new?BufferedImage(400,300,BufferedImage.TYPE_INT_RGB);
private?Brush?b;
private?PaintCanvas(Brush?b)?{this.b=b;}
protected?void?paintComponent(Graphics?g)?{
super.paintComponent(g);
b.paint(img.getGraphics());
g.drawImage(img,0,0,this);
}
public?void?update(Observable?o,?Object?arg)?{
if("REPAINT".equals(arg))?repaint();
}
}
private?class?DrawAction?extends?AbstractAction{
private?Point?p?=?new?Point(30,100);
private?Observable?observable?=?new?Observable(){
public?void?notifyObservers(Object?arg)?{
setChanged();
super.notifyObservers(arg);
}
};
private?DrawAction(Observer...?observers)?{
super("Draw?Circle");
if(observers!=null)
for(Observer?o?:?observers)
observable.addObserver(o);
}
public?void?actionPerformed(ActionEvent?e)?{
observable.notifyObservers(p);
observable.notifyObservers("REPAINT");
p.x+=30;p.y+=20;
}
}
PaintDemo()?throws?HeadlessException?{
init();
attachListeners();
doLay();
}
private?PaintCanvas?canvas;
private?_Brush?brush;
private?void?init(){
canvas?=?new?PaintCanvas(brush=new?_Brush());
}
private?void?attachListeners(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private?void?doLay(){
Container?container?=?getContentPane();
container.add(new?JButton(new?DrawAction(brush,canvas)),BorderLayout.NORTH);
container.add(canvas,BorderLayout.CENTER);
pack();
setVisible(true);
}
public?static?void?main(String[]args)?{
System.setProperty("swing.defaultlaf","com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.invokeLater(
new?Runnable(){
public?void?run()?{
new?PaintDemo();
}
}
);
}
}
網(wǎng)站標(biāo)題:包含JAVA3d畫的代碼的詞條
本文鏈接:http://www.chinadenli.net/article16/ddogogg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、建站公司、網(wǎng)站排名、網(wǎng)站設(shè)計(jì)、網(wǎng)站內(nèi)鏈、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)