package LedShow;
|
import java.awt.BorderLayout;
|
import java.awt.Container;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.io.File;
|
import javax.swing.ImageIcon;
|
import javax.swing.JButton;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import ColorAndFont.UIColor;
|
import DrawJPG.ImageIOHandler;
|
import Method.JButtonImage;
|
import PbuliClass.Leds;
|
import PbuliClass.jinternalFrame;
|
|
public class LEDPreview extends jinternalFrame {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
JLabel lable=null;
|
JButton shuaxin=null;
|
JPanel mb=null;
|
|
//³õʼ»¯
|
public static void chushi() {
|
ImageIOHandler image = new ImageIOHandler();
|
File file=new File("image/mapfile/led.png");
|
ImageIOHandler.writeImage(image.bi, image.picType, file);
|
image = null;
|
file=null;
|
}
|
|
public LEDPreview() {
|
chushi();
|
this.setTitle("ͶÆÁÔ¤ÀÀ");
|
Container rq=getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(UIColor.getNorth_color());
|
rq.add(getMb() ,BorderLayout.CENTER);
|
this.setFrameIcon(new ImageIcon("image/icon/LED.png"));//ÉèÖô°Ìåͼ±ê
|
}
|
|
|
public JLabel getLable() {
|
if(lable==null) {
|
lable=new JLabel(new ImageIcon("image/mapfile/led.png"));
|
|
}
|
return lable;
|
}
|
|
public JButton getShuaxin() {
|
if(shuaxin==null) {
|
shuaxin=JButtonImage.JButton_image("image/mapfile/led.png", "LEDÆÁĻԤÀÀ");
|
shuaxin.setSize(Integer.parseInt(Leds.get_tb_led().getLed_w()), Integer.parseInt(Leds.get_tb_led().getLed_h()));
|
shuaxin.setLocation(200, 50);
|
shuaxin.addActionListener(new ActionListener() {
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
chushi();
|
ImageIcon images = new ImageIcon("image/mapfile/led.png");
|
images.getImage().flush();
|
shuaxin.setIcon(images);
|
|
}
|
});
|
}
|
return shuaxin;
|
}
|
|
public JPanel getMb() {
|
if(mb==null) {
|
mb=new JPanel();
|
mb.setBackground(UIColor.getNorth_color());
|
mb.setLayout(null);
|
mb.add(getShuaxin());
|
}
|
return mb;
|
}
|
|
|
}
|