The following code works:
public class Main {
public static void main (String args[]){
final JWindow f = new JWindow();
JLabel l = new JLabel(new ImageIcon(Main.class.getResource("images/logo.png")));
f.getContentPane().add(l, BorderLayout.CENTER);
f.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = l.getPreferredSize();
f.setLocation(screenSize.width/2 - (labelSize.width/2),
screenSize.height/2 - (labelSize.height/2));
f.setVisible(true);
f.setAlwaysOnTop(true);
}
}
When I use exactly the same code in a different class (public class appForm extends javax.swing.JFrame) the screen that pops up is blank, however it does have the dimensions of the loaded image. If I try to load a different image, the dimensions of the JWindow always correspond to the dimensions of the image (so it can't be a wrong file path problem right? the image seems to be there) but it's always white.