Ask Java Expert


Home >> Java

I am sort on time and upablet ot complet the attached problem and i need help to compelt the work.

//**************************************************************************************************

// CLASS: Main

//**************************************************************************************************

import javax.swing.JFrame;
public class Main {
public static void main(String[] pArgs) {

new Main().run();

}
public void run() {

JFrame.setDefaultLookAndFeelDecorated(true);

View view = new View();

}
}

//**************************************************************************************************

// CLASS: View

//

// DESCRIPTION

// Implements the GUI for a calculator.

//**************************************************************************************************

import java.awt.BorderLayout;

import java.awt.Dimension;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.Box;

import javax.swing.BoxLayout;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JTextField;
/**

* Implements the GUI for a calculator.

*/

public class View extends JFrame implements ActionListener {
public static final int FRAME_WIDTH = 500;

public static final int FRAME_HEIGHT = 200;
private JTextField mText;
/**

* Default ctor. Does nothing.

*/

public View() {

// Declare and create a JPanel named panelFunctButton. Set the layout manager to GridLayout

// with 2 rows and 2 columns. Call addButton() to add buttons labeled "x^y", "log 10",

// "log e", and "sqrt".

???
// Declare and create a JPanel named panelSysButton. Use the default FlowLayout layout

// manager. Call addButton() to add buttons labeled "Clear", "About", and "Exit".

???
// Declare and create a JPanel named panelFunctSys. Use the BorderLayout layout manager.

// Add panelFunctButton to the CENTER region. Add panelSysButton to the SOUTH region.

???
// Declare and create a JPanel named panelKeypad. Use the GridLayout layout manager with

// 4 rows and 4 columns. Call addButton() to add the buttons labeled "7", "8", "9", and so

// on.

???
// Declare and create a new JPanel named panelBottom. Use the vertical BoxLayout layout

// manager. Add panelKeypad. Add a 10-pixel wide rigid area (using Box.createRigidArea()).

// Add panelFunctSys.

???
// Declare and create a JPanel named panelTextField. Use the default FlowLayout layout

// manager. Create the mText JTextField making it 30 columns wide. Add mText to the

// panelTextField panel.

???
// Declare and create a JPanel named panelLabel. Use the default FlowLayout layout manager.

// Declare and create a JLabel named label displaying "Kalkutron-9000" or whatever you

// want to display. Add label to panelLabel.

???
// Declare and create a JPanel named panelMain. Use the horizontal BoxLayout layout manager.

// Add some vertical glue to panelMain (using Box.createVerticalGlue()). Add panelLabel.

// Add some more vertical glue. Add panelTextField. Add panelBottom. Add some more vertical

// glue.

???
// Set the title bar string of this JFrame.

setTitle("Kalkutron-9000");
// Set the width and height of this JFrame.

setSize(FRAME_WIDTH, FRAME_HEIGHT);
// Configure this JFrame so the frame will be closed and the application were terminate when

// the X button on the title bar is closed.

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Add panelMain to this JFrame.

add(panelMain);
// Make this JFrame visible.

setVisible(true);

}
/**

* Declare and create a JButton object displaying pText. Make this JFrame the action listener

* for button events. Add the button to pPanel.

*/

private void addButton(JPanel pPanel, String pText) {

JButton button = new JButton(pText);

button.addActionListener(this);

pPanel.add(button);

}
/**

* Implementation of the actionPerformed() method of the ActionListener interface.

*/

@Override

public void actionPerformed(ActionEvent pEvent) {

// If the source of the event is a JButton, calling pEvent.getActionCommand() will return

// the text displayed on the button face. For example, when the Exit button is clicked,

// pEvent.getActionCommand() would return "Exit".
// Write code that determines if the Exit button is the source of the event and if so,

// exit the application by calling System.exit().

???
// Write code that determines if the About button is the source of the event and if so,

// display the about dialog using JOptionPane.showMessageDialog().

???

}
}

Attachment:- Attachment.pdf

Java, Programming

  • Category:- Java
  • Reference No.:- M91733757
  • Price:- $120

Priced at Now at $120, Verified Solution

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As