📄 imagepanelscroller.java
字号:
/* * ImagePanelScroller.java * * Created on March 24, 2005, 3:02 PM *///----------------------------------------------------------------------------------package itesm.gvision.components;import javax.swing.*;import javax.swing.event.*;import javax.swing.text.*;import javax.swing.border.*;import javax.swing.colorchooser.*;import javax.swing.filechooser.*;import javax.accessibility.*;import java.awt.image.*;import java.awt.*;//----------------------------------------------------------------------------------/** * A scrollable image display control. * @author hugo */public class ImagePanelScroller extends JScrollPane{ private BufferedImage image; //---------------------------------------------------------------------------------- /** Creates a new instance of ImagePanelScroller */ public ImagePanelScroller() { } //---------------------------------------------------------------------------------- /** * Sets the image to display into the control. * @param img The buffered image */ public void setImage(BufferedImage img) { this.image = img; this.getViewport().removeAll(); ImageIcon icon = new ImageIcon(img); JPanel p = new JPanel(new BorderLayout()); p.add(new JLabel(icon), BorderLayout.CENTER); this.getViewport().add(p); } //---------------------------------------------------------------------------------- /** * Gets the current display image. */ public BufferedImage getImage() { return this.image; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -