Define a Regular Expression in JavaScript

Sravani S
Updated on 19-May-2020 11:07:45

177 Views

A regular expression is an object that describes a pattern of characters.The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on the text. A regular expression could be defined with the RegExp () constructor, as follows −var pattern = new RegExp(pattern, attributes); or var pattern = /pattern/attributes;The following are the parameters −pattern − A string that specifies the pattern of the regular expression or another regular expression.attributes − An optional string containing any of the "g", "i", and "m" attributes that specify ... Read More

Role of Ignoring Case RegExp Property in JavaScript

Abhinanda Shri
Updated on 19-May-2020 11:06:36

94 Views

ignoreCase is a read-only boolean property of RegExp objects. It specifies whether a particular regular expression performs case-insensitive matching, i.e., whether it was created with the "i" attribute.ExampleYou can try to run the following code to learn how to work with Ignore Case RegExp property in JavaScript.           JavaScript RegExp ignoreCase Property                        var re = new RegExp( "string" );          if ( re.ignoreCase ) {             document.write("Test1-ignoreCase property is set");          } ... Read More

Role of pageYOffset Property

Fendadis John
Updated on 19-May-2020 10:59:13

339 Views

If you want to get the pixels of the document scrolled to from the upper left corner of the window, then use the pageXoffset and pageYoffset property. Use pageYoffset for vertical pixels.ExampleYou can try to run the following code to learn how to work with pageYOffset property in JavaScript.Live Demo                    div {             background-color: green;             height: 1500px;             width: 1500px;          }                              function scrollFunc() {             window.scrollBy(200, 200);             alert("Vertical: " + window.pageYOffset);          }             Scroll                      

Scale Transformation in JavaFX

Maruthi Krishna
Updated on 19-May-2020 07:45:24

458 Views

A scale transform refers to minimizing or maximizing the size of an object. In JavaFX, you can scale a node using an object of the javafx.scene.transform.Translate class. Internally this class multiplies each unit in the coordinate system with the given factor.This class contains six properties (double) type −Three (pivotZ, pivotY, pivotZ) specifying the x, y, z coordinates of the pivot point (about which the scaling occurs). You can set values to these properties using the setPivotX(), setPivotY() and, setPivotZ() methods respectively.Three properties specifying the scale factors along the x, y, and, z axes. You can set values to these properties ... Read More

Shear Transform in JavaFX

Maruthi Krishna
Updated on 19-May-2020 07:42:30

297 Views

Displacement of an object in a fixed direction such that its shape is slanted is known as shear transform. This is also known as skewing.In JavaFX using the object of the javafx.scene.transform.Shear class, you can skew a node along the required axis. Internally this class rotates the specified axis such that X and Y axes are no longer perpendicular.This class contains four properties −The pivotX property (double) specifying the x coordinates of the shear pivot point. You can set the value to this property using the setPivotX() method.The pivotY property (double) specifying the y coordinates of the shear pivot point. ... Read More

Rotate a Node in JavaFX

Maruthi Krishna
Updated on 19-May-2020 07:39:12

3K+ Views

If you move an object in the XY plane around a fixed point with an angle it is known as rotation.In JavaFX using the object of the javafx.scene.transform.Rotate class, you can rotate a node. This class internally rotates the coordinate space of the node around a given fixed point, this makes the node to appear rotated.This class contains five properties −The angle property (double) specifying the angle of rotation. You can set the value to this property using the setAngle() method.The axis property (Point3D) specifying the axis of rotation. You can set the value to this property using the setAxis() ... Read More

Move/Translate a JavaFX Node from One Position to Another

Maruthi Krishna
Updated on 19-May-2020 07:36:27

2K+ Views

If you move an object on the XY plane from one position to another it is known as translation. You can translate an object along either X-Axis to Y-Axis.In JavaFX using the object of the javafx.scene.transform.Translate class you can translate a node from one position to another. This class contains three properties (double) representing the distance of the desired position from the original position along X, Y, Z plane respectively.Every node in JavaFX contains an observable list to hold all the transforms to be applied on a node. You can get this list using the getTransforms() method.To move a Node ... Read More

Create an Alert in JavaFX

Maruthi Krishna
Updated on 19-May-2020 07:33:33

2K+ Views

An alert is a dialog which shows pre-built dialog types. You can create an alert by instantiating the javafx.scene.control.Alert class. This class is a subclass of the Dialog class. You can create required type of dialog bypassing the respective parameter at the time of instantiation as −Alert alert = new Alert(Alert.AlertType.CONFIRMATION);ExampleThe following Example demonstrates the creation of an Alert.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; public class AlertExample extends Application {    public void ... Read More

CheckboxTreeItem in JavaFX: Explanation with Example

Maruthi Krishna
Updated on 19-May-2020 07:30:20

1K+ Views

Check boxA checkbox is a type of selection control, which is square in shape with a tick mark int it, It has three states checked or, unchecked and, tristate/indeterminate (optional). Unlike radio buttons, you cannot combine checkboxes using Toggle Button.Tree viewA tree provides a view of hierarchical structures, each tree contains a root (highest object) and it contains children. You can create a tree view by instantiating the javafx.scene.control.TreeView class.A CheckBoxTreeItem is a tree view formed with checkboxes. You can create a checkbox tree item by instantiating the javafx.scene.control.CheckBoxTreeItem class.ExampleThe following Example demonstrates the creation of a CheckBoxTreeItem.import javafx.application.Application; import ... Read More

Create a Toolbar in JavaFX

Maruthi Krishna
Updated on 19-May-2020 07:28:20

951 Views

A toolbar is used to display UI elements such as buttons, toggle buttons, and separators, etc.. You cannot add any other nodes to a toolbar. The contents of a toolbar can be arranged either horizontally or vertically. You can create a toolbar by instantiating the javafx.scene.control.ToolBar class.ExampleThe following Example demonstrates the creation of a ToolBar.import javafx.application.Application; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Separator; import javafx.scene.control.ToolBar; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class ToolBarExample extends Application {    public void start(Stage stage) {       Button bt1 = new Button("Java");       Button ... Read More

Advertisements