很久以前,大概是12或13年,下载了眼神速读软件。

那时看一本小说只要一个上午,一分钟读上万字。文字从眼前刷刷而过,就看个大概,走马观花。

刚开始时,眼睛容易疲劳,看着看着,眼泪就流了出来。但是最终坚持了下来,从中受益良多。 小说这玩意,看着看着就没精神,但如果跟文字竞跑,就充满精神,乐此不疲。越看越精神,越看大脑越清明,好像有丝丝清气在大脑游荡,那种感觉,试过的都说好。

一直想找一个Android版的速读训练器,一直找不到。拖了很久,去年学了android,总算搞出来了。但用了一两个星期,就没兴趣了。一直赖在手机里,懒得删。

今天突发奇想,要标识一下小说。要干大事!

又把删掉的眼神速读软件下载了回来,40多兆,压缩包看着不是很顺眼,想起来一些不好的回忆——它不会记录阅读位置,背景颜色之类的调节也不尽如人意,界面太大太占地方,不能快捷键控制……

看着看着,不想安装了。自己写一个吧——java版的速读训练器

看看效果:

引用了一些工具类,有些机密不能公开。就发一下同一个包下的文件吧,以供参考:

package com.framework.libInteresting.poet.reader;import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextPane;import com.framework.util.string.PropertyUtil;public class FastReader extends JFrame implements ActionListener {private static long serialVersionUID = 1L;public final JTextPane textArea;public FastReader() {MyThread t=new MyThread();// Set the initial size of the windowsetSize(600, 300);setDefaultCloseOperation(EXIT_ON_CLOSE);setLocationRelativeTo(null);textArea=new JTextPane();textArea.setEditable(false);textArea.setBackground(Color.black);textArea.addKeyListener(new KeyAdapter() {@Overridepublic void keyReleased(KeyEvent e) {setTitle(Util.getTitle());if(e.getKeyCode()==32){//空格 暂停 继续Util.isWait=!Util.isWait;}if(Util.isWait){t.toSuspend();}else{t.toResume();}if(e.getKeyCode()==10){//Enter键关闭程序Util.close();}}});Util.update(textArea,Util.getShowingString() );JPanel panel = new JPanel(new BorderLayout());panel.add(textArea);getContentPane().add(panel);setVisible(true);t.start();}@Overrideprotected void processWindowEvent(WindowEvent e) {if (e.getID() == WindowEvent.WINDOW_CLOSING) {Util.close();}}@Overridepublic void actionPerformed(ActionEvent var1) {}class MyThread extends Thread {private final Object lock = new Object();private boolean suspend = false;public void toSuspend(){suspend = true;}public void toResume(){synchronized (lock) {lock.notify();//当前等待的线程继续执行}suspend = false;}@Overridepublic void run() {super.run();while(!Util.isend){try {while(suspend){synchronized (lock) {lock.wait();}}Util.update(textArea,Util.getShowingString() );Thread.sleep(Integer.parseInt(PropertyUtil.getValue(Util.getConfig(), "utf-8", "refresh", "1000")));} catch (NumberFormatException e1) {e1.printStackTrace();} catch (InterruptedException e1) {e1.printStackTrace();}}}}public static void main(String[] args) {new FastReader();}
}
package com.framework.libInteresting.poet.reader;import java.awt.Color;
import java.awt.Font;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;import javax.swing.JTextPane;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;import com.framework.util.db.DbUtil;
import com.framework.util.file.FileUtil;
import com.framework.util.list.ListUtil;
import com.framework.util.money.SinoNumber;
import com.framework.util.string.PropertyUtil;
import com.framework.util.string.StringUtil;public class Util {public static boolean isWait=false;private static List<String> chapters=new ArrayList<String>();//所有章节标题private static String showingChapter="";//显示的章节内容private static String showingTitle="";//显示的章节标题private static List<List<String>> showing=new ArrayList<List<String>>();//本章节的显示private static int showingIdx=0;//显示到第几个了public static boolean isend=false;public static void initChapterData(){Connection conn = null;try {conn = getConn();DbUtil db = new DbUtil(conn);String name = PropertyUtil.getValue(getConfig(), "utf-8", "name", "");String title = PropertyUtil.getValue(getConfig(), "utf-8", "title", "");String startIndex = PropertyUtil.getValue(getConfig(), "utf-8", "startIndex", "0");int showRow = Integer.parseInt(PropertyUtil.getValue(getConfig(), "utf-8", "showRow", ""));int rowSize = Integer.parseInt(PropertyUtil.getValue(getConfig(), "utf-8", "rowSize", ""));if(!name.matches("\\d+")){name=db.queryForString("select id from spider_novel_name where name=?",new Object[]{name});}if(chapters.size()==0){List<String> titles = db.getListStr("select title from spider_novel_chapter where id=?",new Object[]{name});List<String> newtitles = SinoNumber.orderList(titles);chapters.addAll(newtitles);}if("".equals(title)){title=chapters.get(0);PropertyUtil.saveProperty(getConfig(), "utf-8", "title", title);}showing.clear();String chapter=db.queryForClob("select content from spider_novel_chapter where id=? and title=?", new Object[]{name,title});showingChapter=chapter;showingTitle=title;int curidx=Integer.parseInt(startIndex);if(chapter.length()>curidx){chapter=chapter.substring(curidx);}else{curidx=0;int valueIndex = ListUtil.getValueIndex(chapters, title);if(valueIndex==-1){isend=true;return;}title=chapters.get(valueIndex+1);chapter=db.queryForClob("select content from spider_novel_chapter where id=? and title=?", new Object[]{name,title});showingChapter=chapter;showingTitle=title;}//将文章拆分,分配好显示次序List<String> subshowing=new ArrayList<String>();List<String> rows = StringUtil.split(chapter, new String[]{",","。","!",FileUtil.symbolrn,FileUtil.symboln});for (int i = 0; i < rows.size(); i++) {String row = StringUtil.trim(rows.get(i));if("".equals(row)){continue;}List<String> ss = StringUtil.split(row, rowSize);for (int j = 0; j < ss.size(); j++) {String s = ss.get(j);if(subshowing.size()==showRow){showing.add(subshowing);subshowing=new ArrayList<String>();}subshowing.add(s);}}if(subshowing.size()>0){showing.add(subshowing);}int valueIndex = ListUtil.getValueIndex(chapters, title);if(valueIndex==-1){isend=true;return;}PropertyUtil.saveProperty(getConfig(), "utf-8", "title", chapters.get(valueIndex+1));showingIdx=0;} catch (Exception e) {e.printStackTrace();} finally {DbUtil.close(conn);}}public static void close(){if(showingIdx>=showing.size()){PropertyUtil.saveProperty(getConfig(), "utf-8", "startIndex","0");}else{List<String> list = showing.get(showingIdx);PropertyUtil.saveProperty(getConfig(), "utf-8", "startIndex",String.valueOf(showingChapter.indexOf(list.get(0))));}PropertyUtil.saveProperty(getConfig(), "utf-8", "title",showingTitle);System.exit(99);}public static String getConfig() {return "D://DevSoft/OldProject/AllUtils/src/com/framework/libInteresting/poet/reader/config";}public static Connection getConn() {return DbUtil.getBestConn();}public static void update(JTextPane textArea,String str){textArea.setText(str);Font font = new Font(PropertyUtil.getValue(Util.getConfig(), "utf-8", "fontType", "隶书"), Font.PLAIN,PropertyUtil.getValue(Util.getConfig(), "utf-8", "fontSize", 40));StyledDocument doc = textArea.getStyledDocument();SimpleAttributeSet arrSet = new SimpleAttributeSet();StyleConstants.setFontFamily(arrSet, font.getFamily());StyleConstants.setFontSize(arrSet, font.getSize());StyleConstants.setBold(arrSet, font.isBold());StyleConstants.setItalic(arrSet, font.isItalic());StyleConstants.setForeground(arrSet,Color.white);doc.setCharacterAttributes(0, doc.getLength(), arrSet, false);//设置居中SimpleAttributeSet align = new SimpleAttributeSet();StyleConstants.setAlignment(align, StyleConstants.ALIGN_CENTER);doc.setParagraphAttributes(0,doc.getLength(),align,false);}public static String getTitle() {return showingTitle;}public static String getShowingString() {if(showing.size()==0||showingIdx>=showing.size()){initChapterData();}if(isend) return "";String re=ListUtil.list2Str(showing.get(showingIdx),"\n");showingIdx++;return re;}
}

config文件

name:万族之劫
title:第31章 三个目标
startIndex:2568
showRow:3
rowSize:18
refresh:1000
fontSize:30
fontType:隶书

JAVA+TEXT+小说速读训练器相关推荐

  1. Python课程设计:简易速读训练系统

    大二上完Python课程,老师要求做一个课程设计,经过十几个小时的捣鼓之后,就有一个简易版的速读训练系统诞生啦~ 主要有7个功能: 1.横向阅读(文本遍历.词云.时延等) 2.纵向阅读 3.横向提速 ...

  2. 速读训练软件_记忆力训练:如何提高注意力呢?

    我们经常讲到要提高自己的记忆力,提高了记忆力就能够让自己更加快速的进行我们的工作.但是除了记忆力之外,我们还需要特别注意另外一个重点,那就是注意力.无论是你悻悻求学的学子,还是每天埋头苦干的工作者.如 ...

  3. 速读训练软件_记忆宫殿记忆力训练教程-第八天

    第四部分 右脑开发及训练 前面我们已经知道了右脑的记忆能力是左脑的100万倍,这可不是个小数字,如果我们能利用右脑来处理眼睛所收集到的信息,我们的记忆能力就会达到每分钟数万字的超级速度 右脑不同于左脑 ...

  4. 阿里巴巴Java开发手册——速读记录

    本随笔基于阿里巴巴Java开发手册V1.2,陆陆续续记录一些现阶段能理解的,有启发的内容,并将持续更新 最佳实践--插件使用已经发布为随笔!http://www.cnblogs.com/jiangbe ...

  5. Java封装(速读版)

    封装就是使用公共方法对私有成员变量进行操作(赋值或获取),这样做可以防止该类的代码和数据被其他类 定义的代码随意访问,有助于数据的安全. –我们可以通过修改成员变量的属性(一般为private),用s ...

  6. 1分钟10万字大法:量子波动速读、蒙眼翻书穿针,这是席卷15省的最新智商税...

    鱼羊 郭一璞 发自 凹非寺 量子位 报道 | 公众号 QbitAI 最近,看论文看到日渐头秃的量子位编辑部看到了这样一则广告: -1-5分钟看完一本10万字左右的书籍,并且可以把内容完整复述出来- 哦 ...

  7. 如何快速阅读java源码_如何速读?--如何快速阅读

    下面这些资料是我刚才在整理电脑硬盘的时候发现的,是以前自己刚刚开始关注自己阅读速度和质量的时候收集的资料.因为但是上面不方便,所以全是整理成了TXT文件保存下来,现在发到Blog里面,做个记录.速读要 ...

  8. 波动速读入门训练(含黄卡、曼陀螺使用方法)

    http://www.cnnlp.com/viewthread.php?tid=5337&extra=page%3D1 波动速读入门训练(含黄卡.曼陀螺使用方法) 入门训练是进行波动速读的基础 ...

  9. 网页图片速读器 v4.0 官网

    Welcome to my blog! <script language="javascript" src="http://avss.b15.cnwg.cn/cou ...

最新文章

  1. 这样用组图创作内容,能让你的文章被转发
  2. OpenYurt 深度解读|开启边缘设备的云原生管理能力
  3. python 备份交换机_干货 | 如何用python实现每天定时备份交换机配置文件? 真香~...
  4. data augmentation 数据增强方法总结
  5. 在运行时访问工件的Maven和SCM版本
  6. 信号与系统实验:信号抽样
  7. appcan slider轮播图和页面弹动冲突解决
  8. .net 集合分成几个等数量集合_[C#.NET 拾遗补漏]08:强大的LINQ
  9. java string 匹配次数_Java实现统计某字符串在另一个字符串中出现的次数
  10. 计算机二级二叉树知识,2018年计算机二级考试公共基础知识点:树与二叉树
  11. Web 应用程序渗透测试清单
  12. Python中国象棋源代码及素材
  13. 【Python学习】sklearn层次聚类
  14. 如何批量压缩pdf文件大小?
  15. 霹雳狂刀---回忆录
  16. c语言电子通讯录程序设计实验报告,定稿毕业设计通讯录c语言程序设计喜欢就下吧(电子版)...
  17. 计算机电脑故障,电脑常见故障解决方法
  18. 王者荣耀转系统服务器繁忙,换手机党的福音,王者荣耀开启跨系统角色转移,但这些问题要注意...
  19. 屏幕处理效果—调整屏幕的亮度,饱和度和对比度
  20. 软件测试黑盒测试代码,软件测试黑盒测试代码.doc

热门文章

  1. 2021-2027全球及中国WiFi热点软件行业研究及十四五规划分析报告
  2. C# 高级开发应用:GPS+北斗 antenna 实现精准定位 C#实现
  3. 最常见的 SQL 查询错误 - 第二章节
  4. 极点五笔for Ubuntu安装
  5. html ajax 图片上传,Ajax实现图片上传并预览功能
  6. 如何利用XMLSpy实现从多个XML实例生成架构
  7. goroutine退出方式的总结
  8. 大于4g的文件如何拷贝到u盘?
  9. doxygen安装与使用
  10. 国产奶粉逆袭的10年:90后奶爸奶妈助力新国货逆袭洋品牌