先畫(huà)一張圖,再用JAVA顯示
網(wǎng)站建設(shè)公司,為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì)及定制網(wǎng)站建設(shè)服務(wù),專(zhuān)注于成都定制網(wǎng)頁(yè)設(shè)計(jì),高端網(wǎng)頁(yè)制作,對(duì)成都白烏魚(yú)等多個(gè)行業(yè)擁有豐富的網(wǎng)站建設(shè)經(jīng)驗(yàn)的網(wǎng)站建設(shè)公司。專(zhuān)業(yè)網(wǎng)站設(shè)計(jì),網(wǎng)站優(yōu)化推廣哪家好,專(zhuān)業(yè)seo優(yōu)化排名優(yōu)化,H5建站,響應(yīng)式網(wǎng)站。
我的空間有顯示圖片的程序,你改成最大化、無(wú)系統(tǒng)菜單即可以。
1.在電腦桌面,鼠標(biāo)右鍵單擊選擇 新建文本文檔,新建一個(gè)文本文檔。
2.選擇新建的文本,右鍵選擇重命名為,meigui.html,然后確定,選擇是。
3.用記事本打開(kāi)文件,復(fù)制下面的代碼到文件中,保存。
htmlheadtitle情人節(jié)玫瑰/titlemeta http-equiv="Content-Type" content="text/html; charset=gb2312" /style type="text/css"#shusheng {position: absolute;width: 100%;height: 100%;text-align: center;}/style/headbodydiv style="text-align: center"h1送給xxx的花/h1/divdiv id="shusheng"canvas id="c"/canvas scriptvar b = document.body;var c = document.getElementsByTagName('canvas')[0];var a = c.getContext('2d');document.body.clientWidth; /scriptscriptwith(m=Math)C=cos,S=sin,P=pow,R=random;c.width=c.height=f=500;h=-250;function p(a,b,c){if(c60)return[S(a*7)*(13+5/(.2+P(b*4,4)))-S(b)*50,b*f+50,625+C(a*7)*(13+5/(.2+P(b*4,4)))+b*400,a*1-b/2,a];A=a*2-1;B=b*2-1;if(A*A+B*B1){if(c37) {n=(j=c1)?6:4;o=.5/(a+.01)+C(b*125)*3-a*300;w=b*h;return[o*C(n)+w*S(n)+j*610-390,o*S(n)-w*C(n)+550-j*350,1180+C(B+A)*99-j*300,.4-a*.1+P(1-B*B,-h*6)*.15-a*b*.4+C(a+b)/5+P(C((o*(a+1)+(B0?w:-w))/25),30)*.1*(1-B*B),o/1e3+.7-o*w*3e-6]}if(c32) {c=c*1.16-.15;o=a*45-20;w=b*b*h;z=o*S(c)+w*C(c)+620;return[o*C(c)-w*S(c),28+C(B*.5)*99-b*b*b*60-z/2-h,z,(b*b*.3+P((1-(A*A)),7)*.15+.3)*b,b*.7]}o=A*(2-b)*(80-c*2);w=99-C(A)*120-C(b)*(-h-c*4.9)+C(P(1-b,7))*50+c*2;z=o*S(c)+w*C(c)+700;return[o*C(c)-w*S(c),B*99-C(P(b, 7))*50-c/3-z/1.35+450,z,(1-b/1.2)*.9+a*.1, P((1-b),20)/4+.05]}}setInterval('for(i=0;i1e4;i++)if(s=p(R(),R(),i%46/.74)){z=s[2];x=~~(s[0]*f/z-h);y=~~(s[1]*f/z-h);if(!m[q=y*f+x]|m[q]z)m[q]=z,a.fillStyle="rgb("+~(s[3]*h)+","+~(s[4]*h)+","+~(s[3]*s[3]*-80)+")",a.fillRect(x,y,1,1)}',0)/script/div/body/html
4.然后用瀏覽器打開(kāi)文件,是不是出現(xiàn)了一朵漂亮的 玫瑰花,大功告成。
package epm.mp.gateway.util;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;
public class Rose extends JFrame implements ComponentListener, ItemListener {
private JComboBox comboboxColor;
// 顏色組合框
public Rose() {
super("玫瑰線");
this.setSize(600, 400);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setLayout(new FlowLayout());
Object data[] = { Color.red, Color.green, Color.blue };
comboboxColor = new JComboBox(data);
// 顏色組合框
comboboxColor.addItemListener(this);
// 注冊(cè)組合框的選擇事件監(jiān)聽(tīng)器
this.add(comboboxColor);
this.addComponentListener(this);
// 注冊(cè)框架窗口的選擇事件監(jiān)聽(tīng)器
this.setVisible(true);
this.validate();
}
//r=asin3θ
//轉(zhuǎn)化為直角坐標(biāo)系
// 輸入下面程序用于輸出三葉玫瑰線的圖形,三葉玫瑰線的參數(shù)方程為:
// x = r * sin(3t)* cos(t);
//y = r *sin(3t) * sin(t)
//其中: 0 = t = 2 * 3.14159
//
public void paint(Graphics g){
paint(g,3);
}
public void paint(Graphics g,int roses) {
int x0, y0;
// 原點(diǎn)坐標(biāo)
x0 = this.getWidth() / 2;
// 窗口的寬度
y0 = this.getHeight() / 2;
g.setColor((Color) comboboxColor.getSelectedItem());
// 設(shè)置畫(huà)線顏色為組合框選中顏色
g.drawLine(x0, 0, x0, y0 * 2);
g.drawLine(0, y0, x0 * 2, y0);
int j = 0;
while (j 200) {
for (int i = 0; i 1023; i++) {
double angle = i * Math.PI / 512;
double radius = j * Math.sin(roses * angle);
int x = (int) Math.round(radius * Math.cos(angle) );
int y = (int) Math.round(radius * Math.sin(angle));
g.fillOval(x0 + x, y0 + y, 1, 1);//畫(huà)點(diǎn)
}
j += 10;
}
}
public void itemStateChanged(ItemEvent e) {
// 選中單選按鈕
repaint();
// 重畫(huà)
}
public void componentResized(ComponentEvent e) {
// 改變窗口大小時(shí)
repaint();
}
public void componentMoved(ComponentEvent e) {
}
public void componentHidden(ComponentEvent e) {
}
public void componentShown(ComponentEvent e) {
}
public static void main(String[] arg) {
new Rose();
}
}
public?static?void?main(String[]?args)?{
for(int?m?=?0;m=10;m++)?{//玫瑰,全買(mǎi),對(duì)多買(mǎi)10只
for(int?b?=?0;b=7;b++)?{//百合,全買(mǎi),對(duì)多買(mǎi)7只
for(int?j?=?0;j=4;j++)?{//菊花全買(mǎi),對(duì)多買(mǎi)4只
for(int?k?=?0;k=4;k++)?{//康乃馨全買(mǎi),對(duì)多買(mǎi)4只
int?total?=?2*m+3*b+5*j+6*k;
if(20==total)?{
System.out.println("玫瑰買(mǎi)"+m+"支,百合買(mǎi)"+b+"支,菊花買(mǎi)"+j+"支,康乃馨買(mǎi)"+k+"支");
}
}
}
}
}
}
沒(méi)看懂你的需求,cmd控制臺(tái)運(yùn)行class很簡(jiǎn)單,要在哪展示玫瑰花呢?txt?瀏覽器頁(yè)面?cmd窗口?
玫瑰花是用字符串拼接的?還是img圖片類(lèi)型? 需求不一樣難度也不一樣哦
java jsp的啊
第一個(gè):把如下代碼加入body區(qū)域中,設(shè)置文字的話你自己弄吧
style
.drop { position: absolute; width: 3; filter: flipV(), flipH(); font-size: 40; color: blue }
/style
script language="javascript"
snow = false; // false-rain; true-snow
snowsym = " * " //These are the symbols for each
rainsym = " * " //You can put images here.
howmany = 15 //How many drops/snowflakes?
/**************Do not need to change anything below***********/
if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}
else{sym = rainsym; speed=50; 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 = 'blue'}
drop[make].color = col;
}
window.onload=moverain
}
/script
第二種:建議你用這個(gè),你可以在加幾個(gè)圖片
腳本說(shuō)明:
第一步:把如下代碼加入body區(qū)域中
script language="JavaScript"
!--
Pic=new Array('photo/04261.gif','photo/04262.gif','photo/04263.gif','photo/04264.gif','photo/04265.gif')
//Smoothness of animation depends on the number of images and they're file size.
MaxSpeed=5;
MinSpeed=2;
load = new Array()
for(i=0; i Pic.length; i++)
{
load[i] = new Image();
load[i].src = Pic[i];
}
amount=Pic.length;
ns=(document.layers)?1:0;
if (ns){
for (i=0; i amount; i++){
document.write("LAYER NAME='netscape"+i+"' LEFT=0 TOP=0img name='netpics' src="+load[i].src+"/LAYER")}
}
else{
document.write("div style='position:absolute;top:0px;left:0px'div style='position:relative'");
for (i=0; i amount; i++){
document.write("img id='explorer' src='"+load[i].src+"' style='position:absolute;top:0px;left:0px'")}
document.write("/div/div")
}
VB=0;
HB=0;
R=new Array();
PB=new Array();
RD=new Array();
Y=new Array();
X=new Array();
D=new Array();
SP=new Array();
BY=new Array();
BX=new Array();
for (i=0; i amount; i++){
Y[i]=10;
X[i]=10;
D[i]=Math.floor(Math.random()*70+10);
SP[i]=Math.floor(Math.random()*MaxSpeed+MinSpeed);
}
function Curve(){
plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1,0,5,-5)
for (i=0; i amount; i++){
R[i]=Math.floor(Math.random()*plusMinus.length);
RD[i]=plusMinus[R[i]];
}
setTimeout('Curve()',1500);
}
function MoveRandom(){
var H=(document.layers)?window.innerHeight:document.body.clientHeight;
var W=(document.layers)?window.innerWidth:document.body.clientWidth;
var YS=(document.layers)?window.pageYOffset:document.body.scrollTop;
var XS=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i amount; i++){
BY[i]=-load[i].height;
BX[i]=-load[i].width;
PB[i]=D[i]+=RD[i];
y = SP[i]*Math.sin(PB[i]*Math.PI/180);
x = SP[i]*Math.cos(PB[i]*Math.PI/180);
if (D[i] 0) D[i]+=360;
Y[i]+=y;
X[i]+=x;
VB=180-D[i];
HB=0-D[i];
//Corner rebounds! not necessary but looks nice.
if ((Y[i] 1) (X[i] 1)) {Y[i]=1;X[i]=1;D[i]=45;}
if ((Y[i] 1) (X[i] W+BX[i])) {Y[i]=1;X[i]=W+BX[i];D[i]=135;}
if ((Y[i] H+BY[i]) (X[i] 1)) {Y[i]=H+BY[i];X[i]=1;D[i]=315;}
if ((Y[i] H+BY[i]) (X[i] W+BX[i])) {Y[i]=H+BY[i];X[i]=W+BX[i];D[i]=225;}
//Edge rebounds!
if (Y[i] 1) {Y[i]=1;D[i]=HB;}
if (Y[i] H+BY[i]) {Y[i]=H+BY[i];D[i]=HB;}
if (X[i] 1) {X[i]=1;D[i]=VB;}
if (X[i] W+BX[i]) {X[i]=W+BX[i];D[i]=VB;}
var layer=(document.layers)?document.layers['netscape'+i]:explorer[i].style;
layer.top=Y[i]+YS;
layer.left=X[i]+XS;
}
setTimeout('MoveRandom()',10);
}
function sTaRt(){Curve();MoveRandom()}
//--
/script
第二步:
把如下代碼加入body區(qū)域中body bgcolor="#ffffff" onLoad="if (document.all||document.layers) sTaRt()"
第三個(gè):這個(gè)是文字的顯示,你自己決定采用上面那個(gè)后加進(jìn)去
腳本說(shuō)明:
第一步:把如下代碼加入body區(qū)域中
script LANGUAGE="JavaScript"
function init() {
setTimeout("shake(3)",1000);
// setTimeout("this.focus()",4000);
setTimeout("shake(3)",4100);
}
function shake(n) {
if (self.moveBy) {
for (i = 10; i 0; i--) {
for (j = n; j 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
}
}
}
setTimeout("shake(5)", 5000);
}
/script
script language="JavaScript"
!-- begin
var max=0;
function textlist()
{
max=textlist.arguments.length;
for (i=0; imax; i++)
this[i]=textlist.arguments[i];
}
tl=new textlist
(
"李鵬會(huì)見(jiàn)安得拉邦首席部長(zhǎng)奈杜",
"述評(píng):發(fā)展新世紀(jì)睦鄰友好合作關(guān)系",
"我國(guó)外匯儲(chǔ)備已達(dá)一千六百五十六億美元 ",
"人民日?qǐng)?bào)18日社論:推進(jìn)新的農(nóng)業(yè)科技革命 ",
"“神舟二號(hào)”飛船軌道艙留軌繼續(xù)進(jìn)行空間科學(xué)探測(cè)試驗(yàn)",
"聯(lián)合國(guó)證實(shí)貧鈾彈含有鈾-236",
"羅伯遜稱(chēng)北約將繼續(xù)東擴(kuò)",
"巴方指責(zé)以色列暗殺其高級(jí)官員 ",
"亞太議會(huì)論壇第九屆年會(huì)在智利開(kāi)幕",
"專(zhuān)電:布什宣誓就職典禮準(zhǔn)備就緒",
"專(zhuān)電:布什宣誓就職典禮準(zhǔn)備就緒 "
);
var x=0; pos=0;
var l=tl[0].length;
function textticker()
{
document.tickform.tickfield.value=tl[x].substring(0,pos)+"_";
if(pos++==l)
{
pos=0;
setTimeout("textticker()",1000);
x++;
if(x==max) x=0; l=tl[x].length;
}
else
setTimeout("textticker()",50);
}
// end --
/script
form name="tickform"input type=text name="tickfield" size=33/form
第二步:把如下代碼加入body區(qū)域中body bgcolor=#000000" onload="init();textticker()"
能把你的就這么多了 看你的了
名稱(chēng)欄目:玫瑰花代碼java 玫瑰花代碼編程python
URL地址:http://chinadenli.net/article32/hgodsc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營(yíng)銷(xiāo)、建站公司、關(guān)鍵詞優(yōu)化、、網(wǎng)站改版、網(wǎng)站收錄
聲明:本網(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)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容