transitmap.java
来自「Java 程序设计教程(第五版)EXAMPLESchap10源码」· Java 代码 · 共 34 行
JAVA
34 行
//********************************************************************
// 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 + =
减小字号Ctrl + -
显示快捷键?