What is Form load event handler in Java?
If you're using Swing's JFrame, try using addWindowListener (inherited from java.awt.Window)
The listener's windowOpened method looks like where you want to be...
This simple sample is useful.
public static void main(String[] args) {
JFrame fa = new JFrame();
fa.setBounds(100, 100, 400, 200);
fa.setVisible(true);
fa.addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {
JOptionPane.showMessageDialog(fa, "windowOpened");
}
@Override
public void windowClosing(WindowEvent e) {
JOptionPane.showMessageDialog(fa, "windowClosing");
}
@Override
public void windowClosed(WindowEvent e) {
JOptionPane.showMessageDialog(fa, "windowClosed");
}
@Override
public void windowIconified(WindowEvent e) {
JOptionPane.showMessageDialog(fa, "windowIconified");
}
@Override
public void windowDeiconified(WindowEvent e) {
JOptionPane.showMessageDialog(fa, "windowDeiconified");
}
@Override
public void windowActivated(WindowEvent e) {
// JOptionPane.showMessageDialog(fa, "windowActivated");
}
@Override
public void windowDeactivated(WindowEvent e) {
// JOptionPane.showMessageDialog(fa, "windowDeactivated");
}
});
}