📄 rssfeeder.java
字号:
/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package net.sf.jftp.tools;import net.sf.jftp.config.Settings;import net.sf.jftp.gui.framework.*;import net.sf.jftp.gui.*;import net.sf.jftp.util.*;import java.awt.*;import java.net.*;import javax.swing.*;import java.util.*;public class RSSFeeder extends StatusCanvas implements Runnable{ Thread runner; URL url; RSSParser parser; int HEADER_IVAL = 4000; int LOAD_IVAL = 31*60000; public static String urlstring = Settings.getRSSFeed(); //"http://www.spiegel.de/schlagzeilen/rss/0,5291,,00.xml"; public RSSFeeder() { setPreferredSize(new Dimension(500, 25)); runner = new Thread(this); runner.start(); } public void run() { long time; try { setInterval(10); url = new URL(urlstring); parser = new RSSParser(url); time = System.currentTimeMillis(); } catch(Exception ex) { ex.printStackTrace(); return; } while(true) { try { Enumeration e = parser.titles.elements(); Enumeration e2 = parser.descs.elements(); while(e.hasMoreElements()) { setText((String) e.nextElement()); LocalIO.pause(HEADER_IVAL); if(e2.hasMoreElements()) { scrollText((String) e2.nextElement()); } } } catch(Exception ex) { ex.printStackTrace(); } if(System.currentTimeMillis() > LOAD_IVAL+time) { parser = new RSSParser(url); time = System.currentTimeMillis(); } } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -