简体   繁体   中英

JFrame Icon Resolution

I'm quite new to working with java GUIs. To start me up, I had a look into JFrame. While playing around with it, I used the setIconImage() method to set the logo of my JFrame. However, when I run the file, the logo resolution gets reduced so much that I can barely recognise it. Here's my current code and the dimensions of my image is 1280 x 1280 (I have tried reducing it down to 100 x 100 but it still returned the same results.):

    @SuppressWarnings("serial")
    public class GUIManager extends JFrame{
        public void openGUI(String value){
            if(value.equalsIgnoreCase("startMenu")){
                GUIManager manager = new GUIManager();
                ImageIcon logo = new
                ImageIcon(ResourcesLoader.class.getResource("Logo.png"));

                manager.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                manager.setVisible(true);
                manager.setResizable(false);
                manager.setLocationRelativeTo(null);
                manager.setSize(300, 500);
                manager.setBackground(Color.WHITE);
                manager.setTitle("FileLocker");
                manager.setIconImage(logo.getImage());
            } //value check
        } //openGUI
    } //GUIManager

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM