📄 portrait.java
字号:
package client;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Toolkit;
import java.awt.Rectangle;
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JScrollBar;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class Portrait extends JFrame implements MouseListener {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JPanel jPanel1 = null;
private JScrollBar jScrollBar = null;
private JPanel jPanel2 = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JLabel jLabel22 = null;
private JLabel jLabel23 = null;
private JLabel jLabel24 = null;
private JLabel jLabel25 = null;
private JLabel jLabel26 = null;
private JLabel jLabel261 = null;
private JLabel jLabel262 = null;
private JLabel jLabel263 = null;
private JLabel jLabel264 = null;
private JLabel jLabel265 = null;
private JLabel jLabel266 = null;
private JLabel jLabel2611 = null;
private JLabel jLabel2612 = null;
private JLabel jLabel2613 = null;
private JLabel jLabel2614 = null;
private JLabel jLabel2615 = null;
private JLabel jLabel2616 = null;
private JLabel jLabel26111 = null;
private JLabel jLabel26112 = null;
private JLabel jLabel26113 = null;
private JLabel jLabel26114 = null;
private JLabel jLabel26115 = null;
private JLabel jLabel26116 = null;
private JPanel jPanel3 = null;
private JLabel jLabel21 = null;
private JPanel jPanel4 = null;
private Object obj = null;
private String portraitName = "";
/**
* This is the default constructor
*/
public Portrait() {
super();
initialize();
}
public Portrait(Object obj) {
this.obj = obj;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(495, 362);
this.setIconImage(Toolkit.getDefaultToolkit().getImage(
getClass().getResource("/picture/1108.gif")));
this.setContentPane(getJContentPane());
this.setTitle("选择头像");
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setForeground(new Color(169, 213, 244));
jContentPane.setBackground(new Color(169, 213, 244));
jContentPane.add(getJPanel(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton2(), null);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(389, 51, 45, 48));
jLabel2.setIcon(new ImageIcon(getClass().getResource(
"/picture/100.gif")));
jLabel2.setText("");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(388, 30, 43, 17));
jLabel1.setFont(new Font("Dialog", Font.PLAIN, 12));
jLabel1.setText("预览:");
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBounds(new Rectangle(4, 1, 480, 284));
jPanel.setBackground(Color.white);
jPanel.setBorder(BorderFactory.createLineBorder(new Color(35, 102,
196), 1));
jPanel.add(getJPanel1(), null);
jPanel.add(jLabel1, null);
jPanel.add(jLabel2, null);
jPanel.add(getJButton(), null);
}
return jPanel;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
jLabel26116 = new JLabel();
jLabel26116.setBounds(new Rectangle(114, 204, 40, 40));
jLabel26116.setText("12.gif");
jLabel26116.setIcon(new ImageIcon(getClass().getResource(
"/picture/12.gif")));
jLabel26116.addMouseListener(this);
jLabel26115 = new JLabel();
jLabel26115.setBounds(new Rectangle(264, 204, 40, 40));
jLabel26115.setText("122.gif");
jLabel26115.setIcon(new ImageIcon(getClass().getResource(
"/picture/122.gif")));
jLabel26115.addMouseListener(this);
jLabel26114 = new JLabel();
jLabel26114.setBounds(new Rectangle(214, 204, 40, 40));
jLabel26114.setText("121.gif");
jLabel26114.setIcon(new ImageIcon(getClass().getResource(
"/picture/121.gif")));
jLabel26114.addMouseListener(this);
jLabel26113 = new JLabel();
jLabel26113.setBounds(new Rectangle(164, 204, 40, 40));
jLabel26113.setText("123.gif");
jLabel26113.setIcon(new ImageIcon(getClass().getResource(
"/picture/123.gif")));
jLabel26113.addMouseListener(this);
jLabel26112 = new JLabel();
jLabel26112.setBounds(new Rectangle(64, 204, 40, 40));
jLabel26112.setText("119.gif");
jLabel26112.setIcon(new ImageIcon(getClass().getResource(
"/picture/119.gif")));
jLabel26112.addMouseListener(this);
jLabel26111 = new JLabel();
jLabel26111.setBounds(new Rectangle(14, 204, 40, 40));
jLabel26111.setText("118.gif");
jLabel26111.setIcon(new ImageIcon(getClass().getResource(
"/picture/118.gif")));
jLabel26111.addMouseListener(this);
jLabel2616 = new JLabel();
jLabel2616.setBounds(new Rectangle(114, 150, 40, 40));
jLabel2616.setText("113.gif");
jLabel2616.setIcon(new ImageIcon(getClass().getResource(
"/picture/113.gif")));
jLabel2616.addMouseListener(this);
jLabel2615 = new JLabel();
jLabel2615.setBounds(new Rectangle(264, 150, 40, 40));
jLabel2615.setText("116.gif");
jLabel2615.setIcon(new ImageIcon(getClass().getResource(
"/picture/116.gif")));
jLabel2615.addMouseListener(this);
jLabel2614 = new JLabel();
jLabel2614.setBounds(new Rectangle(214, 150, 40, 40));
jLabel2614.setText("115.gif");
jLabel2614.setIcon(new ImageIcon(getClass().getResource(
"/picture/115.gif")));
jLabel2614.addMouseListener(this);
jLabel2613 = new JLabel();
jLabel2613.setBounds(new Rectangle(164, 150, 40, 40));
jLabel2613.setText("114.gif");
jLabel2613.setIcon(new ImageIcon(getClass().getResource(
"/picture/114.gif")));
jLabel2613.addMouseListener(this);
jLabel2612 = new JLabel();
jLabel2612.setBounds(new Rectangle(64, 150, 40, 40));
jLabel2612.setText("112.gif");
jLabel2612.setIcon(new ImageIcon(getClass().getResource(
"/picture/112.gif")));
jLabel2612.addMouseListener(this);
jLabel2611 = new JLabel();
jLabel2611.setBounds(new Rectangle(14, 150, 40, 40));
jLabel2611.setText("111.gif");
jLabel2611.setIcon(new ImageIcon(getClass().getResource(
"/picture/111.gif")));
jLabel2611.addMouseListener(this);
jLabel266 = new JLabel();
jLabel266.setBounds(new Rectangle(64, 96, 40, 40));
jLabel266.setText("106.gif");
jLabel266.setIcon(new ImageIcon(getClass().getResource(
"/picture/106.gif")));
jLabel266.addMouseListener(this);
jLabel265 = new JLabel();
jLabel265.setBounds(new Rectangle(164, 96, 40, 40));
jLabel265.setText("109.gif");
jLabel265.setIcon(new ImageIcon(getClass().getResource(
"/picture/109.gif")));
jLabel265.addMouseListener(this);
jLabel264 = new JLabel();
jLabel264.setBounds(new Rectangle(264, 96, 40, 40));
jLabel264.setText("110.gif");
jLabel264.setIcon(new ImageIcon(getClass().getResource(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -