
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

273 Views
The javafx.scene.text.Text class has a property named fontSmoothingType, which specifies the smoothing type of the text. You can set the value to this property using the set setFontSmoothingType() method accepts two parameters −FontSmoothingType.GRAY − This specifies the default grayscale smoothing.FontSmoothingType.LCD − This specifies the LCD smoothing. This uses the characteristics of an LCD display and enhances the smoothing of the node.To add an LCD display to a text −Create a text node by instantiating the javafx.scene.text.Text class.Create a required font using one of the font() methods of the javafx.scene.text.Font class.Set the font to the text using the setText() method.Set the ... Read More

8K+ Views
You can set the desired font to the text node in JavaFX using the setFont() method. This method accepts an object of the class javafx.scene.text.Font.The Font class represents the fonts in JavaFX, this class provides several variants of a method named font().as shown below −font(double size) font(String family) font(String family, double size) font(String family, FontPosture posture, double size) font(String family, FontWeight weight, double size) font(String family, FontWeight weight, FontPosture posture, double size)All these methods are static and returns a Font object. To set a font you need to create the font object using one of these methods and set the ... Read More

2K+ Views
To redirect to another webpage using JavaScript, the code is as follows −Example Live Demo Redirect to a Webpage Example Redirect Click the above button to Redirect to another Webpage document .querySelector(".redirectBtn") .addEventListener("click", redirectFunction); function redirectFunction() { location.href("https://tutorialspoint.com/"); } OutputThe above code will produce the following output −On clicking the “Redirect” button we will be redirected to a new site −

329 Views
To create a speed converter with HTML and JavaScript, the code is as follows −Example Live Demo body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } input, span { font-size: 20px; } Speed Converter Type speed in Kilometer per hour to convert it into meter per hour Kilometer Per Hour Meters Per second: function KmphtoMphConverter(speed) { document.querySelector(".metersPerSecond").innerHTML = speed * 0.277778; } OutputThe above code will produce the following output −On entering some speed in kph −

1K+ Views
To create a length converter with HTML and JavaScript, the code is as follows −Example Live Demo body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } input,span{ font-size: 20px; } Length Converter Type length in Kilometers to convert it into meters Kilometers Meters: function KmtoMConverter(length) { document.querySelector(".meters").innerHTML=length*1000; } OutputThe above code will produce the following output −On entering length in kilometers −

759 Views
To create a temperature converter with HTML and JavaScript, the code is as follows −Example Live Demo body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } input,span{ font-size: 20px; } Temperature Converter Type Temperature in celcius to convert it into fahrenheit Celcius Fahrenheit: function CtoFConverter(temp) { document.querySelector(".fahrenheit").innerHTML=(temp-32)/1.8; } OutputThe above code will produce the following output −On entering temperature in celcius −

376 Views
To create a weight converter with HTML and JavaScript, the code is as follows −Example Live Demo body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } input,span{ font-size: 20px; } Weight Converter Type weight in kg to convert it into grams Kilogram Grams: function KgtoGConverter(weight) { document.getElementById("outputGrams").innerHTML=weight*1000; } OutputThe above code will produce the following output −On typing some weight in KGs −

281 Views
To create and use syntax highligher, the code is as follows −Example Live Demo body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .colorLinks { color: rgb(131, 44, 212); text-decoration: none; font-size: 20px; font-weight: bold; } .setColor { margin: 20px; padding: 10px; border: none; font-size: 18px; background-color: rgb(226, 43, 89); color: white; } Syntax Highlighting example Go to google.com Go to facebook.com Click Here Click the above button to highlight the links var anchrorRg = /[^

340 Views
To use media queries with JavaScript, the code is as follows −Example Live Demo body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; color: white; padding: 20px; } Using media queries with JavaScript Example Resize the screen to see the color change from blue to red var mediaQuery = window.matchMedia("(max-width: 700px)"); function setColor(mediaQuery) { if (mediaQuery.matches) { document.body.style.backgroundColor = "red"; } else { document.body.style.backgroundColor = "blue"; } } setColor(mediaQuery); mediaQuery.addListener(myFunction); OutputThe above code will produce the following output on window size greater than 700px −On resizing the browser window size less than 700px −

629 Views
To create a draggable HTML element with JavaScript and CSS, the code is as follows −Example Live Demo body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .dragDiv { position: absolute; z-index: 9; text-align: center; border: 1px solid #d3d3d3; padding: 30px; cursor: move; z-index: 10; background-color: rgb(108, 24, 177); color: #fff; font-size: 20px; font-weight: 500; } ... Read More