Thursday, January 19, 2017

JavaFX - Overview

Rich Internet Applications are those web applications which provide similar features and experience as that of desktop applications. They offer a better visual experience when compared to the normal web applications to the users. These applications are delivered as browser plug-ins or as a virtual machine and are used to transform traditional static applications into more enhanced, fluid, animated and engaging applications.

JavaFX - Environment

From Java8 onwards, the JDK (Java Development Kit) includes JavaFX library in it. Therefore, to run JavaFX applications, you simply need to install Java8 or later version in your system.
In addition to it, IDE’s like Eclipse and NetBeans provide support for JavaFX. This chapter teaches you how to set the environment to run JavaFX Applications in various ways.

JavaFX - Architecture

JavaFX provides a complete API with a rich set of classes and interfaces to build GUI applications with rich graphics. The important packages of this API are −

JavaFX - Application

In this chapter, we will discuss the structure of a JavaFX application in detail and also learn to create a JavaFX application with an example.

JavaFX - 2D Shapes

In the previous chapter, we have seen the basic application of JavaFX, where we learnt how to create an empty window and how to draw a line on an XY plane of JavaFX. In addition to the line, we can also draw several other 2D shapes.

JavaFX - Text

Just like various shapes, you can also create a text node in JavaFX. The text node is represented by the class named Text, which belongs to the package javafx.scene.text.
This class contains several properties to create text in JavaFX and modify its appearance. This class also inherits the Shape class which belongs to the package javafx.scene.shape.

JavaFX - Effects

An effect is any action that enhances the appearance of the graphics. In JavaFX, an effect is an algorithm that is applied on nodes to enhance their appearance visually. The effect property of the Node class is used to specify the effect.

JavaFX - Transformations

Transformation means changing some graphics into something else by applying rules. We can have various types of transformations such as Translation, Scaling Up or Down, Rotation, Shearing, etc.
Using JavaFX, you can apply transformations on nodes such as rotation, scaling and translation. All these transformations are represented by various classes and these belong to the package

JavaFX - Animations

In general, animating an object implies creating illusion of its motion by rapid display. In JavaFX, a node can be animated by changing its property over time. JavaFX provides a package named javafx.animation. This package contains classes that are used to animate the nodes.

JavaFX - Colors

To apply colors to an application, JavaFX provides various classes in the package javafx.scene.paint package. This package contains an abstract class named Paint and it is the base class of all the classes that are used to apply colors.

JavaFX - Images

You can load and modify images using the classes provided by JavaFX in the package javafx.scene.image. JavaFX supports the image formats like Bmp, Gif, Jpeg, Png.
This chapter teaches you how to load images in to JavaFX, how to project an image in multiple views and how to alter the pixels of an image.

JavaFX - 3D Shapes

In the earlier chapters, we have seen how to draw 2D shapes on an XY plane. In addition to these 2D shapes, we can draw several other 3D shapes as well using JavaFX.

JavaFX - Event Handling

In JavaFX, we can develop GUI applications, web applications and graphical applications. In such applications, whenever a user interacts with the application (nodes), an event is said to have been occurred.
For example, clicking on a button, moving the mouse, entering a character through keyboard, selecting an item from list, scrolling the page are the activities that causes an event to happen.

JavaFX - UI Controls

Every user interface considers the following three main aspects −
  • UI elements − These are the core visual elements which the user eventually sees and interacts with. JavaFX provides a huge list of widely used and common elements varying from basic to complex, which we will cover in this tutorial.

JavaFX - Charts

In general, a chart is a graphical representation of data. There are various kinds of charts to represent data such as Bar Chart, Pie Chart, Line Chart, Scatter Chart, etc.
JavaFX Provides support for various Pie Charts and XY Charts.

JavaFX - Layout Panes(Containers)

After constructing all the required nodes in a scene, we will generally arrange them in order.
This arrangement of the components within the container is called the Layout of the container. We can also say that we followed a layout as it includes placing all the components at a particular position within the container.

JavaFX - CSS

