日期:2014-05-20 浏览次数:20812 次
public class MainPanel extends BackgroundPanel{
private static final long serialVersionUID = 2752472217575142298L;
private UpdateSizePanel updateSizePanel;//修改图片尺寸的panel
private CompressionSpacePanel compressionSpacePanel;//压缩图片大小的panel
private MoveImgPanel moveImgPanel;//移动图片位置的panel
private UpdateSizeBtn updateSizeBtn;//进入修改图片尺寸的button
private CompressionSpaceBtn compressionSpaceBtn;//进入压缩图片大小的button
private MoveImgBtn moveImgBtn;//进入移动图片位置的button
public MainPanel(){
super();
setVisible(true);
setLayout(null);
init();
}
public void init(){
// updateSizePanel=new UpdateSizePanel();
// compressionSpacePanel=new CompressionSpacePanel();
// moveImgPanel=new MoveImgPanel();
// this.add(updateSizePanel);
// this.add(compressionSpacePanel);
// this.add(moveImgPanel);
updateSizeBtn=new UpdateSizeBtn();
// compressionSpaceBtn=new CompressionSpaceBtn("压缩图片");
// moveImgBtn=new MoveImgBtn();
this.add(updateSizeBtn);//这里如果选择添加该按钮,背景就没有了。
// this.add(compressionSpaceBtn);
// this.add(moveImgBtn);
}
public class UpdateSizeBtn extends BackgroundButton{
private static final long serialVersionUID = -4874921281587699812L;
private JLabel label;
public UpdateSizeBtn(){
super();
setBounds(50, 100, 100, 30);
setLayout(null);
init();
}
private void init(){
label=new JLabel();
label.setBounds(0, 0, 100, 30);
label.setText(" 修改尺寸");
this.add(label);
}
}
import javax.swing.*;
import java.awt.*;
import javax.imageio.*;