Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Introduction This part of your main assignment should be done individually. This assignment consists of writing a program and demonstrating it or submitting it on Moodle. NOTE: while you can do this...

1 answer below »

Introduction

 

This part of your main assignment should be done individually. This assignment consists of writing a program and demonstrating it or submitting it on Moodle.

 

NOTE: while you can do this using drag and drop in eclipse or some other java development environment you should be warned that;  I will put coding questions in the exam that assume you wrote this swing form yourself manually coding the listeners and attaching them to buttons. You are unlikely to learn how to do this if you use drag and drop GUI builders.

 

GENERAL INSTRUCTIONS

 

Write a simple swing form that has the following features and looks (more or less) like the following:

 

 

It has three buttons, each of which does one thing; Add, Subtract, Concatenate.

 

Here are examples of each function

 

Add

 

 

Subtract

Answered Same Day Oct 29, 2019

Solution

David answered on Nov 30 2019
133 Votes
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class Form extends JFrame implements ActionListener {
    JFrame frame;
    JLabel firstNumberLabel, secondNumberLabel, resultLine, resultLabel;
    JTextField inputFieldOne, inputFieldTwo;
    Font ft;
    JButton addButton, subtractButton, concatenateButton;
    Form() {
        
initialize frame and set its properties
        frame = new JFrame("Assignment PartA");
        frame.setLayout(null);
        frame.setSize(500, 300);
        frame.setResizable(false);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
initialize elements
        addButton = new JButton("Add");
        subtractButton = new JButton("Subtract");
        concatenateButton = new JButton("Concatenate");
        ft = new Font("Courier New", Font.BOLD, 18);
        firstNumberLabel = new JLabel("First...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here