Question: Please don't do this on a drag-drop interface like Eclipse or similar etc. They have to be manually coded, please manually code it! Question 1:

Please don't do this on a drag-drop interface like Eclipse or similar etc. They have to be manually coded, please manually code it!

Question 1:

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

Please don't do this on a drag-drop interface like Eclipse or similar

It has three buttons, each of which does one thing; Add, Subtract, Concatenate. It has 1 checkbox Facebook which modifies the add button so it displays Facebook, thus proving Facebook is more interesting than Math. (Joke)

Here are examples of each function

Add

etc. They have to be manually coded, please manually code it! Question

Subtract

1: Write a simple swing form that has the following features and

Concatenate (example 1)

looks (more or less) like the following: It has three buttons, each

Concatenate (example 2)

of which does one thing; Add, Subtract, Concatenate. It has 1 checkbox

Add with Facebook checked

Facebook which modifies the add button so it displays Facebook, thus proving

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

getContentPane().setLayout(null);

setTitle("Homework Code");

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

String text = text1.getText();

try

{

val1 = Double.parseDouble(text);

}

catch (NumberFormatException e)

{

val1=0;

rc=false;

JOptionPane.showMessageDialog(null, "Enter a valid double precision number please",

">",

JOptionPane.ERROR_MESSAGE);

}

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

public class bAddAction implements ActionListener

{

public void actionPerformed (ActionEvent event)

{

///// -----------------

////// Lines deleted here that parsed the JTextFields into val1 and val2

///// -----------------

if (rc)

{displayText4.setText(String.format("%12.4f",(val1 + val2)));}

else

{displayText4.setText("0");}

}

}

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

int posX =260;

JButton buttonAdd = new JButton("Add");

buttonAdd.setLocation(posX,30);

buttonAdd.setSize(110,20);

buttonAdd.addActionListener(new bAddAction());

getContentPane().add(buttonAdd);

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

First Number: Add Subtract Concatenate Second Number: 0 Facebook

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!