Cascading Style Sheets, also referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable.
CSS handles the look and feel part of a web page. Using CSS, you can control the color of the text, style of fonts, spacing between paragraphs, size of columns and layout.

JavaFX - Useful Resources

The following resources contain additional information on JavaFX. Please use them to get more in-depth knowledge on this.

Discuss JavaFX

JavaFX is a Java library used to build Rich Internet Applications. The applications written using this library can run consistently across multiple platforms. The applications developed using JavaFX can run on various devices such as Desktop Computers, Mobile Phones, TVs, Tablets, etc.

Java 8 - Overview

JAVA 8 (aka jdk 1.8) is a major release of JAVA programming language development. Its initial version was released on 18 March 2014. With the Java 8 release, Java provided support for functional programming, new JavaScript engine, new APIs for date time manipulation, new streaming API, etc.

Java 8 - Environment Setup

Try it Option Online

We have set up the Java Programming environment online, so that you can compile and execute all the available examples online. It gives you confidence in what you are reading and enables you to verify the programs with different options. Feel free to modify any example and execute it online.

Java 8 - Lambda Expressions

Lambda expressions are introduced in Java 8 and are touted to be the biggest feature of Java 8. Lambda expression facilitates functional programming, and simplifies the development a lot.

Java 8 - Method References

Method references help to point to methods by their names. A method reference is described using :: (double colon) symbol. A method reference can be used to point the following types of methods −

Java 8 - Functional Interfaces

Functional interfaces have a single functionality to exhibit. For example, a Comparable interface with a single method ‘compareTo’ is used for comparison purpose. Java 8 has defined a lot of functional interfaces to be used extensively in lambda expressions. Following is the list of functional interfaces defined in java.util.Function package.

Java 8 - Default Methods

Java 8 introduces a new concept of default method implementation in interfaces. This capability is added for backward compatibility so that old interfaces can be used to leverage the lambda expression capability of Java 8. For example, ‘List’ or ‘Collection’ interfaces do not have ‘forEach’ method declaration.

Java 8 - Streams

Stream is a new abstract layer introduced in Java 8. Using stream, you can process data in a declarative way similar to SQL statements. For example, consider the following SQL statement −
SELECT max(salary), employee_id, employee_name FROM Employee

Java 8 - Optional Class

Optional is a container object which is used to contain not-null objects. Optional object is used to represent null with absent value. This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values. It is introduced in Java 8 and is similar to what Optional is in Guava.

Java 8 - Nashorn JavaScript

With Java 8, Nashorn, a much improved javascript engine is introduced, to replace the existing Rhino. Nashorn provides 2 to 10 times better performance, as it directly compiles the code in memory and passes the bytecode to JVM. Nashorn uses invokedynamics feature, introduced in Java 7 to improve performance.

Java 8 - New Date/Time API

With Java 8, a new Date-Time API is introduced to cover the following drawbacks of old date-time API −
  • Not thread safe − java.util.Date is not thread safe, thus developers have to deal with concurrency issue while using date. The new date-time API is immutable and does not have setter methods.

Java 8 - Base64

With Java 8, Base64 has finally got its due. Java 8 now has inbuilt encoder and decoder for Base64 encoding. In Java 8, we can use three types of Base64 encoding −

Java 8 Questions and Answers

Java 8 Questions and Answers has been designed with a special intention of helping students and professionals preparing for various Certification Exams and Job Interviews. This section provides a useful collection of sample Interview Questions and Multiple Choice Questions (MCQs) and their answers with appropriate explanations.

Java 8 - Useful Resources

The following resources contain additional information on Java8. Please use them to get more in-depth knowledge on this tpoic.

Discuss Java 8

Java 8 is the most awaited and is a major feature release of Java programming language. This is an introductory tutorial that explains the basic-to-advanced features of Java 8 and their usage in a simple and intuitive way.

Java.util.ArrayDeque Class

Introduction

The java.util.ArrayDeque class provides resizable-array and implements the Deque interface. Following are the important points about Array Deques:

Java.util.ArrayList Class

Introduction

