Cover It Up - For TV Lovers
2015-07-23 22:38
183 查看
Wanna See Some TV Serials - Use It
Wanna See Some TV Serials-->> Then Use It For Better Experience
It will help you
cover the Chinese subtitles
by black block.
And you can easily move
it upwards, or edit the alpha, or
resize it.
import java.awt.Color; import java.awt.Rectangle; import java.io.InputStream; import javax.swing.JFrame; import javax.swing.JPanel; import com.sun.awt.AWTUtilities; public class Vampire { private SurfaceFrame frame; private InputStream in = null; private int iScale = 4;//at px; private int iScaleB = 4;//at px; private float fScale = 0.02f;//at px; public static void main(String[] s) { Vampire context = new Vampire(); context.alert("Input '?' for help!"); if(s.length > 0){ context.fHelp(); } context.fMain(); } private void fMain() { frame = new SurfaceFrame(); frame.fInit(); fListen(); } private void fListen() { try { in = System.in; int get = -1; while ((get = in.read()) != -1) { if ('a' <= get && get <= 'z') { get -= 32; } else if ('A' <= get && get <= 'Z') { } else if (get == '<' || get == '>') { } else if (get=='?') { } else continue; fExcel(get); } } catch (Exception e) { alert("Error when reading char: " + e.toString()); } finally { if (in != null) { try { in.close(); } catch (Exception e) { alert("Error when closing System.in: " + e.toString()); } } } } private void fExcel(int get) throws Exception { switch (get) { case '?': fHelp(); break; case 'Q': case 'q': in.close(); alert("Listening has shut up"); return; case 'W': frame.fUp(); break; case 'S': frame.fDown(); break; case 'A': frame.fLeft(); break; case 'D': frame.fRight(); break; case 'I': frame.fHeighten(); break; case 'K': frame.fShorten(); break; case 'J': frame.fWiden(); break; case 'L': frame.fNarrow(); break; case '<': frame.fIn(); break; case '>': frame.fOut(); break; default: alert("Unknown Order!"); break; } } private void fHelp(){ alert("Wanna Up, Down, Left, Right, please use -->> W S A D;"); alert("Wanna Highten, Shorten, Widen, Narrow, please use -->> I K J L;"); alert("Wanna Shadow, Brighten, please use -->> < >;"); alert("Wanna See The Parameter, please input -->> E"); alert("Tip: All letters will be ignored cases;"); alert(""); } @SuppressWarnings("serial") private class SurfaceFrame extends JFrame { private JFrame frame; private Rectangle rect; private float fAlpha = 0.95f; public SurfaceFrame() { } public void fInit() { rect = new Rectangle(130, 666, 1000, 52); frame = new JFrame(); frame.setLayout(null); frame.setBounds(rect);// Vampire frame.setUndecorated(true); JPanel panel = new JPanel(); panel.setBounds(0, 0, 1390, 1000); panel.setBackground(Color.black); frame.add(panel); AWTUtilities.setWindowOpacity(frame, fAlpha); frame.setAlwaysOnTop(true); frame.setVisible(true); } public void fUp() { rect.y -= iScale; frame.setBounds(rect); } public void fDown() { rect.y += iScale; frame.setBounds(rect); } public void fLeft() { rect.x -= iScale; frame.setBounds(rect); } public void fRight() { rect.x += iScale; frame.setBounds(rect); } public void fWiden() { rect.width += 2 * iScaleB; rect.x -= iScaleB; frame.setBounds(rect); } public void fNarrow() { rect.width -= 2 * iScaleB; rect.x += iScaleB; frame.setBounds(rect); } public void fHeighten() { rect.height += iScaleB; frame.setBounds(rect); } public void fShorten() { rect.height -= iScaleB; frame.setBounds(rect); } public void fIn() { fAlpha -= fScale; fAlpha = fAlpha < 0 ? 0f : fAlpha; AWTUtilities.setWindowOpacity(frame, fAlpha); } public void fOut() { fAlpha += fScale; fAlpha = fAlpha > 1 ? 1f : fAlpha; AWTUtilities.setWindowOpacity(frame, fAlpha); } } public static void alert(String s) { System.out.println(s); } }
相关文章推荐
- 链接QQ客服
- 在linux上安装oracle(红帽) 前的检查工作
- C Primer Plus(第5版)中文版
- 获取所有分组中某列最大的行
- 全景视频拼接关键技术
- hdu5298
- Javascript绝句欣赏
- 动态代理
- POJ1905-Expanding Rods - 二分法。
- 准备你的 In-app Billing 程序
- Path Sum
- Java多线程总结
- Project Euler:Problem 88 Product-sum numbers
- 转: JAVA_SWT常用事件, 和方法
- 平衡二叉树AVL删除
- 使用scanf_s输入得到一行带空格的字符串
- 计算机中的墨菲定律
- 各种排序算法比较--2015年7月23日22:33:43v1.0版
- KNN算法
- 递归与非递归及其相互转换