hrefscroller.java
来自「该新闻滚动播出Java小程序可以从放在网络服务器上的文件读入数据」· Java 代码 · 共 72 行
JAVA
72 行
/* URL-clickable horizontal scrolling text applet. Parameters (see also Scroller): URL the URL to jump to when the applet is clicked by a mouse def: none - if none supplied or invalid, it's just a scrolling text applet TARGET for frames, etc. def: "_top" Copyright 1998 by E. A. Graham, Jr. Free to use or modify. */import java.awt.*;import java.applet.*;import java.net.URL;import java.net.MalformedURLException;public class HrefScroller extends Scroller { String urlName; String urlTarget; URL nextURL = null; public void init() { super.init(); urlName = ReadText("URL"); if (urlName != null) { int x = urlName.indexOf(','); if (x > 0) { urlTarget = urlName.substring(x+1); urlName = urlName.substring(0,x); } else { urlTarget = "_top"; // just to make sure we jump out of frames } try { if (urlName.indexOf("http://") < 0) { nextURL = new URL(getDocumentBase(),urlName); } else { nextURL = new URL(urlName); } } catch (MalformedURLException e) {}; } borderWidth = Math.abs(borderWidth); } public boolean mouseDown(Event e,int x, int y) { borderWidth = -borderWidth; return true; } public boolean mouseUp(Event e,int x, int y) { borderWidth = -borderWidth; if (nextURL !=null) { getAppletContext().showDocument(nextURL,urlTarget); } return true; } public boolean mouseEnter(Event e,int x,int y) { if (nextURL != null) showStatus("Link to " + urlName); return true; } public boolean mouseExit(Event e,int x,int y){ showStatus(""); return true; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?