I just switched to java 9 from java 8. I am using following code to build a splash screen. Splash screen comes in the center of the monitor if I use java 8, but with java 9 its not in center. Any idea, what can I do?
public void showSplashScreen() throws MalformedURLException
{
dialog = new JDialog();
dialog.setModal(false);
dialog.setUndecorated(true);
dialog.getRootPane().setOpaque(false);
dialog.getContentPane().setBackground(new Color(0, 0, 0, 0));
dialog.setBackground(new Color(0, 0, 0, 0));
URL imageURL = SomeClass.class.getClassLoader().getResource("resources/" + fImage);
JLabel background = new JLabel(new ImageIcon(imageURL));
background.setLayout(new BorderLayout());
dialog.add(background);
String versionInfo = readVersion();
JLabel text = new JLabel(versionInfo);
text.setFont(new Font("Courier New", Font.PLAIN, 14));
text.setForeground(Color.WHITE);
text.setBorder(BorderFactory.createEmptyBorder(240, 272, 150, 50));
background.add(text);
progressBar.setMaximum(PROGBAR_MAX);
dialog.add(progressBar, BorderLayout.SOUTH);
startProgressBar();
dialog.pack();
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
}