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

熱點內容
破鎖屏密碼方法 瀏覽:835
股票數據放哪裡 瀏覽:576
m格式庫文件 瀏覽:279
天際通數據服務怎麼開票 瀏覽:430
寫小說發哪個網站比較好 瀏覽:244
小米電視3藍牙文件路徑 瀏覽:111
shell讀取文件值 瀏覽:909
文件夾路徑欄消失 瀏覽:795
律師哪些業務不能代替大數據 瀏覽:952
lol哪些文件可以刪除 瀏覽:701
匯編程序中del是什麼意思 瀏覽:183
幼兒園免費網站模板下載 瀏覽:210
w619線刷教程 瀏覽:759
怎麼培養編程思想 瀏覽:697
手機捆綁app的軟體怎麼卸載 瀏覽:32
vb編程器有什麼用 瀏覽:999
excel如何分列數據與文字 瀏覽:884
512網路病毒 瀏覽:994
java調用google地圖api介面 瀏覽:726
文件管理圖片小窗 瀏覽:599

友情鏈接