2

A image is read and is displayed as splash before the actual things come out. Now problem is that i want to fix the resolution of image accroding to the computer in which it get executed. How this can be done?

Code is as below

import javax.swing.*;
import java.awt.*;

public class FrmSplash extends JWindow implements Runnable{
    public void run(){
        JLabel SplashLabel = new JLabel(new ImageIcon("Image001.jpg"));

            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    getContentPane().add(SplashLabel,BorderLayout.CENTER);

    setLocation((screen.width),(screen.height));
    show();
}
}

This on compilation give following error Note: Recompile with -Xlint:deprecation for details. Again compiled with -Xlint but more sorts of errors.

Rajeev Kumar
  • 435
  • 2
  • 7
  • 20

2 Answers2

5

Use this: GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()

Radu Murzea
  • 10,724
  • 10
  • 47
  • 69
StanislavL
  • 56,971
  • 9
  • 68
  • 98
4

this is about method show();, is long time depreciated, use setVisible() instead, code could be

import javax.swing.*;
import java.awt.*;

public class FrmSplash extends JWindow implements Runnable {

    private static final long serialVersionUID = 1L;

    public void run() {
        JLabel SplashLabel = new JLabel(new ImageIcon("Image001.jpg"));
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        getContentPane().add(SplashLabel, BorderLayout.CENTER);
        setSize((screen.width), (screen.height));
        setVisible(true);
    }
}
mKorbel
  • 109,525
  • 20
  • 134
  • 319