The java.util.ArrayList class provides resizable-array and implements the List interface.Following are the important points about ArrayList:

Java.util.Arrays Class

Introduction

The java.util.Arrays class contains a static factory that allows arrays to be viewed as lists.Following are the important points about Arrays:

Java.util.BitSet Class

Introduction

The java.util.BitSet class implements a vector of bits that grows as needed.Following are the important points about BitSet:

Java.util.Calendar Class

Introduction

The java.util.calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week.Following are the important points about Calendar:

Java.util.Collections Class

Introduction

The java.util.Collections class consists exclusively of static methods that operate on or return collections.Following are the important points about Collections:

Java.util.Currency Class

Introduction

The java.util.Currency class represents a currency.Following are the important points about Currency:
  • Currencies are identified by their ISO 4217 currency codes.
  • The class is designed so that there's never more than one Currency instance for any given currency, this is the reason behind no public constructor.

Java.util.Date Class

Introduction

The java.util.Date class represents a specific instant in time, with millisecond precision.

Java.util.Dictionary Class

Introduction

The java.util.Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values.Following are the important points about Dictionary:

Java.util.EnumMap Class

Introduction

The java.util.EnumMap class is a specialized Map implementation for use with enum keys.Following are the important points about EnumMap:

Java.util.EnumSet Class

Introduction

The java.util.EnumSet class is a specialized Set implementation for use with enum types.Following are the important points about EnumSet:

Java.util.Formatter Class

Introduction

The java.util.Formatter class provides support for layout justification and alignment, common formats for numeric, string, and date/time data, and locale-specific output.Following are the important points about Formatter:

Java.util.GregorianCalendar Class

Introduction

The java.util.GregorianCalendar class is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.Following are the important points about GregorianCalendar:

Java.util.HashMap Class

Introduction

The java.util.HashMap class is the Hash table based implementation of the Map interface.Following are the important points about HashMap:

Java.util.HashSet Class

Introduction

The java.util.HashSet class implements the Set interface, backed by a hash table.Following are the important points about HashSet:

Java.util.Hashtable Class

Introduction

The java.util.Hashtable class implements a hashtable, which maps keys to values.Following are the important points about Hashtable:

Java.util.IdentityHashMap Class

Introduction

The java.util.IdentityHashMap class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values).Following are the important points about IdentityHashMap:

Java.util.LinkedHashMap Class

Introduction

The java.util.LinkedHashMap class is Hash table and Linked list implementation of the Map interface, with predictable iteration order.Following are the important points about LinkedHashMap:

Java.util.LinkedHashSet Class

Introduction

The java.util.LinkedHashSet class is a Hash table and Linked list implementation of the Set interface, with predictable iteration order.Following are the important points about LinkedHashSet:

Java.util.LinkedList Class

Introduction

The java.util.LinkedList class operations perform we can expect for a doubly-linked list. Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.

Java.util.ListResourceBundle Class

Introduction

The java.util.ListResourceBundle class is an abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list.

Java.util.Locale Class

Introduction

The java.util.Locale class object represents a specific geographical, political, or cultural region. .Following are the important points about Locale:

Java.util.Observable Class

Introduction

The java.util.Observable class represents an observable object, or "data" in the model-view paradigm.Following are the important points about Observable:

Java.util.PriorityQueue Class

Introduction

The java.util.PriorityQueue class is an unbounded priority queue based on a priority heap.Following are the important points about PriorityQueue:

Java.util.Properties Class

Introduction

The java.util.Properties class is a class which represents a persistent set of properties.The Properties can be saved to a stream or loaded from a stream.Following are the important points about Properties:

Java.util.PropertyPermission Class

Introduction

The java.util.PropertyPermission class is a class for property permissions.Following are the important points about PropertyPermission:

Java.util.PropertyResourceBundle Class

Introduction

The java.util.PropertyResourceBundle class is a concrete subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file.Following are the important points about PropertyResourceBundle:

Java.util.Random Class

Introduction

The java.util.Random class instance is used to generate a stream of pseudorandom numbers.Following are the important points about Random:

