Question

Windows on the desktop are just one of many objects used in a graphical user interface...

Windows on the desktop are just one of many objects used in a graphical user interface (GUI)-- buttons, drop-down list boxes, pop-up menus, are just some of the many others. Regardless of their particular appearance, tasks, and structure, all such GUI components share some common functionality-- which is handled in a manner unique to the actual component .

Define an interface, GUIComponent, with the following methods :

onClick-- void-returning and accepts a single integer  parameter

onCursorFocus -- void-returning and accepts a single integer  parameter

move -- 3 overloaded methods : all boolean -returning; one accepts a pair of integer  parameters ; the second a single parameter of type Position; the third a single parameter of type Dimension

resize-- boolean -returning and accepts a pair of integer  parameters

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.awt.*;
import java.awt.event.*;
/*********************************************/
  
public category MyCalculator extends Frame
mathematician setClear=true;
double variety, memValue;
char op;
  
String digitButtonText[] = ;
String operatorButtonText[] = ;
String memoryButtonText[] = ;
String specialButtonText[] = ;
  
MyDigitButton digitButton[]=new MyDigitButton[digitButtonText.length];
MyOperatorButton operatorButton[]=new MyOperatorButton[operatorButtonText.length];
MyMemoryButton memoryButton[]=new MyMemoryButton[memoryButtonText.length];
MySpecialButton specialButton[]=new MySpecialButton[specialButtonText.length];
  
Label displayLabel=new Label("0",Label.RIGHT);
Label memLabel=new Label(" ",Label.RIGHT);
  
final int FRAME_WIDTH=325,FRAME_HEIGHT=325;
final int HEIGHT=30, WIDTH=30, H_SPACE=10,V_SPACE=10;
final int TOPX=30, TOPY=50;
///////////////////////////
MyCalculator(String frameText)//constructor
  
  
//set Co-ordinates for Special Buttons
tempX=TOPX+1*(WIDTH+H_SPACE); y=TOPY+1*(HEIGHT+V_SPACE);
for(int i=0;i<specialButton.length;i++)
  
  
//set Co-ordinates for Digit Buttons
int digitX=TOPX+WIDTH+H_SPACE;
int digitY=TOPY+2*(HEIGHT+V_SPACE);
tempX=digitX; y=digitY;
for(int i=0;i<digitButton.length;i++)
  
}
  
//set Co-ordinates for Operator Buttons
int opsX=digitX+2*(WIDTH+H_SPACE)+H_SPACE;
int opsY=digitY;
tempX=opsX; y=opsY;
for(int i=0;i<operatorButton.length;i++)
  
}
  
addWindowListener(new WindowAdapter()
  
});
  
setLayout(null);
setSize(FRAME_WIDTH,FRAME_HEIGHT);
setVisible(true);
}
//////////////////////////////////
static String getFormattedText(double temp)
  
////////////////////////////////////////////////
static mathematician isInString(String s, char ch)
come true;
return false;
}
/////////////////////////////////////////////////
public void actionPerformed(ActionEvent ev)
catch(NumberFormatException e)
  
if (index==0 && cl.displayLabel.getText().equals("0")) return;
  
if(cl.setClear)
zero.");}
return;
}
if(opText.equals("sqrt"))
  
catch(ArithmeticException excp)
  
// method = button ironed
switch(cl.op)
  
catch(ArithmeticException excp)
  

