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

熱點內容
網路中常用的傳輸介質 瀏覽:518
文件如何使用 瀏覽:322
同步推密碼找回 瀏覽:865
樂高怎麼才能用電腦編程序 瀏覽:65
本機qq文件為什麼找不到 瀏覽:264
安卓qq空間免升級 瀏覽:490
linux如何刪除模塊驅動程序 瀏覽:193
at89c51c程序 瀏覽:329
怎麼創建word大綱文件 瀏覽:622
裊裊朗誦文件生成器 瀏覽:626
1054件文件是多少gb 瀏覽:371
高州禁養區內能養豬多少頭的文件 瀏覽:927
win8ico文件 瀏覽:949
仁和數控怎麼編程 瀏覽:381
項目文件夾圖片 瀏覽:87
怎麼在東芝電視安裝app 瀏覽:954
plc顯示數字怎麼編程 瀏覽:439
如何辨別假網站 瀏覽:711
寬頻用別人的賬號密碼 瀏覽:556
新app如何佔有市場 瀏覽:42

友情鏈接