The preferred method of achieving the task at hand is going to depend on the requirements of whether the original image is going to be needed at a later time or not. setIcon method of Java Swing JLabel class. However, as the JLabel is going to use a scaled-down image of the original, it would mean that the amount of memory required would be reduced (if that a concern) and original image would not have to be resized every time image is being displayed, as would be the case with overriding the paintComponent method. The limitation to this method is, that if the JLabel is resized in any way, then the image contained by the JLabel will not be resized. Menu items that have no icon set are aligned using the default icon. Now, one could create an ImageIcon to use on the JLabel. Returns the default icon size that is used in menus, menu items and toolbars. Img.getScaledInstance(lblDisPic.getWidth(), lblDisPic.getHeight(), null)
Then, the loaded image can be resized to the dimension of the JLabel, using Image.getScaledInstance. Image img = ImageIO.read(fc.getSelectedFile())
Icon implementations may use the Component argument to get properties useful for painting, e.g. One way could be to change the actionPerformed method, so the image will be loaded from the specified file, using ImageIO.read method to read the image, then resizing the image before an ImageIcon is created. void paintIcon ( Component c, Graphics g, int x, int y) Draw the icon at the specified location. Given the example code, one approach is to resize the image to display on the JLabel before the setIcon method is called.