?? scrollpanedemo.java
字號:
import javax.swing.*;
public class ScrollPaneDemo extends JFrame {
JScrollPane scrollpane = new JScrollPane();
Icon icon=new ImageIcon("Image.jpg");
JLabel lbIcon = new JLabel(icon);
public ScrollPaneDemo() {
super("滾動面板示例");
setSize(350,300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void setLayout(){
//向滾動面板的瀏覽窗口添加組件,
scrollpane.getViewport().add(lbIcon);
this.getContentPane().add(scrollpane);
}
public static void main(String[] args) {
ScrollPaneDemo frame = new ScrollPaneDemo();
frame.setLayout();
frame.show();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -