将图片路径都改成包名路径
This commit is contained in:
@@ -61,7 +61,8 @@ public class LoginFrm extends javax.swing.JFrame {
|
|||||||
// 初始化登录消息异常处理对象
|
// 初始化登录消息异常处理对象
|
||||||
loginMessangeExpection = new LoginMessangeExpection();
|
loginMessangeExpection = new LoginMessangeExpection();
|
||||||
// 设置窗口图标
|
// 设置窗口图标
|
||||||
setIconImage(new ImageIcon("src/com/msksbr/images/mainicon.png").getImage());
|
setIconImage(new ImageIcon(LoginFrm.class.getResource("/com/msksbr/images/mainicon.png")).getImage());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 创建数据库连接器
|
// 创建数据库连接器
|
||||||
connector = new Connector();
|
connector = new Connector();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class MainFrm extends JFrame {
|
|||||||
*/
|
*/
|
||||||
public MainFrm() throws SQLException, ClassNotFoundException {
|
public MainFrm() throws SQLException, ClassNotFoundException {
|
||||||
// 设置窗口图标
|
// 设置窗口图标
|
||||||
setIconImage(new ImageIcon("src/com/msksbr/images/mainicon.png").getImage());
|
setIconImage(new ImageIcon(MainFrm.class.getResource("/com/msksbr/images/mainicon.png")).getImage());
|
||||||
// 初始化数据库连接器
|
// 初始化数据库连接器
|
||||||
connector = new Connector();
|
connector = new Connector();
|
||||||
// 设置窗口标题
|
// 设置窗口标题
|
||||||
@@ -61,7 +61,9 @@ public class MainFrm extends JFrame {
|
|||||||
// 将统计信息标签添加到底部面板
|
// 将统计信息标签添加到底部面板
|
||||||
bottomPanel.add(countMessage);
|
bottomPanel.add(countMessage);
|
||||||
// 创建并设置背景图片
|
// 创建并设置背景图片
|
||||||
ImageIcon imageIcon = new ImageIcon("src/com/msksbr/images/backGround.png");
|
// 创建一个 ImageIcon 对象,用于加载背景图片
|
||||||
|
ImageIcon imageIcon = new ImageIcon(MainFrm.class.getResource("/com/msksbr/images/backGround.png"));
|
||||||
|
|
||||||
imageIcon.setImage(imageIcon.getImage().getScaledInstance(250, 250, 0));
|
imageIcon.setImage(imageIcon.getImage().getScaledInstance(250, 250, 0));
|
||||||
// 设置背景标签的图标
|
// 设置背景标签的图标
|
||||||
backLabel.setIcon(imageIcon);
|
backLabel.setIcon(imageIcon);
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ public class AcademyThanksDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 设置图片标签的图标
|
// 设置图片标签的图标
|
||||||
imageLabel.setIcon(new ImageIcon("src/com/msksbr/images/academy_logo.png"));
|
// 设置图片标签的图标为指定路径的图片
|
||||||
|
imageLabel.setIcon(new ImageIcon(AcademyThanksDialog.class.getResource("/com/msksbr/images/academy_logo.png")));
|
||||||
|
|
||||||
// 调整对话框大小以适应内容
|
// 调整对话框大小以适应内容
|
||||||
pack();
|
pack();
|
||||||
// 设置对话框不可调整大小
|
// 设置对话框不可调整大小
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ public class AuthorDIalog extends JDialog {
|
|||||||
|
|
||||||
// 创建作者标签并设置图标
|
// 创建作者标签并设置图标
|
||||||
JLabel authorLabel = new JLabel();
|
JLabel authorLabel = new JLabel();
|
||||||
authorLabel.setIcon(new ImageIcon("src/com/msksbr/images/AuthorProfile.jpg"));
|
authorLabel.setIcon(new ImageIcon(AuthorDIalog.class.getResource("/com/msksbr/images/AuthorProfile.jpg")));
|
||||||
|
|
||||||
// 将作者标签添加到图标面板
|
// 将作者标签添加到图标面板
|
||||||
iconPanel.add(authorLabel);
|
iconPanel.add(authorLabel);
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ public class EasterEgg extends JDialog {
|
|||||||
// 设置默认按钮为 buttonOK
|
// 设置默认按钮为 buttonOK
|
||||||
getRootPane().setDefaultButton(buttonOK);
|
getRootPane().setDefaultButton(buttonOK);
|
||||||
// 设置 imageLable 的图标为指定路径的图像
|
// 设置 imageLable 的图标为指定路径的图像
|
||||||
imageLable.setIcon(new ImageIcon("src/com/msksbr/images/BuzzBeans.png"));
|
imageLable.setIcon(new ImageIcon(EasterEgg.class.getResource("/com/msksbr/images/BuzzBeans.png")));
|
||||||
|
|
||||||
// 为 buttonOK 添加动作监听器
|
// 为 buttonOK 添加动作监听器
|
||||||
buttonOK.addActionListener(new ActionListener() {
|
buttonOK.addActionListener(new ActionListener() {
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user