導航:首頁 > 編程語言 > 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小程序編程相關的資料

熱點內容
r4燒錄卡不同版本 瀏覽:962
怎麼升級qq群為2000 瀏覽:347
微信己冊除的文件怎樣找回來 瀏覽:715
蘋果美國賬號共享2017 瀏覽:252
ps文件修改後打開還是原圖 瀏覽:220
燒卡機蘋果4微信qq哪裡下載 瀏覽:780
ug120找不到指定文件 瀏覽:522
cda文件怎麼轉換成mp3格式 瀏覽:702
青島hpv疫苗在哪個app預約 瀏覽:881
雙十一成交額2021數據在哪裡看 瀏覽:631
蘋果手機怎麼打開移動數據 瀏覽:637
文件掃描成圖片是彩色的嗎 瀏覽:50
編程里的comply什麼意思 瀏覽:91
電腦上面點了禁用網路怎麼改回來 瀏覽:28
javacatch執行 瀏覽:182
ps軟體文件名字 瀏覽:184
黑蘋果查找文件路徑 瀏覽:397
現在編程都有哪些語言 瀏覽:360
不用錢編輯pdf文件 瀏覽:973
c截圖源代碼 瀏覽:328

友情鏈接