imagepreviewer.java
来自「此文档针对开发人员和测试人员。第二章对软件进行了全面的描述。第三章对接口进行了分」· Java 代码 · 共 46 行
JAVA
46 行
package com.ciash.common.gui;
import javax.swing.JLabel;
import javax.swing.JPanel;
import com.ciash.common.gui.event.ImageFileChangeListener;
import com.ciash.common.gui.event.ImageFileChangeEvent;
import java.awt.*;
/**
* 图片预览器
*/
public class ImagePreviewer
extends JPanel {
private PictureBox pictureBox = new PictureBox();
private JLabel preview = new JLabel("预览:");
GridBagLayout gridBagLayout1 = new GridBagLayout();
public ImagePreviewer() {
jbInit();
}
private void jbInit() {
setLayout(gridBagLayout1);
pictureBox.setBackground(preview.getBackground());
add(preview, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE
, new Insets(8, 11, 0, 0), 373, 0));
add(pictureBox, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
, GridBagConstraints.CENTER, GridBagConstraints.BOTH
, new Insets(5, 10, 6, 8), 390, 227));
}
public void setImage(Image img) {
pictureBox.setImage(img);
}
public Image getImage(){
return pictureBox.getImage();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?