Nobody downloaded yet

Java Programming - Essay Example

Comments (0) Cite this document
Summary
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 paperFile format: .doc, available for editing
GRAB THE BEST PAPER92.3% of users find it useful
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
Cite this document
  • APA
  • MLA
  • CHICAGO
(“Java Programming Essay Example | Topics and Well Written Essays - 1500 words”, n.d.)
Retrieved from https://studentshare.org/technology/1531938-java-programming
(Java Programming Essay Example | Topics and Well Written Essays - 1500 Words)
https://studentshare.org/technology/1531938-java-programming.
“Java Programming Essay Example | Topics and Well Written Essays - 1500 Words”, n.d. https://studentshare.org/technology/1531938-java-programming.
  • Cited: 0 times
Comments (0)
Click to create a comment or rate a document
CHECK THESE SAMPLES - THEY ALSO FIT YOUR TOPIC
Java
...?Java Programming Access Modifiers a) Difference between public, protected and private Members (variables, methods or declared private can be accessed only by the members of the same class. Accessing a private member outside the enclosing class will result in variable declaration error. In other words, private members are strictly bound within the limits of its declaring class. Members defined with protected modifier can be accessed by classes outside the enclosing class but within the same package. However members declared protected in super class can be accessed by its subclasses, but only if they are present in same package. Members declared public have no bounds, they can be accessed from anywhere by...
7 Pages(1750 words)Research Paper
Programming Project in Java
..., if available. Sequence Diagram Project Code The software program has five classes which are as follows:- 1. Burrito Brothers:- 2. Customer 3. Server 4. Customer Generator 5. World The detailed code of the classes is as follows:- Code for Class Burrito Brothers:- import java.util.SortedSet; import java.util.TreeSet; import java.util.Collections; import java.util.concurrent.Semaphore; public class BurritoBrothers { final public static int CUSTOMER_CAPACITY = 15; final public static int COUNTER_CAPACITY = 3; final private Server servers[]; private SortedSet customersWaitingForBurrito; private final Semaphore counterSemaphore = new Semaphore(COUNTER_CAPACITY, true); private final Semaphore...
8 Pages(2000 words)Assignment
Java programming and written exercises
...1. Assume an Account object has data members - account number and balance, which can be defined as a string, an integer and a double type respectively. The following program provides the partial Java code for the class Account declaration. Please complete the accessor methods getName(), getBalance(), the mutator method setNameBalance(), and the toString() method which outputs the name, account number and balance. public class Account { InputStreamReaderinp =newInputStreamReader(System.in); BufferedReaderbr=newBufferedReader(inp); private String name; private int accNum; private double balance; public Account(String name, int accNum, double...
3 Pages(750 words)Essay
Java Programming
.../* Java Swing Calculator import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JOptionPane; public class Calculator extends JFrame implements ActionListener { ...
5 Pages(1250 words)Math Problem
Java Game Programming, any future
... 31 October 2009 Future of Java in game development Introduction Java has become one of the powerful languages ever created and has become one of the leading languages being utilized in the industry of Information and Technology. Basically designed for the improvement of network programming, Java has covered large areas in orthodox applications as well as distributed and embedded systems. 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. The main feature of Java is that it is a platform... ...
15 Pages(3750 words)Essay
Java Programming Essay
...DrawingWindow usage in Java Introduction The DrawWindow in Java's element package is a very useful tool and a program is written to demonstrate its capability in animation. There are methods for using arcs, lines, rectangles, circles and other forms using these basic features. Also, colors can be included through the java.awt package. About the Program 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...
4 Pages(1000 words)Essay
Java
...that block should not execute should the exception occur. Should the exception occur, the catch block handles the exception. This is import especially when we expect the user to make a mistake when entering the details of the container. 4. SUMMARY. The code in most cases is self explanatory and where there seems to be complications, I have tried my best to make it clear and easy to understand. Also note that in this explanation I have not included the following classes; circular.java, open.java, rectangular.java, circular.java. This is because I had created the classes in the initial stage of application design which latter changed and never implemented them at all. You can actually comment all these classes and the application will run...
4 Pages(1000 words)Coursework
Introduction to Java Programming
...Java Program: Library Application (Section) Due) Introduction It involves the development of a library application which forms part of an upgrade initiative with two main users as the borrowers and the employee with employees interacting with the application more than the borrowers. The first step in the development of the application is the design; in this case it involves the design of the case diagrams, sequence diagram and class diagram. Class Diagram There are four major entities involved in the development of this application including: the library itself, books, employees and the borrowers. Documentation of the Class Diagram The library lends books to the borrowers and at the same time catalogues...
2 Pages(500 words)Research Paper
Java Spring MVC Programming Introduction
...Java Spring MVC Programming Introduction Java Spring MVC Programming Introduction Spring framework is a kind of open source framework that is used for building applications on the Java platform. This framework’s core features are usable on any Java application. There are however some extensions for building web applications besides the Java EE platform. Spring framework features include: Inversion of control container The inversion of control container provides a consistent way of configuration and management of Java objects by using reflection. Aspect oriented programming The aspect...
4 Pages(1000 words)Essay
Java PROGRAMMING
...Java Programming al Affiliation Java Programming The term structured programming in the simplest and most basic sense refers to the subset of procedural programming that are modified and enforced in a logical manner and structure. The aim and objective of structured programming is to enable the program to be more effective, efficient and for the users to understand and comprehend them. 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...
1 Pages(250 words)Essay
sponsored ads
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.
Let us find you another Essay on topic Java Programming for FREE!
logo footer
Contact us:
+16312120006
Contact Us Now
FREE Mobile Apps:
  • StudentShare App Store
  • StudentShare Google play
  • About StudentShare
  • Testimonials
  • FAQ
  • Blog
  • Free Essays
  • New Essays
  • Essays
  • Miscellaneous
  • The Newest Essay Topics
  • Index samples by all dates
Join us:
Contact Us