如何在重新调整JFrame大小时制作可重新调整大小的图像?

时间:2015-12-20 11:26:57

标签: java eclipse image swing resize

大家好我在java上做了一个游戏,我希望用户能够调整窗口大小,而不会让图像搞得一团糟。是否有一种特定的方法用于缩放图像以及JFrame和JFrame中的组件,在这种情况下是按钮,标签,面板等? BTW。我知道如何缩放其他组件而不是图像

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"));

0 个答案:

没有答案