package panel;

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專(zhuān)注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、重慶小程序開(kāi)發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶(hù)創(chuàng)新互聯(lián)還提供了博羅免費(fèi)建站歡迎大家使用!
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JPanel;
import main.MainTank;
public class TipPanel extends JPanel implements Runnable{
/**
*
*/
private static final long serialVersionUID = 1L;
//偶數(shù)打印,畫(huà)面板
int time=0;
public void paintComponent(Graphics g){
super.paint(g);
g.fillRect(0, 0, MainTank.getWidthOfGame(), MainTank.getHeightOfGame());//繪制提示窗口
if (time%2==0){//偶數(shù)打印,畫(huà)面板,造成閃爍效果
g.setColor(Color.ORANGE);
Font font=new Font("華文楷體",Font.BOLD,30);
g.setFont(font);//選用字體
g.drawString("Ready", 140, 130);
}
}
@Override
public void run() {
while (true){
try{
Thread.sleep(250);
}catch (Exception e){
e.getMessage();
}
time++;//繪圖開(kāi)關(guān)
this.repaint();
}
}
}//TipPanel
類(lèi)似的,修改下就行
public class Test4 {
public static void main(String[] args) {
for(int i=1;i=9;i++){
if(i=5){
for(int j=1;j=i*2-1;j++){
System.out.print("*");
}
}
if(i5i=9){
for(int j=9;j=(i-5)*2+1;j--)
System.out.print("*");
}
System.out .println();
}
}
}
第一個(gè)的代碼如下,可以改變i的數(shù)值來(lái)控制X形狀的大小
class Test
{
public static void main(String[] args)
{
int i=3;
int j=i*2-1;
int k,l;
for(;j0;j--)
{
k=(i-1)-Math.abs(j-i);
l=Math.abs(j-i)*2-1;
for(;k0;k--)
{
System.out.print(" ");
}
System.out.print("*");
if(l0)
{
for(;l0;l--)
{
System.out.print(" ");
}
System.out.print("*");
}
System.out.print("\n");
}
}
}
你第二個(gè)我也沒(méi)看明白,不過(guò)思路應(yīng)該都差不多,你根據(jù)這一個(gè)自己琢磨琢磨吧,關(guān)鍵問(wèn)題就在k和l的計(jì)算上.
以下的代碼就可以,lz自己在*的地方填入星星的圖片就可以了
body bgcolor=#ee3300
style
.drop { position: absolute; width: 3; filter: flipV(), flipH(); font-size: 40; color: #ffffff }
/style
script language="javascript"
snow = false; // false-rain; true-snow
snowsym = " * " are the symbols for each
rainsym = " * " can put images here.
howmany = 20 many drops/snowflakes?
/**************Do not need to change anything below***********/
if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}
else{sym = rainsym; speed=30; drops=howmany; angle=6}
movex = -speed/angle; movey = speed; count = 0;
function moverain(){
for(move = 0; move drops; move++){
xx[move]+=movex; yy[move]+=mv[move];
hmm = Math.round(Math.random()*1);
if(xx[move] 0){xx[move] = maxx+10;}
if(yy[move] maxy){yy[move] = 10;}
drop[move].left = xx[move]
drop[move].top = yy[move]+document.body.scrollTop;
}setTimeout('moverain()','1')}
/script
script language="javascript"
if (document.all){
drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()
ly = "document.all[\'"; st = "\'].style"
for(make = 0; make drops; make++){
document.write('div id="drop'+make+'" class=drop'+sym+'/div');
drop[make] = eval(ly+'drop'+make+st);
maxx = document.body.clientWidth-40
maxy = document.body.clientHeight-40
xx[make] = Math.random()*maxx;
yy[make] = -100-Math.random()*maxy;
drop[make].left = xx[make]
drop[make].top = yy[make]
mv[make] = (Math.random()*5)+speed/16;
drop[make].fontSize = (Math.random()*10)+20;
if(snow){col = 'white'}else{col = 'white'}
drop[make].color = col;
}
window.onload=moverain
}
/script
/body
當(dāng)前題目:java星星圖案代碼,java星號(hào)圖形輸出
當(dāng)前網(wǎng)址:http://chinadenli.net/article33/dsigoss.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、搜索引擎優(yōu)化、用戶(hù)體驗(yàn)、云服務(wù)器、標(biāo)簽優(yōu)化、網(wǎng)頁(yè)設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容