Java.util.ResourceBundle Class

Introduction

The java.util.ResourceBundle class contain locale-specific objects.Following are the important points about ResourceBundle:

Java.util.ResourceBundle.Control Class

Introduction

The java.util.ResourceBundle.Control class collaborates with the factory methods for loading resource bundles.Following are the important points about ResourceBundle.Control:

Java.util.Scanner Class

Introduction

The java.util.Scanner class is a simple text scanner which can parse primitive types and strings using regular expressions.Following are the important points about Scanner:

Java.util.ServiceLoader Class

Introduction

The java.util.ServiceLoader class is a simple service-provider loading facility.Following are the important points about ServiceLoader:

Java.util.SimpleTimeZone Class

Introduction

The java.util.SimpleTimeZone class is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.Following are the important points about SimpleTimeZone:

Java.util.Stack Class

Introduction

The java.util.Stack class represents a last-in-first-out (LIFO) stack of objects.
  • When a stack is first created, it contains no items.
  • In this class, the last element inserted is accessed first.

Java.util.StringTokenizer Class

Introduction

The java.util.StringTokenizer class allows an application to break a string into tokens.
  • This class is a legacy class that is retained for compatibility reasons although its use is discouraged in new code.
  • Its methods do not distinguish among identifiers, numbers, and quoted strings.
  • This class methods do not even recognize and skip comments.

Java.util.Timer Class

Introduction

The java.util.Timer class provides facility for threads to schedule tasks for future execution in a background thread.

Java.util.TimerTask Class

Introduction

The java.util.TimerTask class represents a task that can be scheduled for one-time or repeated execution by a Timer.

Java.util.TimeZone Class

Introduction

The java.util.TimeZone class represents a time zone offset, and also figures out daylight savings.Following are the important points about TimeZone:

Java.util.TreeMap Class

Introduction

The java.util.TreeMap class is the Red-Black tree based implementation of the Map interface.Following are the important points about TreeMap:

Java.util.TreeSet Class

Introduction

The java.util.TreeSet class implements the Set interface.Following are the important points about TreeSet:
  • The TreeSet class guarantees that the Map will be in ascending key order and backed by a TreeMap.
  • The Map is sorted according to the natural sort method for the key Class, or by the Comparator provided at set creation time, that will depend on which constructor used.
  • The ordering must be total in order for the Tree to function properly.

Java.util.UUID Class

Introduction

The java.util.UUID class represents an immutable universally unique identifier (UUID).Following are the important points about UUID:

Java.util.Vector Class

Introduction

The java.util.Vector class implements a growable array of objects. Similar to an Array, it contains components that can be accessed using an integer index. Following are the important points about Vector:

Java.util.WeakHashMap Class

Introduction

The java.util.WeakHashMap class is a hashtable-based Map implementation with weak keys. An entry in a WeakHashMap will automatically be removed by the garbage collector, when its key is no longer in use. Following are the important points about WeakHashMap:

Java.util.Interfaces

Introduction

The java.util.Interfaces contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).

Java.util.Exceptions

Introduction

The java.util.Exceptions contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).

java.util.Formatter.BigDecimalLayoutForm Enumeration

Introduction

The java.util.Formatter.BigDecimalLayoutForm enumeration gives the available styles for formatting very large decimal numbers.

Java.util.Useful Resources

The following resources contain additional information on JAVA Please use them to get more in-depth knowledge on this topic.

Discuss Java.util

Java.util package contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes.
This reference will take you through simple and practical methods available in java.util package.

Java.math.BigDecimal Class

Introduction

The java.math.BigDecimal class provides operations for arithmetic, scale manipulation, rounding, comparison, hashing, and format conversion.
The toString() method provides a canonical representation of a BigDecimal. It gives the user complete control over rounding behavior.

Java.math.BigInteger Class

Introduction

The java.math.BigInteger class provides operations analogues to all of Java's primitive integer operators and for all relevant methods from java.lang.Math.
It also provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations. All operations behave as if BigIntegers were represented in two's-complement notation.

