Found 2417 Articles for HTML

How to change text font for JLabel with HTML in Java?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

728 Views

To change text font, you can use the setFont() method of JLabel −label.setFont(new Font("Verdana", Font.PLAIN, 12));The following is an example to change text font for JLabel with HTML −Exampleimport java.awt.Font; import javax.swing.*; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Label Example");       JLabel label;       label = new JLabel("" + "ABC");       label.setBounds(50, 50, 100, 30);       label.setFont(new Font("Verdana", Font.PLAIN, 12));       frame.add(label);       frame.setSize(500,300);       frame.setLayout(null);       frame.setVisible(true);    } }Output

TypedArray.values() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:33:13

34 Views

The values() function of the TypedArray returns an iterator object which holds the values of the typed array. The next() method returns the next element in the iterator object.SyntaxIts Syntax is as followstypedArray.values()Example Live Demo    JavaScript Example           var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);       var iterator = typedArray.values();       document.write("Contents of the typed array: ");       for(i=0; i

TypedArray.sort() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 13:33:45

60 Views

The sort() method of the Typed Array object arranges the elements of the array in ascending order and returns it.SyntaxIts Syntax is as followsarrayBuffer.sort()Example Live Demo    JavaScript Array every Method           var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);       document.write("Contents of the typed array: "+typedArray);       document.write("");       var resultantArray = typedArray.sort();       document.write("Resultant Array: "+resultantArray);     OutputContents of the typed array: 11,5,13,4,15,3,17,2,19,8 Resultant Array: 2,3,4,5,8,11,13,15,17,19

TypedArray.fill() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:09:24

58 Views

The fill() function of the TypedArray object replaces all the required/desired elements of the array with specifies value (fixed). This function accepts three numbers one representing a fixed value and the other two represents the start and end indexes of the portion of the elements to be replaced (end value is optional).SyntaxIts Syntax is as followsint32View.fill(464, 3);Example Live Demo    JavaScript Array every Method           var int32View = new Int32Array([64, 89, 65, 21, 14, 66, 87, 55]);       document.write("Contents of the typed array: "+int32View);       document.write("");       result ... Read More

TypedArray.every() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 13:10:46

25 Views

The every() function of TypedArray accepts a string value representing the name of a function, tests whether all the elements in an array passes the test implemented by the provided function.SyntaxIts Syntax is as followstypedArray.every(function_name)Example Live Demo    JavaScript Array every Method           var int32View = new Int32Array([64, 89, 65, 21, 14, 66, 87, 55 ]);       document.write("Contents of the typed array: "+int32View);       document.write("");       function testResult(element, index, array) {          var ele = element>35          return ele;       ... Read More

TypedArray.entries() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:14:17

41 Views

The entries() function of TypedArray returns an iterator of the corresponding TypedArray object and using this, you can retrieve the key-value pairs of it. Where it returns the index of the array and the element in that particular index.SyntaxIts Syntax is as followstypedArray.entries()Example Live Demo    JavaScript Example           var int32View = new Int32Array([21, 64, 89, 65, 33, 66, 87, 55]);       document.write("Contents of the typed array: "+int32View);       document.write("");       var it = int32View.entries();       for(i=0; i

TypedArray.copyWithin() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 13:14:56

36 Views

The copyWithin() function of the TypedArray object copies the contents of this TypedArray within itself. This method accepts three numbers where first number represents the index of the array at which the copying of elements should be started and, the next two numbers represents start and end elements of the array from which the data should be copied (taken).SyntaxIts Syntax is as followsobj.copyWithin(3, 1, 3);Example Live Demo    JavaScript Example           var int32View = new Int32Array([21, 64, 89, 65, 33, 66, 87, 55 ]);       document.write("Contents of the typed array: "+int32View);   ... Read More

TypedArray.byteOffset property in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:15:23

34 Views

The byteOffset property of the TypedArray represents the offset of the current object.SyntaxIts Syntax is as followstypedArray.byteOffset();Example Live Demo    JavaScript Example           var buffer = new ArrayBuffer(156);       var float32 = new Float32Array(buffer);       document.write(float32.byteOffset);     Output0

TypedArray.byteLength property in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 13:15:45

42 Views

The byteLength property of the TypedArray object represents the length of its(in bytes)TypedArray.SyntaxIts Syntax is as followstypedArray.byteLength();Example Live Demo    JavaScript Example           var buffer = new ArrayBuffer(156);       var float32 = new Float32Array(buffer);       document.write(float32.byteLength);     Output156

TypedArray.buffer property in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:16:09

40 Views

The buffer property of the TypedArray represents the ArrayBuffer of the current TypedArray.SyntaxIts Syntax is as followsobj.buffer;Example Live Demo    JavaScript Example           var buffer = new ArrayBuffer(156);       var float32 = new Float32Array(buffer);       document.write(float32.buffer.byteLength);     Output156

Advertisements