I am getting this error message in the program I'm working on (line 150), and am wondering what it means? This is an exercise for a college class; just want to declare that; this is not my own work.
Here is the program that I am working with: - // This application inputs and outputs account information.
-
import java.awt.*;
-
import java.awt.event.*;
-
import javax.swing.*;
-
import javax.swing.border.*;
-
-
public class AccountInformation extends JFrame
-
{
-
// JPanel to group deposit components
-
private JPanel enterJPanel;
-
-
// JLabel and JTextField for deposits
-
private JLabel depositJLabel;
-
private JTextField depositJTextField;
-
-
// JButton to initiate balance calculation
-
private JButton enterJButton;
-
-
// JPanel to group account information components
-
private JPanel accountJPanel;
-
-
// JLabel and JTextField for account holder's name
-
private JLabel nameJLabel;
-
private JTextField nameJTextField;
-
-
// JLabel and JTextField for account number
-
private JLabel accountNumberJLabel;
-
private JTextField accountNumberJTextField;
-
-
// JLabel and JTextField for balance
-
private JLabel balanceJLabel;
-
private JTextField balanceJTextField;
-
-
// no-argument constructor
-
public AccountInformation()
-
{
-
createUserInterface();
-
}
-
-
// create and position GUI components; register event handlers
-
private void createUserInterface()
-
{
-
// get content pane and set layout to null
-
Container contentPane = getContentPane();
-
contentPane.setLayout( null );
-
-
// set up enterJPanel
-
enterJPanel = new JPanel();
-
enterJPanel.setLayout( null );
-
enterJPanel.setBounds( 16, 16, 152, 126 );
-
enterJPanel.setBorder(
-
new TitledBorder( "Enter information" ) );
-
contentPane.add( enterJPanel );
-
-
// set up depositJLabel
-
depositJLabel = new JLabel();
-
depositJLabel.setText( "Deposit amount:" );
-
depositJLabel.setBounds( 16, 40, 140, 16 );
-
enterJPanel.add( depositJLabel );
-
-
// set up depositJTextField
-
depositJTextField = new JTextField();
-
depositJTextField.setText( "0" );
-
depositJTextField.setBounds( 16, 56, 120, 21 );
-
depositJTextField.setHorizontalAlignment( JTextField.RIGHT );
-
enterJPanel.add( depositJTextField );
-
-
// set up enterJButton
-
enterJButton = new JButton();
-
enterJButton.setText( "Enter" );
-
enterJButton.setBounds( 16, 150, 152, 34 );
-
contentPane.add( enterJButton );
-
enterJButton.addActionListener(
-
-
new ActionListener() // anonymous inner class
-
{
-
// event handler called when enterJButton is pressed
-
public void actionPerformed( ActionEvent event )
-
{
-
enterJButtonActionPerformed( event );
-
}
-
-
} // end anonymous inner class
-
-
); // end call to addActionListener
-
-
// set up accountJPanel
-
accountJPanel = new JPanel();
-
accountJPanel.setLayout( null );
-
accountJPanel.setBounds( 180, 16, 136, 170 );
-
accountJPanel.setBorder(
-
new TitledBorder( "Account information" ) );
-
contentPane.add( accountJPanel );
-
-
// set up nameJLabel
-
nameJLabel = new JLabel();
-
nameJLabel.setText( "Name:" );
-
nameJLabel.setBounds( 16, 24, 100, 16 );
-
accountJPanel.add( nameJLabel );
-
-
// set up nameJTextField
-
nameJTextField = new JTextField();
-
nameJTextField.setText( "Sue Purple" );
-
nameJTextField.setBounds( 16, 40, 104, 21 );
-
nameJTextField.setEditable( false );
-
accountJPanel.add( nameJTextField );
-
-
// set up accountNumberJLabel
-
accountNumberJLabel = new JLabel();
-
accountNumberJLabel.setText( "Account Number:" );
-
accountNumberJLabel.setBounds( 16, 70, 140, 16 );
-
accountJPanel.add( accountNumberJLabel );
-
-
// set up accountNumberJTextField
-
accountNumberJTextField = new JTextField();
-
accountNumberJTextField.setText( "12345" );
-
accountNumberJTextField.setBounds( 16, 86, 104, 21 );
-
accountNumberJTextField.setEditable( false );
-
accountNumberJTextField.setHorizontalAlignment(
-
JTextField.RIGHT );
-
accountJPanel.add( accountNumberJTextField );
-
-
// set up balanceJLabel
-
balanceJLabel = new JLabel();
-
balanceJLabel.setText( "Balance:" );
-
balanceJLabel.setBounds( 16, 116, 100, 16 );
-
accountJPanel.add( balanceJLabel );
-
-
// set up balanceJTextField
-
balanceJTextField = new JTextField();
-
balanceJTextField.setText( "0" );
-
balanceJTextField.setBounds( 16, 132, 104, 21 );
-
balanceJTextField.setEditable( false );
-
balanceJTextField.setHorizontalAlignment( JTextField.RIGHT );
-
accountJPanel.add( balanceJTextField );
-
-
// set properties of application's window
-
setTitle( "Account Information" ); // set title bar text
-
setSize( 340, 225 ); // set window size
-
setVisible( true ); // display window
-
-
} // end method createUserInterface
-
-
// method called when enterJButton is pressed
-
private void enterJButtonActionPerformed( ActionEvent event )
-
{
-
// display new balance
-
balanceJTextField.setText( String.valueOf(
-
Integer.parseint( balanceJTextField.getText() ) *
-
Integer.parseint( depositJTextField.getText() ) ) );
-
-
// clear depositJTextField
-
depositJTextField.setText( "0" );
-
-
} // end method enterJButtonActionPerformed
-
-
// main method
-
public static void main( String[] args )
-
{
-
AccountInformation application = new AccountInformation();
-
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
-
-
} // end method main
-
-
} // end class AccountInformation
1 11608
Use code Tags, while you do Post.
use "Integer.parseI nt" means you written "parseint".
And follow the method name convention in Java.
Debasis Jana
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sergio |
last post by:
I want to execute a method of one applet from one page HTML.
If I execute the method that it reads from rows from init() all it
works.
f instead I execute the method through document.applet.method() I
obtain one Exception java.security.AccessControlException: access
denied. Where mistake?
Thanks
Sergio
|
by: Robin Tucker |
last post by:
I'm localizing and need to find all string literals in my source code. I
don't want to find any of the literals that will end up in resources
however. As I don't use the "Me" keyword, I know these are found in the
InitialiseComponent method and are therefore literals on a line of code
preceeded with "Me.".
So, is there a regular expression that will find all literals NOT on a line
preceeded with "Me."?
Thanks :/
|
by: bobueland |
last post by:
The module string has a function called translate. I tried to find the
source code for that function. In:
C:\Python24\Lib
there is one file called
string.py
I open it and it says
|
by: Bryan_Cockrell |
last post by:
Hi World,
I am extracting text from an ebcdic header using dd in the cygwin environment (bash/ksh) as below in order to rename the file to something intelligent.
I'm using a specific string position here ($10) but the text I extract is sometimes in a different position in the header so I need to search for preceding text "LINE:" and then extract the next string, which is the info I'm interested in.
So - using awk or sed (or perl if need...
|
by: csharpula csharp |
last post by:
Hello,
I want to implement "wild card" search by searching files with *name*
criteria.
What is the best way? Should I do foreach to all names or maybe there is
a better way?
*** Sent via Developersdex http://www.developersdex.com ***
| |
by: nishit.gupta |
last post by:
Is their any fuction available in C++ that can determine that a string
contains a numeric value.
The value cabn be in hex, int, float. i.e. "1256" , "123.566" ,
"0xffff"
Thnx
|
by: shapper |
last post by:
Hello,
I have two arrays of strings, s1 and s2:
s1 = "london, lisbon, paris, newyork"
s2 = "lisbon, yellow, France"
s2 will have only one item included in s1.
|
by: =?Utf-8?B?SGlwZXJpWA==?= |
last post by:
Hello,
I am workin' on creating web from as pdf file.
My pdf file size is 595 x 820 points. Can anybody tell how can I count the
length of my string in points?
string x;
|
by: korean_dave |
last post by:
How can i use the find() function on a string that is composed of tons
of symbols that cause errors...
THis is my string:
find("<html><head><meta name="qrichtext" content="1" /><style
type="text/css">p, li { white-space: pre-wrap; }</style></head><body
style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:
400; font-style:normal; text-decoration:none;"><p style=" margin-top:
0px; margin-bottom:0px; margin-left:0px;...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |