... JOptionPane.PLAIN_MESSAGE);
49         }
50      }
51
52      // retrieve equation from web service and display left side to user
53      private void generateJButtonActionPerformed(
54         java.awt.event.ActionEvent evt)
55      {
56         try
57         {
58            String url = String.format("http://localhost:8080/" + 
59               "EquationGeneratorXML/webresources/equation/%s/%d",
60               operation, difficulty);                            
61
62            // convert XML back to an Equation object
63            Equation equation = JAXB.unmarshal(url, Equation.class); 
64
65            answer = equation.getResult();                             
66            equationJLabel.setText(equation.getLeftHandSide() + " ="); 
67            checkAnswerJButton.setEnabled(true);
68         }
69         catch (Exception exception)
70         {
71            exception.printStackTrace();
72         }
73      }
74
75      // obtains the mathematical operation selected by the user
76      private void operationJComboBoxItemStateChanged( ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.