Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Need help changing Main to allow user input using scanner class:public class GUIparser {   //Creates the class’ constructor

Need help changing Main to allow user input using scanner class:public class GUIparser {

//Creates the class’ constructor

private static Scanner scnr;

private static File inp_file;

Need assignment help for this question?

If you need assistance with writing your essay, we are ready to help you!

OUR PROCESS

Order

Payment

Writing

Delivery

Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality

private static String getLabel(String file_lines) {

;

int cntr;

file_lines.trim();

for (cntr = 0; cntr < file_lines.length(); cntr++) {

char tmp=file_lines.charAt(cntr);

boolean b2 = Character.isLetter(tmp);

if (!b2){

break;

}

}

return file_lines.substring(0, cntr);

}

public static void main(String[] args) {

String strng, lbl;

try{

inp_file = new File(“Input.txt”);

scnr = new Scanner(inp_file); //Reads from the file

if (scnr.hasNextLine()) {

strng = scnr.nextLine().trim();

lbl = getLabel(strng); //Get the componenent label

if (!lbl.equalsIgnoreCase(“Window”)) {

System.out.println(“First label should be WINDOW”); //If the window is not labelled

return;

}

strng = strng.substring(lbl.length()).trim();

JFrame frame = (JFrame) addCompntRec(strng, lbl);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

}

else{

System.out.println(“Unknown Error”);

}

}

catch (FileNotFoundException exp){

System.out.println(“File not found”); //If the file is not found

exp.printStackTrace();

}

catch (Exception excep) {

System.out.println(“Unknown Error”);

“Order a similar paper and get 15% discount on your first order with us
Use the following coupon
“FIRST15”

Order Now