1 package test;
2
3 import java.awt.Color;
4 import java.awt.Dimension;
5 import java.awt.Font;
6 import java.awt.Point;
7 import java.io.File;
8 import java.io.FileInputStream;
9 import java.io.InputStream;
10
11 import javax.swing.Icon;
12 import javax.swing.ImageIcon;
13 import javax.swing.JFrame;
14 import javax.swing.JLabel;
15
16
17 public class test {
18 public static void main(String[] args) {
19 JFrame f=new JFrame("Welcom to see LessonsSchedule");
20 String picPath="c:"+File.separator+"Users"+File.separator+"SunBoy"+File.separator+"Desktop"+File.separator+"课表.png";
21 File file=new File(picPath);
22 InputStream ipt=null;
23 byte b[]=new byte[(int)file.length()];
24 try{
25 ipt=new FileInputStream(file);
26 ipt.read(b);
27 ipt.close();
28 }catch (Exception e){
29 e.printStackTrace();
30 }
31 Icon icon=new ImageIcon(b);
32 JLabel lab=new JLabel("课表哦,亲",icon,JLabel.CENTER);
33 Font fnt=new Font("Serief",Font.ITALIC+Font.BOLD,28);
34 lab.setFont(fnt);
35 lab.setBackground(Color.YELLOW);
36 lab.setForeground(Color.RED);
37 f.add(lab);
38 Dimension dim=new Dimension();
39 dim.setSize(300,300);
40 f.setSize(dim);
41 f.setBackground(Color.WHITE);
42 Point p=new Point(300,200);
43 f.setLocation(p);
44 f.setVisible(true);
45 }
46 }