導航:首頁 > 編程語言 > java小程序編程

java小程序編程

發布時間:2024-03-12 23:08:01

『壹』 用java程序編程:在屏幕上畫出5個圓,它們的位置和半徑都是隨機的,圓之間間隔10個像素

這是第一個程序代碼 tongxinyuan.java
import java.awt.*;
import java.applet.*;
public class tongxinyuan extends Applet{
public void paint(Graphics g){
int a=getWidth();
int b=getHeight();
int x=0;int y=0;
int m=0;
if(a>=b)
m=b;
else
m=a;
for(int i=m;i>=20;i=i-20){
g.drawOval(x,y,i,i);
/*g . setColor (
new Color((int)(Math.random()*255),
(int)(Math.random()*255), (int)(Math.random()*255)));*/
//這段代碼用來獲取隨機顏色
x=x+10;y=y+10;
}
}
}
這是第二個程序代碼:tongxinyuan.html
<html>
<body>
<applet code="tongxinyuan.class" height=500 width=500 >
</applet>
</body>
</html>
說明一下你要的是五個同心圓但是這只需要更改一下相應的參數值就可以實現了
若是還有什麼問題 可以繼續探討

『貳』 求java經典小程序代碼

『叄』 編寫一個java小程序!

publictest_03(){
init();
}
publicvoidinit(){
JLabeljl_1=newJLabel("用戶名");
JLabeljl_2=newJLabel("密碼");
JTextFieldjtf=newJTextField();
JPasswordFieldjpf=newJPasswordField();
JButtonbutton_1=newJButton("確定");
JPanelpanel=newJPanel();
panel.setLayout(null);
jl_1.setBounds(30,50,50,30);
jl_2.setBounds(30,90,50,30);
jtf.setBounds(100,50,100,30);
jpf.setBounds(100,90,100,30);
button_1.setBounds(110,130,80,30);
panel.add(jl_1);
panel.add(jl_2);
panel.add(jtf);
panel.add(jpf);
panel.add(button_1);
this.add(panel);
this.setSize(300,250);
this.setLocation(400,300);
this.setVisible(true);
}
publicstaticvoidmain(String[]args){
newtest_03();
}

閱讀全文

與java小程序編程相關的資料

熱點內容
怎麼看自己愛奇藝賬號密碼 瀏覽:559
四維彩超怎麼看數據fl代表什麼 瀏覽:827
企業網站開發電話多少 瀏覽:761
手機qq動態推廣可信嗎 瀏覽:38
proe50零件裝配教程 瀏覽:312
c語言兩個程序合並 瀏覽:325
jspsession傳值中文亂碼 瀏覽:582
圖片表格用什麼文件填寫 瀏覽:403
為什麼從文件夾里拖出文件文件夾會自動關閉 瀏覽:907
javacsv製表符 瀏覽:922
蘋果電腦swapfile是什麼文件 瀏覽:839
咕咚app怎麼顯示最大攝氧量 瀏覽:569
天官賜福動漫app哪裡看 瀏覽:328
蓋茨編程怎麼樣 瀏覽:629
java動態生成菜單 瀏覽:491
如何將sql文件導入sqlserver 瀏覽:742
直播間都需要做哪些數據 瀏覽:120
python讀取txt文件split 瀏覽:307
qq和手機傳文件 瀏覽:423
endnotex72破解文件 瀏覽:531

友情鏈接