Using the JOptionPane Class to Accept GUI Input Chapter 2

Descrição

Intro to GUI data input
Mayra  Ansaldi
FlashCards por Mayra Ansaldi, atualizado more than 1 year ago
Mayra  Ansaldi
Criado por Mayra Ansaldi mais de 7 anos atrás
41
0

Resumo de Recurso

Questão Responda
InputDialog Prompts the user for text input
ConfirmDialog Asks the user a question, providing buttons that the user can click yes or no and cancel responses.
HelloNameDialog Class Code Sample
ShowInputDialog() Has 4 components 1. screen component frame of which the dialog box will appear. If null dialog box centered. 2. title to be displayed in the title bar of the input dialog box 3. A class field describing the dialog box: ERROR_MESSAGE, INFORMATION_MESSAGE, PLAIN_MESSAGE, QUESTION_MESSAGE, or WARNING_MESSAGE
type-wrapper classes To convert a String to an integer or double, you must use methods from the built-in Java classes Integer and Double. Each primitive type in Java has a corresponding class contained in the java.lang package; like most classes, the names of these classes begin with uppercase letters. These classes are called type-wrapper classes. They include methods that can process primitive type values.
String & String Ojects The Java String class is most commonly used for any manipulation, calculations and storing user data. Once created can't be modified. The Strings class in Java has string objects, which are a combination of characters including numbers and punctuations.
Parse means to break into component parts. Parsing a String converts it to its numeric equivalent.
Confirm Dialog Box Displays the options Yes, No or cancel. Simple options presented to the user
Sample of Confirm Dialog Box Code
1) Standard Arithmetic Operators 2) Operand 3) Binary Operations 1) Used to perform calculations 2) Value on either side of an operator 3) Require two operands
Floating Point Division e.g. 45.0 / 2 is 22.5 with decimals
Integer Division occurs when both the operands are integers. e.g. 45 / 2 is 22 39 /5 is 7
Remainder Operator or Modulus Operator or Mod Is the % sign You use the remainder as the result e.g. 39 % 5 the answer is 2 e.g. 20 % 3 is 2 (6*3=18 remainder of 2)
Operator Precedence The rules for the order in which parts of a mathematical expression are evaluated *, /, & % Higher + and - Lower
Associativity When you combine mathematical operations with the same precedence their associativity is left to right.
Type Conversions The process of converting one data type to another. e.g. Int to Bytes. When performing arithmetic operations of the same type (int to int or byte to byte) the result will be on that same type. But sometimes you will need to use different types bytes and ints and convert it to a different type.
Unifying Type The type to which all operands in an expression are converted so that they are compatible with each other through implicit conversion (promotions). So - simply put it takes the highest in the order of operations and converts it to that.
Data Types
Data Types 2
Implicit Conversion Automatically converts non confirming operandants
Type Casting IS Explicit Conversion Forces a value of one data type to be used as a value of another type by using a cast operator which is created by placing the desired result type into a parentheses
Sample Type Casting- Cast Operator also called Unary Cast Operator

Semelhante

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Data Analytics
anelvr