《Java2图形设计卷II:Swing》配套光盘源码

源代码在线查看: test.java

软件大小: 4504 K
上传用户: guigong
关键词: Java2 Swing 图形 光盘
下载地址: 免注册下载 普通下载 VIP

相关代码

				import java.awt.*;
				import javax.swing.*;
				import javax.swing.border.*;
				
				public class Test extends JApplet {
					public Test() {
						Container contentPane = getContentPane();
						JLabel columnHeaderView = new JLabel(
											new ImageIcon("horizontalRuler.jpg"));
						JLabel rowHeaderView = new JLabel(
											new ImageIcon("verticalRuler.jpg"));
						JLabel view = new JLabel(
											new ImageIcon("anjinAndMariko.gif"));
				
						JScrollPane sp = new JScrollPane(view);
				
						JPanel corners[] = {
								new JPanel(), new JPanel(),
								new JPanel(), new JPanel()
						};
						String cornerConstants[] = {
							ScrollPaneConstants.UPPER_LEFT_CORNER,
							ScrollPaneConstants.LOWER_LEFT_CORNER,
							ScrollPaneConstants.UPPER_RIGHT_CORNER,
							ScrollPaneConstants.LOWER_RIGHT_CORNER,
						};
						Border border = BorderFactory.createEtchedBorder();
				
						for(int i=0; i < corners.length; ++i) {
							corners[i].setBorder(border);
							sp.setCorner(cornerConstants[i], corners[i]);
						}
				
						sp.setColumnHeaderView(columnHeaderView);
						sp.setRowHeaderView(rowHeaderView);
						contentPane.add(sp);
					}
				}
							

相关资源