12.5

//12.5
 
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
 
public class Test extends JFrame
{
     
    public static void main(String[] args) {
         
        LineBorder lb = new LineBorder(Color.black,2);
        Test t1 = new Test();
        t1.setLayout(new GridLayout(2,2));
        ImageIcon icon1 = new ImageIcon("pic/1.jpg");
        ImageIcon icon2 = new ImageIcon("pic/2.jpg");
        ImageIcon icon3 = new ImageIcon("pic/3.jpg");
        ImageIcon icon4 = new ImageIcon("pic/4.jpg");
        LineBorder lb1 = new LineBorder(Color.black,1);
        JLabel jlb1 = new JLabel(icon1);
        jlb1.setBorder(lb1);
         
        t1.add(jlb1);
        t1.add(new JLabel(icon2)); 
        t1.add(new JLabel(icon3)); 
        t1.add(new JLabel(icon4)); 
        
        
        
        t1.setSize(200,200);
        t1.setDefaultCloseOperation(EXIT_ON_CLOSE);
        t1.setLocationRelativeTo(null);
        t1.setVisible(true);
    }
}

  

posted on 2016-06-01 14:14  功夫茶茶  阅读(148)  评论(0编辑  收藏  举报

导航