Add a comment
Know the answer?
Add Answer to:
Windows on the desktop are just one of many objects used in a graphical user interface...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Graphical User Interface Programming (Code using JavaScript w/ Intellij idea) This assignment can be done using...

    Graphical User Interface Programming (Code using JavaScript w/ Intellij idea) This assignment can be done using either the Java Swing Library or the Java FX Library Design a universal remote control for an entertainment system such as (cable / TV, etc). Create the interface as a Java Intellij project. Optionally, you may design the interface for a smartphone. This is Very Important If you are implementing your design using the Swing Library, the assignment cannot be created using the GUI...

  • REQUIREMENTS: Write a Graphical User Interface (GUI) program using JavaFX that prompts the user to enter...

    REQUIREMENTS: Write a Graphical User Interface (GUI) program using JavaFX that prompts the user to enter a credit card number. Display whether the number is valid and the type of credit cards (i.e., Visa, MasterCard, American Express, Discover, and etc). The requirements for this assignment are listed below: • Create a class (CreditNumberValidator) that contains these methods: // Return true if the card number is valid. Boolean isValid(String cardNumber); // Get result from Step 2. int sumOfDoubleEvenPlace(String cardNumber); // Return...

  • //*Manager.java*// public interface Manager { public void handleCrisis(); } _________________________________________________________ /**Employee.java**/ Public abstract class Employee {...

    //*Manager.java*// public interface Manager { public void handleCrisis(); } _________________________________________________________ /**Employee.java**/ Public abstract class Employee { protected final String name; protected final int id; public Employee(String empName, int empId) { name = empName; id = empId; } public Employee() { name = generatedNames[lastGeneratedId]; id = lastGeneratedId++; } public String getName() { return name; } public int getId() { return id; } //returns true if work was successful. otherwise returns false (crisis) public abstract boolean work(); public String toString() { return...

  • Rational Number *In Java* A rational number is one that can be expressed as the ratio...

    Rational Number *In Java* A rational number is one that can be expressed as the ratio of two integers, i.e., a number that can be expressed using a fraction whose numerator and denominator are integers. Examples of rational numbers are 1/2, 3/4 and 2/1. Rational numbers are thus no more than the fractions you've been familiar with since grade school. Rational numbers can be negated, inverted, added, subtracted, multiplied, and divided in the usual manner: The inverse, or reciprocal of...

  • This in in C# There are two classes, class Fraction and class FractionDemo The user needs...

    This in in C# There are two classes, class Fraction and class FractionDemo The user needs to be able to input a value for the numerator and the denominator Create a Fraction class with private fields that hold a positive int numerator and a positive int denominator. In addition, create Properties for each field with the set mutator such that the numerator is greater than or equal to 0 and the denominator is greater than 0 (illegal values should be...

  • Introduction In this final programming exercise, you'll get a chance to put together many of the...

    Introduction In this final programming exercise, you'll get a chance to put together many of the techniques used during this semester while incorporating OOP techniques to develop a simple song playlist class. This playlist class allows a user to add, remove and display songs in a playlist. The Base Class, Derived Class and Test Client Unlike the other PAs you completed in zyLabs, for this PA you will be creating THREE Java files in IntelliJ to submit. You will need...

  • Wanted by the Police: A Good Interface By KATIE HAFNER NOV. 11, 2004 From: The New...

    Wanted by the Police: A Good Interface By KATIE HAFNER NOV. 11, 2004 From: The New York Times, Technology section, not-for profit classroom used. SAN JOSE, Calif. - SAN JOSE has a reputation as one of the safest large cities in the nation, with the fewest police officers per capita. Yet a number of the 1,000 officers in this city of 925,000 in the heart of Silicon Valley have been worrying about their own safety of late. Since June, the...

  • JAVA :The following are descriptions of classes that you will create. Think of these as service...

    JAVA :The following are descriptions of classes that you will create. Think of these as service providers. They provide a service to who ever want to use them. You will also write a TestClass with a main() method that fully exercises the classes that you create. To exercise a class, make some instances of the class, and call the methods of the class using these objects. Paste in the output from the test program that demonstrates your classes’ functionality. Testing...

  • Writing traversal methods You will create two files in the csc403 package: one called A3SimplerBST.java and...

    Writing traversal methods You will create two files in the csc403 package: one called A3SimplerBST.java and the other TestA3.java. Details on these programs appears below. Copy the file SimplerBST.java from the week 1 examples package and rename the file and class A3SimplerBST. Add two public methods: one named twoChildrenCount that takes no parameters and that, when called, traverses every node of the tree to count how many nodes have two children. one named sameValueCount that takes a paremeter of generic...

  • I have Majority of the code written but I just need to implement the <,>,and =...

    I have Majority of the code written but I just need to implement the <,>,and = sign in the code. I have posted the instructions for the whole code. I will add what I have at the end. Objectives: Implement basic class concepts in Java Implement inheritance with super and sub-classes Implement basic polymorphism concepts Problem: The TARDIS has been infected by a virus which means it is up to Doctor Who to manually enter calculations into the TARDIS interface....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT