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

熱點內容
雙網卡上不同網路 瀏覽:94
拳皇game怎麼打壓縮文件 瀏覽:748
有哪些兩級配送物流網路 瀏覽:8
sql目錄名加文件名 瀏覽:446
小學編程教材哪個好 瀏覽:179
英語詞典蘋果app 瀏覽:344
黨的文件保管採用什麼辦法 瀏覽:45
老版本的百度雲盤 瀏覽:201
一指彈app怎麼用 瀏覽:249
ps怎麼提取文件名 瀏覽:540
蘋果7plus網路連接超時 瀏覽:959
權重6網站賣多少 瀏覽:151
bzb網站有哪些 瀏覽:687
機械類專業要學什麼編程 瀏覽:89
SQL中打開excel文件 瀏覽:468
藍牙可以傳word文件嗎 瀏覽:65
三星能自己升級系統嗎 瀏覽:265
12款新福克斯手動擋bcm升級 瀏覽:330
js內容尾部增加內容 瀏覽:803
sqlldr控制文件詳解 瀏覽:614

友情鏈接