gpt4 book ai didi

java - 如何制作在调整 JFrame 大小时会调整大小的图像?

转载 作者:行者123 更新时间:2023-11-29 04:54:06 26 4
gpt4 key购买 nike

<分区>

大家好,我用 Java 制作了一款游戏,我希望用户能够调整窗口大小,而不会弄乱图像。是否有一种特定的方法可用于缩放图像以及 JFrame 和 JFrame 内的组件,在这种情况下是按钮、标签、面板等?顺便提一句。我知道如何缩放其他组件但不知道图像

ImageIcon MainLogo = new ImageIcon (getClass().getResource("/SudokuIcons/MainLogo.png"));
ImageIcon MainLogoMenu2 = new ImageIcon (getClass().getResource("/SudokuIcons/MainLogoMenu2.png"));
ImageIcon MainLogoMenu3 = new ImageIcon (getClass().getResource("/SudokuIcons/MainLogoMenu3.png"));
ImageIcon playLogo = new ImageIcon (getClass().getResource("/SudokuIcons/PlayLogo.png"));
ImageIcon OptionsLogo = new ImageIcon (getClass().getResource("/SudokuIcons/OptionsLogo.png"));
ImageIcon HelpLogo = new ImageIcon (getClass().getResource("/SudokuIcons/HelpLogo2.png"));
ImageIcon ExitLogo = new ImageIcon (getClass().getResource("/SudokuIcons/ExitLogo.png"));
ImageIcon StartGame = new ImageIcon (getClass().getResource("/SudokuIcons/StartGame.png"));
ImageIcon ChooseDifficulty = new ImageIcon (getClass().getResource("/SudokuIcons/ChooseDifficulty.png"));
ImageIcon ChooseDifficultyMenu2 = new ImageIcon (getClass().getResource("/SudokuIcons/ChooseDifficultyMenu2.png"));
ImageIcon GoBackIcon = new ImageIcon (getClass().getResource("/SudokuIcons/GoBack.png"));
ImageIcon GoBack2Icon = new ImageIcon (getClass().getResource("/SudokuIcons/GoBack2.png"));
ImageIcon GoBack3Icon = new ImageIcon (getClass().getResource("/SudokuIcons/GoBack3.png"));
ImageIcon EasyIcon = new ImageIcon (getClass().getResource("/SudokuIcons/EasySelected1.png"));
ImageIcon MediumIcon = new ImageIcon (getClass().getResource("/SudokuIcons/MediumSelected1.png"));
ImageIcon HardIcon = new ImageIcon (getClass().getResource("/SudokuIcons/HardSelected1.png"));
ImageIcon EasyIconSelected = new ImageIcon (getClass().getResource("/SudokuIcons/EasySelected1.png"));

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com