Java.math.MathContext Class

Introduction

The java.math.MathContext class provides immutable objects which encapsulate the context settings and describes certain rules for numerical operators, such as those implemented by the BigDecimal class.
The base-independent settings are:

Java.math.RoundingMode Enumeration

Introduction

The java.math.RoundingMode enumeration specifies a rounding behavior for numerical operations capable of discarding precision. Each rounding mode indicates how the least significant returned digit of a rounded result is to be calculated.

Discuss Java.math

Java.math package provides classes for performing arbitrary-precision integer arithmetic (BigInteger) and arbitrary-precision decimal arithmetic (BigDecimal).
This reference will take you through simple and practical methods available in java.math package.

Java.lang Boolean Class

Introduction

The java.lang.Boolean class wraps a value of the primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean.

Java.lang.Byte Class

Introduction

The java.lang.Byte class wraps a value of primitive type byte in an object. An object of type Byte contains a single field whose type is byte.

Java.lang.Character Class

Introduction

The java.lang.Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.

Java.lang.Character.Subset Class

Introduction

The java.lang.Character.Subset class instances represent particular subsets of the Unicode character set. The only family of subsets defined in the Character class is UnicodeBlock.

Java.lang.Character.UnicodeBlock Class

Introduction

The java.lang.Character.UnicodeBlock class is a family of character subsets representing the character blocks in the Unicode specification. Character blocks generally define characters used for a specific script or purpose.

Java.lang.Class Class

Introduction

The java.lang.Class class instance represent classes and interfaces in a running Java application.It has no public constructor.

Java.lang.ClassLoader Class

Introduction

The java.lang.ClassLoader class is an object that is responsible for loading classes. This class is an abstract class. It may be used by security managers to indicate security domains.

Java.lang.Compiler Class

Introduction

The java.lang.Compiler class is provided to support Java-to-native-code compilers and related services. By design, it serves as a placeholder for a JIT compiler implementation.

Java.lang.Double Class

Introduction

The java.lang.Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

Java.lang.Enum Class

Introduction

The java.lang.Enum class is the common base class of all Java language enumeration types.

Java.lang.Float Class

Introduction

The java.lang.Float class wraps a value of primitive type float in an object. An object of type Float contains a single field whose type is float.

Java.lang.InheritableThreadLocal Class

Introduction

The java.lang.InheritableThreadLocal class extends ThreadLocal to provide inheritance of values from parent thread to child thread: when a child thread is created, the child receives initial values for all inheritable thread-local variables for which the parent has values.

Java.lang.Integer Class

Introduction

The java.lang.Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.

Java.lang.Long Class

Introduction

The java.lang.Long class wraps a value of the primitive type long in an object. An object of type Long contains a single field whose type is long.

Java.lang.Math Class

Introduction

The java.lang.Math class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.

Java.lang.Number Class

Introduction

The java.lang.Number class is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short.The Subclasses of Number must provide methods to convert the represented numeric value to byte, double, float, int, long, and short.

Java.lang.Object Class

Introduction

The java.lang.Object class is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.

Java.lang.Package Class

Introduction

The java.lang.Package class contain version information about the implementation and specification of a Java package

Java.lang.Process Class

Introduction

The java.lang.Process class provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process.

Java.lang.ProcessBuilder Class

Introduction

The java.lang.ProcessBuilder class is used to create operating system processes.This class is not synchronized.

Java.lang.Runtime Class

Introduction

The java.lang.Runtime class allows the application to interface with the environment in which the application is running.

Java.lang.RuntimePermission Class

Introduction

The java.lang.RuntimePermission class is for runtime permissions. A RuntimePermission contains a name (also referred to as a "target name") but no actions list; you either have the named permission or you don't.

Java.lang.SecurityManager Class

Introduction

The java.lang.SecurityManager class allows applications to implement a security policy. It allows an application to determine, before performing a possibly unsafe or sensitive operation, what the operation is and whether it is being attempted in a security context that allows the operation to be performed. The application can allow or disallow the operation.