📄 transitmap.java
字号:
//********************************************************************
// TransitMap.java Authors: Lewis/Loftus
//
// Demonstrates the use a scroll pane.
//********************************************************************
import java.awt.*;
import javax.swing.*;
public class TransitMap
{
//-----------------------------------------------------------------
// Presents a frame containing a scroll pane used to view a large
// map of the Philadelphia subway system.
//-----------------------------------------------------------------
public static void main (String[] args)
{
// SEPTA = SouthEast Pennsylvania Transit Authority
JFrame frame = new JFrame ("SEPTA Transit Map");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
ImageIcon image = new ImageIcon ("septa.jpg");
JLabel imageLabel = new JLabel (image);
JScrollPane sp = new JScrollPane (imageLabel);
sp.setPreferredSize (new Dimension (450, 400));
frame.getContentPane().add (sp);
frame.pack();
frame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -