Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3813956 • Letter: W

Question

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

Explanation / Answer

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)
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote