We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Nobody downloaded yet

Java Programming - Essay Example

Comments (0)
I have designed the calculator using JAVA. Swing is the concept that has been employed in it. I have used many features of JAVA in designing the calculator. From the line no 5 to 26 I have used the inbuilt packages in JAVA library and used the concept of inheritance to import the required files using the import statement.
Download full paper
Java Programming
Read TextPreview

Extract of sample
Java Programming

Download file to see previous pages... Here we have used the access specifier as public which tells us that the class can be accessed anywhere in the program. In the same line we have used the concept of Inheritance, which is the process by which one object acquires the properties of another object. By the use of extends keyword we inherit all the functionality provided in the class JFrame, which is used to create a frame using Swings. Further we implement the interface ActionListener using the implements keyword. By interface we mean that we can specify what a class must do, but now how it does it. Here we have implemented the ActionListener interface and so we have to define it. The purpose of ActionListener interface is to receive the Action Events. When the action event occurs, that object's action Performed method is invoked. Moving into the class body, we have declared variables with final keyword so that their value retains constant throughout the program. Then from line no 41 onwards we have created the objects of classes that will be used in the program and are defined with access specified private so that only the code inside this class can manipulate them. At line no 56 we see the constructor, which initializes an object immediately upon creation. It has the same name as the class in which it resides. The constructor is automatically called after the object is created. From the line no 63 onwards we have referenced the various objects and then called their respective methods to do the job. The new operation instantiates an object of a particular class, and returns a reference to it.
At line no 126, I have used the syntax

Container contentPane = getContentPane();

Here the method get ContentPane returns the contentPane object for this frame. And further we add components to the frame. From line no 138 I have created the buttons for the calculator using grid layout. The GridLayout class is a layout manager that lays out a container's components in a rectangular grid. The container is divided into equal-sized rectangles, and one component is placed in each rectangle. Then using the predefined class JButton we have created the buttons for the sign +, -, * and so on. At line no 192 we have set panel layout manager for a 4 by 5 grid. Then from line no 198 we add buttons to keypad panel starting at top left. We set the layout of masterpanel as border layout at the line no 239

masterPanel.setLayout(new BorderLayout());

and then we add the components in west, east and south direction. At line 246 we use request
focus which requests that this Component gets the input focus. From line no 251 we have used addActionListener method to register the events. At line 260 we used the method addWindowListener which adds the specified window listener to receive window events from this window. It is used for closing frame and ending program. As we mentioned above whenever an action is performed the function

Public void actionPerformed(ActionEvent e)

is automatically called. This method is invoked when an action occurs. From the line no 299 we have used an important feature of JAVA called the switch-case. The switch statement in Java provides a convenient method for branching a program based on a number of conditionals.
From line no 499 we have used various methods like

setDisplayString(), getDisplayString (), addDigit(int digit), ...Download file to see next pagesRead More
Comments (0)
Click to create a comment
Advatages of using java programing language
Java is a popular programming language that was designed specifically for Internet use. Previous programming languages were concentrated at one centralized location, whereas Java was distributed and designed for use within computer networks. A straightforward, easy-to-use program language became necessary with the rise in popularity of the Internet at the end of the 1970s and the beginning of 1980s.
3 Pages(750 words)Essay
Exploring Programming Languages
Java is an object-oriented programming language created in 1995 by Sun Microsystems for the development of software applications and interactive programs or applets which are commonly used in the internet for animation purposes. In today's evolution in mobile industry, Java contributes more advancement in the making of mobile applications and software.
3 Pages(750 words)Essay
Java programming and written exercises
3 Pages(750 words)Essay
Java Game Programming, any future
In a study conducted in US, it was found that more than 50 percentages of the developers prefer Java in developing applications and this figure is constantly rising. There are several reasons that could be cited for this advancement. Java is a widely used language due to its numerous advantages.
15 Pages(3750 words)Essay
Java Programming Essay
The first objective of the task thus is in creating an object that is composite with some shapes available. The next objective is to enhance the code so that many composite objects can be included efficiently in terms of time and space. The last objective is to demonstrate the animation capabilities available through the package.
4 Pages(1000 words)Essay
Java programing
These data elements are modeled as classes and they are active entities that can manipulate the data contained in themselves and in other classes. Finally, the system behavior is modeled after the interactions of these data items
1 Pages(250 words)Essay
History of Java / History of CPU Speed (clock rate)
Over time, Java has been released as Java 1.0 and Java 2.0, and is used in different machines and applications, especially over Internet
1 Pages(250 words)Essay
Java Spring MVC Programming Introduction
The aspect oriented programing module in the spring framework modularizes cross cutting concerns in aspects. This module provides aspect oriented programing features without much complexity in design, configuration or implementation. This module
4 Pages(1000 words)Essay
Java technology related to this tool
At the same time, java does not have an automatic type conversion and a pointer, but has a java compiler each of which arranged in a systematic level to help in
1 Pages(250 words)Essay
Object programming on the other hand refers to a programming technique that is founded on the aspects of data structures which imbibe the data (Hughes, 2009). It is important to note and record that the data exist in
1 Pages(250 words)Essay
Let us find you another Essay on topic Java Programming for FREE!
Contact us:
Contact Us Now
FREE Mobile Apps:
  • About StudentShare
  • Testimonials
  • FAQ
  • Blog
  • Free Essays
  • New Essays
  • Essays
  • The Newest Essay Topics
  • Index samples by all dates
Join us:
Contact Us