📄 scrollpanedemo.java
字号:
import javax.swing.JScrollPane;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.JLabel;import javax.swing.JFrame;public class ScrollPaneDemo extends JFrame { private JScrollPane jsp = new JScrollPane(); private Icon icon = new ImageIcon("text","1158903217362.jpg"); private JLabel jlbIcon = new JLabel(icon); public ScrollPaneDemo() { super("JScrollPane"); setSize(350, 300); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void setLayout() { jsp.getViewport().add(jlbIcon); this.getContentPane().add(jsp); } public static void main(String[] args) { ScrollPaneDemo spd = new ScrollPaneDemo(); spd.setLayout(); spd.setVisible(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -