本文目录一览:
- 1、求java公告栏特效代码
- 2、为什么HTML中JAVA特效没网就打不开,该怎样解决呢。下面是我的代码
- 3、页面特效:下星星的代码(JAVA代码)
- 4、急求一个网页特效代码
- 5、java特效代码怎么在dreamweaver中用的
求java公告栏特效代码
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Test{
private JFrame frame;
private String scrolledText;
private String str ="滚动文字 Demo";
public static void main(String args[]) {
try{
Test window = new Test();
window.frame.setVisible(true);
}
catch(Exception e){
e.printStackTrace();
}
}
public Test(){
initialize();
}
private void initialize(){
frame.setBounds(100, 100, 500, 375);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
panel.setLayout(new BorderLayout());
frame.getContentPane().add(panel, BorderLayout.NORTH);
final JLabel label = new JLabel();
label.setText("New JLabel");
panel.add(label);
label_scrolledText(label);
frame.addComponentListener(
new ComponentAdapter(){
public void componentResized(ComponentEvent arg0){
label_scrolledText(label);
}
});
}
public void label_scrolledText(JLabel label) {
this.scrolledText = this.str;
label.setText(scrolledText);
FontMetrics metrics = label.getFontMetrics(label.getFont());
int textW = metrics.stringWidth(label.getText());
Dimension frameSize = frame.getSize();
for (int i = 1; i = (frameSize.width - textW) / 3 - 3; i++)
scrolledText += " ";
label.setText(scrolledText);
Thread thread = new Thread(new TextChanger(label));
thread.start();
}
}
java.lang.NullPointerException
at Test.initialize(Test.java:26)
at Test.init(Test.java:23)
at Test.main(Test.java:16)
为什么HTML中JAVA特效没网就打不开,该怎样解决呢。下面是我的代码
""
你这个是链接互联网上的js文件,不能联网肯定找不到啊,最好用你项目里面的Jquery.js
页面特效:下星星的代码(JAVA代码)
以下的代码就可以,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
急求一个网页特效代码
用这个吧 可以全屏拖动的 支持FLASH引用
script id=clientEventHandlersJS language=JScript
!--
function ad_check() {
self.onError=null;
self.onError=null;
setTimeout("ad_check()",100);
}
function Min_onclick() {
//alert(ad1.style.visibility )
ad1.style.visibility='hidden';
}
function Max_onclick() {
//alert(ad1.style.visibility )
ad1.style.visibility='visible';
}
//--
/scriptscript language=JScript
//floater.innerHTML =''
//window.alert (floater.innerHTML.length4000);
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
!-- STALKER CODE --
function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}
}
//--
function checkFocus(x,y) {
stalkerx = document.floater.pageX;
stalkery = document.floater.pageY;
stalkerwidth = document.floater.clip.width;
stalkerheight = document.floater.clip.height;
if( (x stalkerx x (stalkerx+stalkerwidth)) (y stalkery y
(stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE) {
whichIt = event.srcElement;
while (whichIt.id.indexOf("floater") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY)) {
whichIt = document.floater;
stalkerTouchedX = e.pageX-document.floater.pageX;
StalkerTouchedY = e.pageY-document.floater.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop document.body.scrollTop) whichIt.style.pixelTop =
document.body.scrollTop; if(whichIt.style.pixelLeft document.body.scrollLeft)
whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft
document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20)
whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop document.body.offsetHeight + document.body.scrollTop -
whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight +
document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) = (window.innerWidth+self.pageXOffset-17)) whichIt.left
= ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) = (window.innerHeight+self.pageYOffset-17)) whichIt.top
= ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
!-- DRAG DROP CODE --
if(NS) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
setTimeout("ad_check()",10)
/script
/div
DIV align=center id=floater style="HEIGHT: 100px; WIDTH: 343px; position:absolute; left:76px; top:126px"
TABLE bgColor=#eeeeee border=1 borderColor=#999999
cellPadding=0 cellSpacing=0
style="BORDER-COLLAPSE: collapse" width=167
TBODY
TR
TD height=20 width=167
TABLE border=0 cellPadding=0 cellSpacing=0
width="100%"
TBODY
TR
TD align=right
height=15 vAlign=bottom width="100%"
TABLE border=0 height=2 width="100%"
TR
TD height=1 align=rightFONT color=#000000 face=宋体
style="FONT-SIZE: 9pt" /FONT font
class=banner
id=Min language=javascript
onclick="return Min_onclick()"font color="#990000" style="font-size: 9pt; cursor: hand"收起/font/fontfont
class=banner
id=Min language=javascript
onclick="return Max_onclick()"FONT
color=#666666//FONTfont color="#990000" style="font-size: 9pt; cursor: hand"展开/font/font/TD
/TR/TABLE/TD/TR/TBODY/TABLE/TD/TR/TBODY/TABLE
TABLE bgColor=#eeeeee border=1 borderColor=#999999
cellPadding=2 cellSpacing=0 id=ad1
style="BORDER-COLLAPSE: collapse" width=165
TBODY
TR
TD bgColor=#eeeeee disabled height=20 width=165 P align=center
object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" width="165" height="120"
param name="movie" value=""
param name="quality" value="high"
embed src="" quality="high" pluginspage="" type="application/x-shockwave-flash" width="165" height="120"/embed/object
/P
/TD/TR
TR
TD bgColor=#eeeeee height=20 width=310div align="left"
FONT
color=#990000 size=2font color="#666666"/font/FONT
FONT
color=#FFFFFF size=2 /FONTFONT
color=#800000 size=2蓝染惣右介/FONT/div/TD
/TR
/TBODY/TABLE
/DIV
java特效代码怎么在dreamweaver中用的
在html代码中可随变放,不过我们一般放在head/head之间
script language="javascript"
特效代码放此.....
/script