📄 scrolllist.java
字号:
// ScrollList.java// A simple JScrollPane for a JList component.//package jswing.ch11;import javax.swing.*;import java.awt.*;public class ScrollList extends JFrame { JScrollPane scrollpane; public ScrollList() { super("JScrollPane Demonstration"); setSize(300, 200); setDefaultCloseOperation(EXIT_ON_CLOSE); String categories[] = { "Household", "Office", "Extended Family", "Company (US)", "Company (World)", "Team", "Will", "Birthday Card List", "High School", "Country", "Continent", "Planet" }; JList list = new JList(categories); scrollpane = new JScrollPane(list); getContentPane().add(scrollpane, BorderLayout.CENTER); } public static void main(String args[]) { ScrollList sl = new ScrollList(); sl.setVisible(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -