I have a program that uses the java swing jframe as my main class.
It passes the arguments to the jframe which then calls another method from its constructor called populate menus.
This then goes and reads the files that will make upthe menus.
My question is should I create and object that reads in all the files and pass that to my constructor?
Below is what I do now.
I seperate the arguments(these are the config file locations) and then I call the constructor of the jframe which i then pass the values.
public static void main(args[]){
final String isoconfig = args[0];
final String userlist = args[1];
final String equipment_list = args[2];
final String config = args[3];
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try{
new UserInterFace(isoconfig,userlist,equipment_list,config).setVisible * (true);;}
catch(IOException ioe){
System.out.println(ioe.getMessage());}}
});}
}
Here is the constructor code
public UserInterFace(String isoList,String userList, String equipment_list, String config)throws IOException {
initComponents();
populatemenus(isoList,userList,equipment_list,config);
initObjects();}
What I was thinking was to do this
public static void main(args[]){
Readfiles configfiles = new Readfiles(args);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try{
new UserInterFace(configfiles).setVisible(true);;}
catch(IOException ioe){System.out.println(ioe.getMessage());}}
});}}
For simplicity, maybe it would be better to do just like this: