赞
踩
写这个东西的缘由:
网上有个叫DeskDisp的软件,但是本人用的Win10防火墙提示有病毒,所以干脆自己写一个。
-com
-sxd
-Desk.java//主显示
-txt.java//显示文字
package com.sxd;
import javax.swing.JFrame;
public class Desk {
public Desk() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame frame = new JFrame();
/**我的分辨率是3840*2160 黄金分割得到1466.8*/
frame.setBounds(2373, 0, 1467, 906);
/**取消窗口标题栏*/
frame.setUndecorated(true);
frame.add(new txt());
/**设置透明度为50%*/
frame.setOpacity((float) 0.5);
/**取消任务栏显示*/
frame.setType(JFrame.Type.UTILITY);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
package com.sxd;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.LayoutManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class txt extends JPanel {
public txt() {
}
public void paint(Graphics g)
{
super.paint(g);
String s = "";
String list[] = null;
int Y= 100;
g.setColor(Color.BLACK);
g.setFont(new Font("", Font.BOLD, 100));
try {
FileInputStream in = new FileInputStream(new File("C://Users//Administrator//Desktop//list.txt"));
byte[] b = new byte[1024];
in.read(b);
s = new String(b);
lixception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for(String S:list)
{
g.drawString(, 0, Y);
Y = Y+100;
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。