![]() |
#2
wlrjgzs2017-04-20 12:23
|
只有本站会员才能查看附件,请 登录

package midterm;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
public class photo extends JFrame implements ActionListener{
JScrollPane jsp ;
JPanel showjp = new JPanel();
public photo(){
ImageIcon icon0 = new ImageIcon("0.jpg");
ImageIcon icon1 = new ImageIcon("1.jpg");
ImageIcon icon2 = new ImageIcon("2.jpg");
ImageIcon icon3 = new ImageIcon("3.jpg");
ImageIcon icon4 = new ImageIcon("4.jpg");
ImageIcon icon5 = new ImageIcon("5.jpg");
ImageIcon icon6 = new ImageIcon("6.jpg");
ImageIcon icon7 = new ImageIcon("7.jpg");
ImageIcon icon8 = new ImageIcon("8.jpg");
ImageIcon icon9 = new ImageIcon("9.jpg");
JLabel jl0 = new JLabel(icon0);
JLabel jl1 = new JLabel(icon1);
JLabel jl2 = new JLabel(icon2);
JLabel jl3 = new JLabel(icon3);
JLabel jl4 = new JLabel(icon4);
JLabel jl5 = new JLabel(icon5);
JLabel jl6 = new JLabel(icon6);
JLabel jl7 = new JLabel(icon7);
JLabel jl8 = new JLabel(icon8);
JLabel jl9 = new JLabel(icon9);
showjp.add(jl0);
showjp.add(jl1);
showjp.add(jl2);
showjp.add(jl3);
showjp.add(jl4);
showjp.add(jl5);
showjp.add(jl6);
showjp.add(jl7);
showjp.add(jl8);
showjp.add(jl9);
jsp = new JScrollPane();
this.add(jsp);
this.add(showjp);
this.add("Center", showjp);
this.setTitle("photo");
this.setSize(400, 300);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
//this.pack();
}
public static void main(String[] args) {
photo win = new photo();
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}}
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
public class photo extends JFrame implements ActionListener{
JScrollPane jsp ;
JPanel showjp = new JPanel();
public photo(){
ImageIcon icon0 = new ImageIcon("0.jpg");
ImageIcon icon1 = new ImageIcon("1.jpg");
ImageIcon icon2 = new ImageIcon("2.jpg");
ImageIcon icon3 = new ImageIcon("3.jpg");
ImageIcon icon4 = new ImageIcon("4.jpg");
ImageIcon icon5 = new ImageIcon("5.jpg");
ImageIcon icon6 = new ImageIcon("6.jpg");
ImageIcon icon7 = new ImageIcon("7.jpg");
ImageIcon icon8 = new ImageIcon("8.jpg");
ImageIcon icon9 = new ImageIcon("9.jpg");
JLabel jl0 = new JLabel(icon0);
JLabel jl1 = new JLabel(icon1);
JLabel jl2 = new JLabel(icon2);
JLabel jl3 = new JLabel(icon3);
JLabel jl4 = new JLabel(icon4);
JLabel jl5 = new JLabel(icon5);
JLabel jl6 = new JLabel(icon6);
JLabel jl7 = new JLabel(icon7);
JLabel jl8 = new JLabel(icon8);
JLabel jl9 = new JLabel(icon9);
showjp.add(jl0);
showjp.add(jl1);
showjp.add(jl2);
showjp.add(jl3);
showjp.add(jl4);
showjp.add(jl5);
showjp.add(jl6);
showjp.add(jl7);
showjp.add(jl8);
showjp.add(jl9);
jsp = new JScrollPane();
this.add(jsp);
this.add(showjp);
this.add("Center", showjp);
this.setTitle("photo");
this.setSize(400, 300);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
//this.pack();
}
public static void main(String[] args) {
photo win = new photo();
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}}
[此贴子已经被作者于2017-4-19 23:48编辑过]