926 Files and Streams Chapter 16 230 // (Web design rates)
926 Files and Streams Chapter 16 230 // display error if cannot read 231 // because problem with file 232 catch ( IOException ioException ) { 233 JOptionPane.showMessageDialog( this, 234 “Error reading from file”, 235 “Error”, JOptionPane.ERROR_MESSAGE ); 236 } 237 238 } // end method readRecords 239 240 // uses record ty to determine if a record should be displayed 241 private boolean shouldDisplay( double balance ) 242 { 243 if ( accountType.equals( “Credit balances” ) && 244 balance < 0 ) 245 246 return true; 247 248 else if ( accountType.equals( "Debit balances" ) && 249 balance > 0 ) 250 251 return true; 252 253 else if ( accountType.equals( “Zero balances” ) && 254 balance == 0 ) 255 256 return true; 257 258 return false; 259 } 260 261 // execute application 262 public static void main( String args[] ) 263 { 264 new CreditInquiry(); 265 } 266 267 // private inner class for creditButton, debitButton and 268 // zeroButton event handling 269 private class ButtonHandler implements ActionListener { 270 27 // read records from file 27 public void actionPerformed( ActionEvent event ) 27 { 27 accountType = event.getActionCommand(); 27 readRecords(); 27 } 27 27 } // end class ButtonHandler 27 280 } // end class CreditInquiry Fig. 16.9Credit inquiry program (part 6 of 7). Fig. 16.9
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.