simplecalculator
Class SimpleCalculator

java.lang.Object
  extended by csdk.v1_0.helper.application.AbstractApplication
      extended by csdk.v1_0.helper.AbstractCSDKApplication
          extended by csdk.v1_0.helper.AbstractCSDKWindowApplication
              extended by simplecalculator.SimpleCalculator
All Implemented Interfaces:
IApplication, IApplicationContext, ICommandContext, IContext, ICSDKEnvironment, ILocalFileSystemContext, IProjectContext, ActionListener, Serializable, EventListener

public class SimpleCalculator
extends AbstractCSDKWindowApplication
implements ActionListener

Aplicação de calculadora simples.

Author:
Tecgraf/PUC-Rio
See Also:
Serialized Form

Field Summary
static int OpDivide
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
static int OpMClear
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
static int OpMinus
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
static int OpMPlus
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
static int OpMR
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
static int OpMultiply
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
static int OpPlus
          The following integer values are being set as "final" because they are going to be used for determining what button has been pushed
 
Constructor Summary
SimpleCalculator(ICSDKEnvironment csdkInterface)
          Construtor.
 
Method Summary
 void actionPerformed(ActionEvent event)
          This method is called whenever an action is performed on the applet, * specifically whenever one of the buttons on the applet is pressed *
protected  void applicationEnded()
          
protected  void applicationStarted(JFrame frame)
          Montagem do diálogo principal.
 JPanel buildPanel()
          This the only method that is called explicitly -- every other method is called depending on the user's actions.
 boolean canEndApplication()
          Método que permite sempre ao usuário matar a aplicação.
 void DecimalButton()
          This is a method that is called whenever the decimal button is pressed.
 boolean keyDown(Event evt, int key)
          The following method handles all of the key events that occurs when a user enters values from the keyboard.
 void NumericButton(int i)
          This method is called whenever a numeric button (0-9) is pushed.
 void OperatorButton(int i)
           
 
Methods inherited from class csdk.v1_0.helper.AbstractCSDKWindowApplication
addWindow, closeDependentWindows, getApplicationFrame, onApplicationEnd, onApplicationStart, removeWindow
 
Methods inherited from class csdk.v1_0.helper.AbstractCSDKApplication
addProjectObserver, browseLocalFileInOpenMode, browseLocalFileInSaveMode, browseMultipleLocalFilesInOpenMode, browseMultipleProjectFilesInOpenMode, browseProjectFileInOpenMode, browseProjectFileInSaveMode, createLocalFile, createProjectFile, executeAlgorithm, executeFlow, getCurrentProjectId, getLocalFile, getProjectFile, isCommandContextAvailable, isFileSystemContextAvailable, isProjectContextAvailable, isProjectOpen, removeLocalFile, removeProjectFile, removeProjectObserver
 
Methods inherited from class csdk.v1_0.helper.application.AbstractApplication
finishApplication, getApplicationDescription, getApplicationFileTypes, getApplicationIcon, getApplicationId, getApplicationName, getAuthor, getAuthorEmail, getCharset, getClassString, getContext, getImageIcon, getInstanceId, getLocale, getProperty, getServerCharset, getSmallApplicationIcon, getString, getVersion, handleException, hasClassString, hasString, isActive, isApplicationContextAvailable, isBundleRequired, isPropertyNull, isSingleton, onContextActivate, onContextDeactivate, onMessageReceived, requiresProject, runApplication, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface csdk.v1_0.api.core.IContext
isActive, onContextActivate, onContextDeactivate
 

Field Detail

OpMinus

public static final int OpMinus
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values

OpMultiply

public static final int OpMultiply
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values

OpPlus

public static final int OpPlus
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values

OpDivide

public static final int OpDivide
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values

OpMPlus

public static final int OpMPlus
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values

OpMClear

public static final int OpMClear
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values

OpMR

public static final int OpMR
The following integer values are being set as "final" because they are going to be used for determining what button has been pushed

See Also:
Constant Field Values
Constructor Detail

SimpleCalculator

public SimpleCalculator(ICSDKEnvironment csdkInterface)
Construtor.

Parameters:
csdkInterface - interface padrão para o ambiente CSDK.
Method Detail

applicationStarted

protected void applicationStarted(JFrame frame)
Montagem do diálogo principal.

Specified by:
applicationStarted in class AbstractCSDKWindowApplication

canEndApplication

public boolean canEndApplication()
Método que permite sempre ao usuário matar a aplicação.

Specified by:
canEndApplication in interface IApplication
Overrides:
canEndApplication in class AbstractApplication
Returns:
o flag indicativo.

buildPanel

public JPanel buildPanel()
This the only method that is called explicitly -- every other method is called depending on the user's actions.

Returns:
painel

NumericButton

public void NumericButton(int i)
This method is called whenever a numeric button (0-9) is pushed.

Parameters:
i - The pushed buttom

OperatorButton

public void OperatorButton(int i)
Parameters:
i - operation

DecimalButton

public void DecimalButton()
This is a method that is called whenever the decimal button is pressed.


actionPerformed

public void actionPerformed(ActionEvent event)
This method is called whenever an action is performed on the applet, * specifically whenever one of the buttons on the applet is pressed *

Specified by:
actionPerformed in interface ActionListener

keyDown

public boolean keyDown(Event evt,
                       int key)
The following method handles all of the key events that occurs when a user enters values from the keyboard. It accepts an Event object and an integer representing the key pressed as arguments. It should be noted that in order to accept keys entered to the lcdDisplay, the applet must be in focus.

Parameters:
evt - event
key - key
Returns:
flag

applicationEnded

protected void applicationEnded()

Specified by:
applicationEnded in class AbstractCSDKWindowApplication


Copyright © 2013–2014 Tecgraf/PUC-Rio. All rights reserved.