Scientific Calculator: Report Title
Scientific Calculator: Report Title
Scientific Calculator: Report Title
Scientific Calculator
College of Engineering
Salahaddin University-Erbil
1
ABSTRACT
Basic Controls The calculator graphical user interface (GUI) has four main
parts, the menu bar, the display, and the button panel. The display is where
problems and their solutions will be shown.
2
TABLE OF CONTENTS
Abstract 2
Table of Contents 3
Introduction 4
Class Hierarchy 5
Conclusion 13
References 14
3
INTRODUCTION
4
Class Hierarchy:
object
main
Component
Container
Window
Frame
JFrame
Scientific_calculator
5
BACKGROUND & REVIEW
GUI components:
6
3. TextField - is a component that implements a single line of text, and
is a part of javax.swing package. The class JTextField is a
component that allows editing of a single line of text. JTextField
inherits the JTextComponent class and uses the interface
SwingConstants.
7
Some Methods of the JTextField :
8
Why using these components:
1. buttons: the most important thing for calculator is buttons like Button
Group, Radio Button, Button and toggle button. In this project the
most needed is just a button for doing operations and pressing
numbers, Generally, Button is basic of calculator.in this calculator I
didn’t used radio button which you should use Button group it and it
can be used as a ON and OFF switch for calculator, but I didn’t use
in this project because you should use a huge code for ON and OFF
and it’s not necessary in this sample project.
9
4. JMenuBar: this component is basically for switching between
standard calculator and basic calculator and can be switched by using
Ctrl + S for Standard and Ctrl + B for basic, this menu bare is very
helpful, At first the calculator is just one part but then with menu bar
I divided it for two part basic and scientific
The Java Swing allows us to customize the GUI by changing the look and
feel(L&F). The look defines the general appearance of components and the
feel defines their behavior. L&Fs are subclasses of the LookAndFeel class
and each L&F is identified by its fully qualified class name.
10
Event Handler:
Method:
void actionPerformed(ActionEvent e)
extend EventListener
The listener interface for receiving window events. The class that is
interested in processing a window event either implements this interface
(and all the methods it contains) or extends the abstract WindowAdapter
class (overriding only the methods of interest). The listener object created
from that class is then registered with a Window using the winodw's
addWindowListener method. When the window's status changes by virtue
of being opened, closed, activated or deactivatedthe relevant method in the
listener object s invoked, and the WindowEvent is passed to it.
Method:
void windowactivated(WindowEvent e)
Invoked when the window is set to be the user's active window, which means
the window will receive keyboard events.
12
CONCLUSION
In this project I learned A lot of things, one of the most important things is
using java swing for creating GUI which is very helpful, another thing is
using even handlers for doing actions with buttons and this
project(Calculator) is very good to start other project, it is basic to start a
big project.at First I was Serious to Choose this Project but then learned
lots of points from the project like using GUI components correctly,
organize my code, and using java swing.
13
REFERENCES
[1] https://www.javatpoint.com/java-awt
[2] https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html
[3]https://docs.oracle.com/javase/tutorial/uiswing/
[4]https://docs.oracle.com/javase/7/docs/api/java/beans/EventHandler.html
14