/*
* 不使用java风格:JFrame.setDefaultLookAndFeelDecorated(true);
* 设置窗口位置:this.setLocation(widthSize / 1024 * 850,heightSize / 768 * 100)
* 窗口位于中央:this.setLocationRelativeTo(null)
* 窗口大小是否可以拖动:this.setResizable(false)
* 关闭风格:this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* 设置窗体风格:
* UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
* SwingUtilities.updateComponentTreeUI(this);
* 设置窗口图标:
* Image image = Toolkit.getDefaultToolkit().createImage("images/001.png");
this.setIconImage(image);
* 设置窗口可见:this.setVisible(true)
* 屏幕尺寸:Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
* 字体样式大小:nameText.setFont(new Font(null, 0, 12));
* 设置背景颜色:nameText.setBackground(Color.red)
* 设置字体颜色:nameText.setForeground(Color.red)
* 聚焦:pwdText.requestFocus();
* 弹出框:JOptionPane.showMessageDialog(this, "请输入密码!", "提示信息", 2);
* 图片处理:Image image = imageIcon.getImage();
image = image.getScaledInstance(mainWidth, mainHeight,
Image.SCALE_DEFAULT);
imageIcon.setImage(image);
imageLabel.setIcon(imageIcon);
*/
//关闭窗体退出虚拟机,其它窗体中不要这一句。否则关闭子窗体主窗体也关闭了
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
//定义一个可滚动面板存放面板
JScrollPane jsp = new JScrollPane(photoPanel);
//加载图片面板
jsp.setSize(mainWidth-10,mainHeight);
//jsp.setBounds(0, 10, mainWidth-10, mainHeight);
int lineNum = photosList.size();
lineNum = lineNum % 10 == 0 ? lineNum / 10 + 1: lineNum / 10 + 2;
//创建布局管理器
GridLayout panelLayout = new GridLayout(lineNum,10);
//设置列距
panelLayout.setHgap((mainWidth-10 - 60 * 10) / 10);
//设置行距
panelLayout.setVgap(20);
photoPanel.setLayout(panelLayout);
photoPanel.setBackground(Color.gray);
//将图片的标签放入面板中
loadPhotoLabel();
this.add(jsp);
/**
* 弹出的对话框
* public static int showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType)
throws HeadlessException调出一个由 optionType 参数确定其中选项数的对话框。
参数:
parentComponent - 确定在其中显示对话框的 Frame;如果为 null 或者 parentComponent 不具有 Frame,则使用默认的 Frame
message - 要显示的 Object
title - 对话框的标题字符串
optionType - 指定可用于对话框的选项的 int:YES_NO_OPTION、YES_NO_CANCEL_OPTION 或 OK_CANCEL_OPTION
返回:指示用户所选选项的 int
*释放资源:this.dispose();
*/
* 不使用java风格:JFrame.setDefaultLookAndFeelDecorated(true);
* 设置窗口位置:this.setLocation(widthSize / 1024 * 850,heightSize / 768 * 100)
* 窗口位于中央:this.setLocationRelativeTo(null)
* 窗口大小是否可以拖动:this.setResizable(false)
* 关闭风格:this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* 设置窗体风格:
* UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
* SwingUtilities.updateComponentTreeUI(this);
* 设置窗口图标:
* Image image = Toolkit.getDefaultToolkit().createImage("images/001.png");
this.setIconImage(image);
* 设置窗口可见:this.setVisible(true)
* 屏幕尺寸:Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
* 字体样式大小:nameText.setFont(new Font(null, 0, 12));
* 设置背景颜色:nameText.setBackground(Color.red)
* 设置字体颜色:nameText.setForeground(Color.red)
* 聚焦:pwdText.requestFocus();
* 弹出框:JOptionPane.showMessageDialog(this, "请输入密码!", "提示信息", 2);
* 图片处理:Image image = imageIcon.getImage();
image = image.getScaledInstance(mainWidth, mainHeight,
Image.SCALE_DEFAULT);
imageIcon.setImage(image);
imageLabel.setIcon(imageIcon);
*/
//关闭窗体退出虚拟机,其它窗体中不要这一句。否则关闭子窗体主窗体也关闭了
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
//定义一个可滚动面板存放面板
JScrollPane jsp = new JScrollPane(photoPanel);
//加载图片面板
jsp.setSize(mainWidth-10,mainHeight);
//jsp.setBounds(0, 10, mainWidth-10, mainHeight);
int lineNum = photosList.size();
lineNum = lineNum % 10 == 0 ? lineNum / 10 + 1: lineNum / 10 + 2;
//创建布局管理器
GridLayout panelLayout = new GridLayout(lineNum,10);
//设置列距
panelLayout.setHgap((mainWidth-10 - 60 * 10) / 10);
//设置行距
panelLayout.setVgap(20);
photoPanel.setLayout(panelLayout);
photoPanel.setBackground(Color.gray);
//将图片的标签放入面板中
loadPhotoLabel();
this.add(jsp);
/**
* 弹出的对话框
* public static int showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType)
throws HeadlessException调出一个由 optionType 参数确定其中选项数的对话框。
参数:
parentComponent - 确定在其中显示对话框的 Frame;如果为 null 或者 parentComponent 不具有 Frame,则使用默认的 Frame
message - 要显示的 Object
title - 对话框的标题字符串
optionType - 指定可用于对话框的选项的 int:YES_NO_OPTION、YES_NO_CANCEL_OPTION 或 OK_CANCEL_OPTION
返回:指示用户所选选项的 int
*释放资源:this.dispose();
*/