Hi all,
I am a newbie to java and hence I have been using online examples to learn how to code java. One big problem I am having is where in the code does the program actually start. I have a java swing code in which I want to call a subroutine to read in some settings from a text file on start up either before or just after the main frame is set visible.
eg
private void someroutine(){
}
I have tried to call the routine from various locations in the main statement below but I get is the error
"non-static method readSettings() cannot be referenced from a static context"
Any help will be apprieciated.
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* How to Set the Look and Feel (The Java™ Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClass Name());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ContactEditorUI .class.getName()).log(java.util.logging.Level.SEVE RE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ContactEditorUI .class.getName()).log(java.util.logging.Level.SEVE RE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ContactEditorUI .class.getName()).log(java.util.logging.Level.SEVE RE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ContactEditorUI .class.getName()).log(java.util.logging.Level.SEVE RE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new ContactEditorUI().setVisible(true);
}
});
}