how to How to change button properties from another class?

Java please help what variables whould i change to make this into a seperate class?

  • please help i need to make a seperate class to do these calculations an invoice class and im not sure what to do bc i just wrote the code on the GUI class when the calculate button is clicked but i need to make a seperate class that has the calculations then call it througgh the main class. private void calculateJButtonActionPerformed( ActionEvent event ) { // get user inputs String orderNumber = orderNumberJTextField.getText(); String name = nameJTextField.getText(); String address1 = addressJTextField1.getText(); String address2 = addressJTextField2.getText(); // total of white/black dice ordered double whiteTotals = 0.0; // total of red/black dice ordered double redTotals = 0.0; // calculate price if white/black JCheckBox is selected if ( whiteTypeJCheckBox.isSelected() ) { whiteTotals = Integer.parseInt( whiteQuantityJTextField.getText() ) * 6.25; } // calculate price if red/black JCheckBox is selected if ( redTypeJCheckBox.isSelected() ) { redTotals = Integer.parseInt( redQuantityJTextField.getText() ) * 5.00; } // display message if order number, name or address is empty if ( orderNumber.equals( "" ) || name.equals( "" ) || address1.equals( "" ) || address2.equals( "" ) || orderNumber.equals( "0" ) || name.equals( "Enter name here" ) || address1.equals( "Address Line 1" ) || address2.equals( "City, State, Zip" ) ) { // display message JOptionPane.showMessageDialog( null, "Please fill out all information fields.", "Empty Fields", JOptionPane.WARNING_MESSAGE ); } else if ( !whiteTypeJCheckBox.isSelected() && !redTypeJCheckBox.isSelected() ) { // display message if no JCheckBox is // selected and its quantity is 0 JOptionPane.showMessageDialog( null, "Please select an item and enter a quantity.", "No Item selected", JOptionPane.WARNING_MESSAGE ); } else // otherwise, calculate totals { // set display format DecimalFormat dollars = new DecimalFormat( "$0.00" ); // display totals of dice ordered whiteTotalsJTextField.setText( dollars.format( whiteTotals ) ); redTotalsJTextField.setText( dollars.format( redTotals ) ); // calculate and display subtotal double subtotal = whiteTotals + redTotals; subtotalJTextField.setText( dollars.format( subtotal ) ); // calculate and display tax double tax = subtotal * 0.05; taxJTextField.setText( dollars.format( tax ) ); // calculate and display total totalJTextField.setText( dollars.format( subtotal + tax ) ); } // end else }

  • Answer:

    LOL

B at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.