package panel;
站在用戶的角度思考問題,與客戶深入溝通,找到赤壁網(wǎng)站設(shè)計與赤壁網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都做網(wǎng)站、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名與空間、網(wǎng)頁空間、企業(yè)郵箱。業(yè)務(wù)覆蓋赤壁地區(qū)。
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ù)打印,畫面板
int time=0;
public void paintComponent(Graphics g){
super.paint(g);
g.fillRect(0, 0, MainTank.getWidthOfGame(), MainTank.getHeightOfGame());//繪制提示窗口
if (time%2==0){//偶數(shù)打印,畫面板,造成閃爍效果
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++;//繪圖開關(guān)
this.repaint();
}
}
}//TipPanel
類似的,修改下就行
第一個的代碼如下,可以改變i的數(shù)值來控制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");
}
}
}
你第二個我也沒看明白,不過思路應(yīng)該都差不多,你根據(jù)這一個自己琢磨琢磨吧,關(guān)鍵問題就在k和l的計算上.
以下的代碼就可以,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