我是用Label来显示图像,想对ta进行放大,缩小,还有其他方法处理该怎么做?显示:label=newJLabel(newImageIcon(BorderLayout.CENTER));abc=newJScrollPane(label);publicvoidimagev...
我是用Label来显示图像,想对ta进行放大,缩小,还有其他方法处理该怎么做?
显示:
label = new JLabel(new ImageIcon(BorderLayout.CENTER));
abc = new JScrollPane(label);
public void imageview(){
abc.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
abc.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
abc.setViewportView(label);
frame.add(abc);
chooser =new JFileChooser();
chooser.setCurrentDirectory(new File("."));
}
public void addEventHandler(){
//打开
file.add(items[0][0]=new JMenuItem("打开"));
items[0][0].addActionListener(n