Is there a simple way to create several TextFields with JavaFX? - java

I am attempting to create about a dozen TextFields and was wondering if there is a quick and easy way to do this.
tfTime1 = new TextField();
tfActivity1 = new TextField();
tfTime2 = new TextField();
tfActivity2 = new TextField();
tfTime3 = new TextField();
tfActivity3 = new TextField();
tfTime4 = new TextField();
tfActivity4 = new TextField();
tfTime5 = new TextField();
tfActivity5 = new TextField();
tfTime6 = new TextField();
tfActivity6 = new TextField();
I feel like there's a more efficient way of doing this that I am not aware of

You could use a simple for loop to add new TextFields to a List:
List<TextField> timeTextFields = new ArrayList<>();
for (int i = 0; i < 5; i++) {
timeTextFields.add(new TextField("Time #" + i));
}

Related

I can't click on the buttons

I'm making a sales system, and in the area where the total sums are described, I can't click on the buttons.
I tried to remove buttons from the gridpane and they work for me but when I integrate them into the gridpane they lose focus or stop working
Pane root = new Pane();
Separator top = new Separator(Orientation.HORIZONTAL);
top.setPrefWidth(1310);
Separator left = new Separator(Orientation.VERTICAL);
left.setPrefHeight(150);
left.setPadding(new Insets(0,0,10,0));
Separator low = new Separator(Orientation.HORIZONTAL);
low.setPadding(new Insets(140,10,0,0));
low.setPrefWidth(1323);
Separator right = new Separator(Orientation.VERTICAL);
right.setPrefHeight(150);
right.setPadding(new Insets(0,0,10,1310));
Label descuento = new Label("Descuento: ");
Label sub = new Label("Sub-Total: ");
Label iva = new Label("Iva: ");
Label total = new Label("Total: ");
Label rsub = new Label("0000.00");
Label riva= new Label("16%");
Label rtotal = new Label("0.0000");
Button btn_generate = new Button("generate");
MenuItem opc = new MenuItem("Opc");
MenuItem opc1= new MenuItem("opc1");
MenuButton menu1 = new MenuButton("Type",null,opc,opc1);
MenuItem opc2 = new MenuItem("opc2");
MenuItem opc3 = new MenuItem("opc3");
MenuButton menu2 = new MenuButton("Opc",null,opc2,opc3);
GridPane Gtotal = new GridPane();
Gtotal.setHgap(20);
Gtotal.setVgap(10);
Gtotal.setPadding(new Insets(10,0,0,10));
ColumnConstraints column1 = new ColumnConstraints(rtotal.getPrefWidth(),rtotal.getPrefWidth(),rtotal.getPrefWidth());
ColumnConstraints column2 = new ColumnConstraints(total.getPrefWidth()+450,total.getPrefWidth()+450,total.getPrefWidth()+450);
ColumnConstraints column3 = new ColumnConstraints(riva.getPrefWidth(),riva.getPrefWidth(),riva.getPrefWidth());
ColumnConstraints column4 = new ColumnConstraints(iva.getPrefWidth()+330,iva.getPrefWidth()+330,iva.getPrefWidth()+330);
ColumnConstraints column5 = new ColumnConstraints(rsub.getPrefWidth(),rsub.getPrefWidth(),rsub.getPrefWidth());
ColumnConstraints column6 = new ColumnConstraints(sub.getPrefWidth(),sub.getPrefWidth(),sub.getPrefWidth());
Gtotal.getColumnConstraints().add(0,column1);
Gtotal.getColumnConstraints().add(0,column2);
Gtotal.getColumnConstraints().add(0,column3);
Gtotal.getColumnConstraints().add(0,column4);
Gtotal.getColumnConstraints().add(0,column5);
Gtotal.getColumnConstraints().add(0,column6);
GridPane.setConstraints(descuento, 0, 0);
GridPane.setConstraints(menu1, 1, 0);
GridPane.setConstraints(menu2, 2, 0);
GridPane.setConstraints(sub, 0, 1);
GridPane.setConstraints(rsub, 1, 1);
GridPane.setConstraints(iva, 2, 1);
GridPane.setHalignment(iva, HPos.RIGHT);
GridPane.setConstraints(riva, 3, 1);
GridPane.setConstraints(total, 4, 1);
GridPane.setHalignment(total, HPos.RIGHT);
GridPane.setConstraints(rtotal, 5, 1);
GridPane.setConstraints(btn_generate, 5, 2);
Gtotal.getChildren().addAll(descuento,sub,rsub,iva,riva,total,rtotal,btn_generate,menu1,menu2);
root.getChildren().addAll(top,left,Gtotal,low,right);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
I hope that when running the program I can click on the buttons.
Marcos Antonio You are really making work for yourself not using Scene Builder
That said here is 3 lines of code that make a button fire an event
Button btnOK = new Button("OK");
btnOK.addEventHandler(ActionEvent.ACTION,filter);
btnOK.setOnAction((ActionEvent evt) -> {
The problem was the separators that overlapped the other layout by the padding

incompatible types: Scene cannot be converted to Parent JavaJDK netbeans

i have create a simple form with java jdk that contain a button, when user click the button it show the 2nd form and close the 1st form, but i have error like this in netbeans:
error: incompatible types: Scene cannot be converted to Parent
Scene secondScene = new Scene(scene2, 300,250);
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
now the full code of start :
public void start(Stage primaryStage) {
GridPane grid1 = new GridPane();
Button butt1 = new Button();
butt1.setText("Applique KPPV");
grid1.add(butt1, 2, 6);
Scene scene1 = new Scene(grid1, 300, 250);
primaryStage.setTitle("KNN With JDK");
primaryStage.setScene(scene1);
primaryStage.show();
butt1.setOnAction(e->{
GridPane grid = new GridPane();
// Labels & inputs Settings
Label number1 = new Label("Data 1 :");
Label number2 = new Label("Data 2 :");
Label number3 = new Label("Data 3 :");
Label number4 = new Label("Data 4 :");
Label number5 = new Label("Data 5 :");
Label numberk = new Label("K :");
Label resultat1 = new Label("The Result");
TextField txt1 = new TextField();
TextField txt2 = new TextField();
TextField txt3 = new TextField();
TextField txt4 = new TextField();
TextField txt5 = new TextField();
TextField txtk = new TextField();
grid.add(number1, 0, 0);
grid.add(number2, 0, 1);
grid.add(number3, 0, 2);
grid.add(number4, 0, 3);
grid.add(number5, 0, 4);
grid.add(numberk, 0, 5);
grid.add(resultat1, 0, 7);
grid.add(txt1, 1, 0);
grid.add(txt2, 1, 1);
grid.add(txt3, 1, 2);
grid.add(txt4, 1, 3);
grid.add(txt5, 1, 4);
grid.add(txtk, 1, 5);
Button butt = new Button();
butt.setText("Applique KPPV");
grid.add(butt, 0, 6);
// My Main Method
///////////////////////////////////
// ADDED THESE 5 LINES. NOW IT SHOWS A WINDOW WITH THESE VALUES FILLED IN
txt1.setText("0.0");
txt2.setText("0.0");
txt3.setText("0.0");
txt4.setText("0.0");
txt5.setText("0.0");
txtk.setText("10");
double insertedInt = Double.parseDouble(txt1.getText());
double insertedInt2 = Double.parseDouble(txt2.getText());
double insertedInt3 = Double.parseDouble(txt3.getText());
double insertedInt4 = Double.parseDouble(txt4.getText());
double insertedInt5 = Double.parseDouble(txt5.getText());
///////////////////////////////////
Scene scene = new Scene(grid, 300, 250);
// Final Action
butt.setOnAction(event -> {
double[] query = { insertedInt, insertedInt2, insertedInt3, insertedInt4, insertedInt5 };
int k = Integer.parseInt(txtk.getText());
List<City> cityList = new ArrayList<City>();
List<Result> resultList = new ArrayList<Result>();
cityList.add(new City(instances[0], "IRIS0"));
cityList.add(new City(instances[1], "IRIS1"));
cityList.add(new City(instances[2], "IRIS2"));
cityList.add(new City(instances[3], "IRIS3"));
cityList.add(new City(instances[4], "IRIS4"));
cityList.add(new City(instances[5], "IRIS5"));
cityList.add(new City(instances[6], "IRIS6"));
cityList.add(new City(instances[7], "IRIS7"));
cityList.add(new City(instances[8], "IRIS8"));
cityList.add(new City(instances[9], "IRIS9"));
// find distances
for (City city : cityList) {
double dist = 0.0;
for (int j = 0; j < city.cityAttributes.length; j++) {
dist += Math.pow(city.cityAttributes[j] - query[j], 2);
}
double distance = Math.sqrt(dist);
resultList.add(new Result(distance, city.cityName));
}
Collections.sort(resultList, new DistanceComparator());
String[] ss = new String[k];
for (int x = 0; x < k; x++) {
ss[x] = resultList.get(x).cityName;
}
String majClass = findMajorityClass(ss);
// System.out.println("The Nearest IRIS Class is : "+majClass);
resultat1.setText(majClass);
});
Scene secondScene = new Scene(scene, 500,500);
Stage secondStage = new Stage();
secondStage.setScene(secondScene); // set the scene
secondStage.setTitle("Second Form");
secondStage.show();
primaryStage.close(); // close the first stage (Window)
});
}

If-Else statements

Hey guys I am making a java application to book installation. I am trying to set up an If else statement to make the InstallType column print out either "Standard" or "Custom"
The way it needs to do this is: if the numOutlets variable is greater than 4 OR is numZones is greater than 2 then is should print out Custom.
If the number of either numOutlets is lower or equal to 4 or the number in numZones is equal to or less than 2 it should print out "Standard".
I am trying to make it do this on the enterButton:
public void enterButtonClicked(){
Installation installation = new Installation();
installation.setCustomerName(nameInput.getText());
installation.setHouseNumber(Double.parseDouble(houseInput.getText()));
installation.setStreetName(streetInput.getText());
installation.setTown(townInput.getText());
installation.setNumOutlets(Integer.parseInt(outletInput.getText()));
installation.setNumZones(Integer.parseInt(zoneInput.getText()));
installationTable.getItems().add(installation);
double numOutlets = Double.parseDouble(outletInput.getText());
double numZones = Double.parseDouble(zoneInput.getText());
if (numOutlets>=2 || numZones>=5)
installationType = "Custom";
else
installationType = "Standard";
installType.setText(InstallationType + "");
nameInput.clear();
houseInput.clear();
streetInput.clear();
townInput.clear();
outletInput.clear();
zoneInput.clear();
}
This is my TableView
public void start(Stage primaryStage) throws Exception {
window = primaryStage;
window.setTitle("CQ Air-Conditioning");
//installationID
TableColumn<Installation, Integer> installationID = new TableColumn<>("Installation ID");
installationID.setMinWidth(100);
installationID.setCellValueFactory(new PropertyValueFactory<>("installationNumber"));
//CustomerName
TableColumn<Installation, String> nameColumn = new TableColumn<>("Name");
nameColumn.setMinWidth(200);
nameColumn.setCellValueFactory(new PropertyValueFactory<>("customerName"));
//House Number
TableColumn<Installation, Double> houseNo = new TableColumn<>("House Number");
houseNo.setMinWidth(100);
houseNo.setCellValueFactory(new PropertyValueFactory<>("houseNumber"));
//Street Name
TableColumn<Installation, String> street = new TableColumn<>("Street Name");
street.setMinWidth(200);
street.setCellValueFactory(new PropertyValueFactory<>("streetName"));
//Town Name
TableColumn<Installation, String> Town = new TableColumn<>("Town Name");
Town.setMinWidth(200);
Town.setCellValueFactory(new PropertyValueFactory<>("town"));
//number outlets
TableColumn<Installation, Double> numberOutlets = new TableColumn<>("Outlets");
numberOutlets.setMinWidth(50);
numberOutlets.setCellValueFactory(new PropertyValueFactory<>("numOutlets"));
//number Zones
TableColumn<Installation, Double> numberZones = new TableColumn<>("Zones");
numberZones.setMinWidth(50);
numberZones.setCellValueFactory(new PropertyValueFactory<>("numZones"));
//Installation Type
TableColumn<Installation, String> installType = new TableColumn<>("Type of Installation");
installType.setMinWidth(200);
installType.setCellValueFactory(new PropertyValueFactory<>("installationType"));
//total cost
TableColumn<Installation, Double> cost = new TableColumn<>("Total Cost");
cost.setMinWidth(150);
cost.setCellValueFactory(new PropertyValueFactory<>("totalCost"));
//nameInput
nameInput = new TextField();
nameInput.setPromptText("Enter Name");
nameInput.setMinWidth(100);
//houseInput
houseInput = new TextField();
houseInput.setPromptText("enter house number");
//streetInput
streetInput = new TextField();
streetInput.setPromptText("enter street Name");
//town input
townInput = new TextField();
townInput.setPromptText("enter town");
//outlets input
outletInput = new TextField();
outletInput.setPromptText("enter number of outlets");
//zones input
zoneInput = new TextField();
zoneInput.setPromptText("enter number of zones");
//buttons
Button enterButton = new Button ("Enter");
enterButton.setOnAction(e -> enterButtonClicked());
enterButton.setMinWidth(200);
Button clearButton = new Button ("Clear");
clearButton.setOnAction(e -> clearButtonClicked());
clearButton.setMinWidth(50);
Button deleteButton = new Button ("Delete");
deleteButton.setOnAction(e -> deleteButtonClicked());
deleteButton.setMinWidth(50);
Button exitButton = new Button ("Exit");
exitButton.setOnAction(e -> exitButtonClicked());
exitButton.setMinWidth(50);
HBox hbox = new HBox();
hbox.setPadding(new Insets(25, 10, 50, 10));
hbox.setSpacing(10);
hbox.getChildren().addAll(nameInput, houseInput, streetInput, townInput, outletInput, zoneInput);
HBox buttons = new HBox();
buttons.setPadding(new Insets(10,10,10,10));
buttons.setSpacing(15);
buttons.setAlignment(Pos.CENTER);
buttons.getChildren().addAll(clearButton, enterButton, deleteButton, exitButton);
installationTable = new TableView<>();
installationTable.setItems(getInstallation());
installationTable.getColumns().addAll(installationID, nameColumn, houseNo, street, Town, numberOutlets, numberZones, installType, cost);
VBox vbox = new VBox();
vbox.getChildren().addAll(hbox,installationTable, buttons);
Scene scene = new Scene(vbox);
window.setScene(scene);
window.show();
}
I am using a "Main" class and a class called "Installation" with my variables and getters and setters.
This is my variables in the "Installation" Class
private String customerName;
private String streetName;
private String town;
private String installationType;
private double postCode;
private double houseNumber;
private int numZones;
private int numOutlets;
private double totalCost;
private double standardCost = 7200;
private double customCost;
private int installationNumber = 0;
Thank you to anybody that helps me, i have been trying at this for ages and cant quite seem to get it. Thanks so much! sorry if i am not posting correctly, still trying to learn.
I think I see your problem. This is the code that you have now:
if (numOutlets>=2 || numZones>=5)
installationType = "Custom";
else
installationType = "Standard";
This is what you need to change it to:
if (numZones>=2 || numOutlets>=5)
installationType = "Custom";
else
installationType = "Standard";
It appears based on the above code you had the variables switched.

How to convert java or class file to exe file [duplicate]

This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 8 years ago.
I have been created a java app using swing and I want to convert to an exe file how to do it.
public Performance() {
f = new JFrame("Ticket Booking");
f1 = new JFrame("Payment Details");
f2 = new JFrame("Payment Successfull");
l1 = new JLabel("Movies :");
l2 = new JLabel("Timing :");
l3 = new JLabel("Class:");
l4 = new JLabel();
l5 = new JLabel();
l6 = new JLabel("No of Person:");
l11 = new JLabel("Movies :");
l22 = new JLabel();
l33 = new JLabel("Timing :");
l44 = new JLabel();
l55 = new JLabel("Class:");
l66 = new JLabel();
l77 = new JLabel("No of Person:");
l88 = new JLabel();
l99 = new JLabel("Amount:");
l00 = new JLabel();
lsuccess = new JLabel(" Thank u For booking Ticket...");
c1 = new JComboBox(s1);
c2 = new JComboBox(s2);
r1 = new JRadioButton("10:00pm");
r2 = new JRadioButton("1:00pm");
r3 = new JRadioButton("4:30pm");
buttongroup = new ButtonGroup();
b1 = new JButton("Submit");
b11 = new JButton("Pay Bill");
b22 = new JButton("Edit");
t1 = new JTextField(10);
}
To convert (actually, package) .class files into .jar files, you use the Jar tool. You can then generate a .exe file from the .jar using tools like Launch4j, JSmooth or several other packages (search the web for "jar exe").

java.lang.numberformatexception empty string java awt

public class CustomCalculator extends Frame implements ActionListener{
Panel jp1 = new Panel();
Panel jp2 = new Panel();
Panel jp3 = new Panel();
Panel jp4 = new Panel();
Panel jp5 = new Panel();
Panel center_merge = new Panel();
Label l2 = new Label("Quantity : ");
TextField l2a = new TextField(20);
Label l3 = new Label("Invoice Value : ");
TextField l3a = new TextField(20);
Label l4 = new Label("Exchange Rate : ");
TextField l4a = new TextField(20);
Label l5 = new Label("Costing(A) : ");
TextField l5a = new TextField();
Label l6 = new Label("(A + 1%)(B) : ");
Label l6a = new Label();
Label l7 = new Label("BCD (C) : ");
Label l7a = new Label("");
Label l8 = new Label("CVD (D) : ");
Label l8a = new Label("");
Label l9 = new Label("Custom Education Cess (E) : ");
Label l9a = new Label("");
Label l10 = new Label("Custom Sec & Higher Edu.Cess (F) : ");
Label l10a = new Label("");
Label l11 = new Label("Additional Duty Imports (G) : ");
Label l11a = new Label("");
Label l12 = new Label("Total (H) : ");
Label l12a = new Label("");
Label l13 = new Label("Costing+Total (I) : ");
Label l13a = new Label("");
Label l14 = new Label("(H/Quantity) (J) : ");
Label l14a = new Label("");
Label l15 = new Label("4% SAD (G/Quantity) (K) : ");
Label l15a = new Label("");
Label l16 = new Label("Net Costing (L) : ");
Label l16a = new Label("");
Label l17 = new Label("Transportation (M) : ");
TextField l17a = new TextField(5);
Label l18 = new Label("Godown Rate (N) : ");
TextField l18a = new TextField(5);
Label l19 = new Label("Brokerage (O) : ");
TextField l19a = new TextField(5);
Label l20 = new Label("Actual Costing (P) : ");
Label l20a = new Label("");
Label l21 = new Label("Small Gatepass (Q) : ");
Label l21a = new Label("");
Label l22 = new Label("Big Gatepass (R) : ");
Label l22a = new Label("");
Button l2b = new Button("reset");
Button l3b = new Button("reset");
Button l4b = new Button("reset");
Button master_reset = new Button("reset all");
Button calc = new Button("Calculate");
public CustomCalculator()
{
super("Custom Calculator");
this.setSize(800,700);
jp1.setLayout(new FlowLayout());
//jp1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
jp1.add(l2);
jp1.add(l2a);
jp1.add(l2b);
jp1.add(l3);
jp1.add(l3a);
jp1.add(l3b);
jp1.add(l4);
jp1.add(l4a);
jp1.add(l4b);
jp2.setLayout(new GridLayout(6,2));
//jp2.setBorder(BorderFactory.createLineBorder(Color.GRAY));
jp2.add(l5);
jp2.add(l5a);
jp2.add(l6);
jp2.add(l6a);
jp2.add(l7);
jp2.add(l7a);
jp2.add(l8);
jp2.add(l8a);
jp2.add(l9);
jp2.add(l9a);
jp2.add(l10);
jp2.add(l10a);
jp3.setLayout(new GridLayout(6,2));
//jp3.setBorder(BorderFactory.createLineBorder(Color.GRAY));
jp3.add(l11);
jp3.add(l11a);
jp3.add(l12);
jp3.add(l12a);
jp3.add(l13);
jp3.add(l13a);
jp3.add(l14);
jp3.add(l14a);
jp3.add(l15);
jp3.add(l15a);
jp3.add(l16);
jp3.add(l16a);
jp4.setLayout(new GridLayout(6,2));
//jp4.setBorder(BorderFactory.createLineBorder(Color.GRAY));
jp4.add(l17);
jp4.add(l17a);
jp4.add(l18);
jp4.add(l18a);
jp4.add(l19);
jp4.add(l19a);
jp4.add(l20);
jp4.add(l20a);
jp4.add(l21);
jp4.add(l21a);
jp4.add(l22);
jp4.add(l22a);
center_merge.setLayout(new GridLayout(1,3));
//center_merge.setBorder(BorderFactory.createLineBorder(Color.GRAY));
center_merge.add(jp2);
center_merge.add(jp3);
center_merge.add(jp4);
jp5.setLayout(new FlowLayout());
//jp5.setBorder(BorderFactory.createLineBorder(Color.GRAY));
jp5.add(calc);
jp5.add(master_reset);
this.setLayout(new BorderLayout());
this.add(jp1,BorderLayout.NORTH);
this.add(center_merge,BorderLayout.CENTER);
this.add(jp5,BorderLayout.SOUTH);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
l2b.addActionListener(this);
l3b.addActionListener(this);
l4b.addActionListener(this);
calc.addActionListener(this);
master_reset.addActionListener(this);
this.setVisible(true);
}
public static void main(String[] args) {
new CustomCalculator();
}
#Override
public void actionPerformed(ActionEvent ae) {
double quantity = 0;
double invoice_value = 0;
double exchange_rate = 0;
double A=0;
double B=0;
double C=0;
double D=0;
double E=0;
double F=0;
double G=0;
double H=0;
double I=0;
double J=0;
double K=0;
double L=0;
double M = 0;
double N = 0;
double O=0;
double P=0;
double Q=0;
double R=0;
try
{
quantity = Double.parseDouble(l2a.getText());
invoice_value = Double.parseDouble(l3a.getText());
exchange_rate = Double.parseDouble(l4a.getText());
M = Double.parseDouble(l17a.getText());
N = Double.parseDouble(l18a.getText());
O = Double.parseDouble(l19a.getText());
A = invoice_value*exchange_rate;
B = A+(0.01*A);
C = 0.075*B;
D = 0.12*(B+C);
E = 0.02*(C+D);
F = 0.01*(C+D);
G = 0.04*(B+C+D+E+F);
H = C+D+E+F+G;
I = A+H;
J = H/quantity;
K = G/quantity;
L = J-K;
P = L+M+N+O;
Q = (0.12*B)/quantity;
R = Q+K;
if(ae.getActionCommand().equals("calc"))
{
l5a.setText(String.valueOf(A));
l6a.setText(String.valueOf(B));
l7a.setText(String.valueOf(C));
l8a.setText(String.valueOf(D));
l9a.setText(String.valueOf(E));
l10a.setText(String.valueOf(F));
l11a.setText(String.valueOf(G));
l12a.setText(String.valueOf(H));
l13a.setText(String.valueOf(I));
l14a.setText(String.valueOf(J));
l15a.setText(String.valueOf(K));
l16a.setText(String.valueOf(L));
l20a.setText(String.valueOf(P));
l21a.setText(String.valueOf(Q));
l22a.setText(String.valueOf(R));
}
else if(ae.getActionCommand().equals("master_reset"))
{
l5a.setText("");
l2a.setText("");
l3a.setText("");
l4a.setText("");
}
}
catch (Exception ex)
{
l5a.setText(ex.toString());
// l3a.setText(ex.toString());
}
}
}
After I click the Calculate button (button calc) the calculated values do not appear in the respective labels and an exception is shown saying java.lang.NumberFormatException: Empty string. I am not able to figure out the solution. please help.
the line exchange_rate = Double.parseDouble(l4a.getText()); gives you this exception, because there is no value in l4a and you are trying to parse it into a double value,
try printing the exception in the catch clause.
It's probably a relatively safe bet to say that it is happening here at the beginning of your function, though you should provide the actual exception and line number for us.
quantity = Double.parseDouble(l2a.getText());
invoice_value = Double.parseDouble(l3a.getText());
exchange_rate = Double.parseDouble(l4a.getText());
M = Double.parseDouble(l17a.getText());
N = Double.parseDouble(l18a.getText());
O = Double.parseDouble(l19a.getText());
Make sure that each of these fields actually has numeric text in it. I would recommend putting a logging line or an alert line to state their values before this is executed. Better yet, you can catch the first line in a debugger and look at the the values of all of the items you're calling getText() on. I bet one has an empty string.

Categories