HTML DOM Input URL Required Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

117 Views

The Input URL required property determines whether Input URL is compulsory to set or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputURLObject.requiredSetting required to booleanValueinputURLObject.required = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailsTrueIt is compulsory to set the url field to submit form.FalseIt is the default value and to set an url field is not compulsory.ExampleLet us see an example for Input URL required property − Live Demo Input URL required    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       ... Read More

Set Fullscreen Mode for Java Swing Application

Krantik Chavan
Updated on 30-Jul-2019 22:30:26

6K+ Views

To set fullscreen mode for your Java Swing application, use the setFullScreenWindow() method:GraphicsDevice device = graphics.getDefaultScreenDevice(); JFrame frame = new JFrame("Fullscreen"); device.setFullScreenWindow(frame);The following is an example to set fullscreen mode for Java Swing Application:Exampleimport java.awt.Color; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class SwingDemo {    public static void main(String[] args) {       GraphicsEnvironment graphics =       GraphicsEnvironment.getLocalGraphicsEnvironment();       GraphicsDevice device = graphics.getDefaultScreenDevice();       JFrame frame = new JFrame("Fullscreen");       JPanel panel = new JPanel();       JLabel label = new JLabel("", JLabel.CENTER);     ... Read More

Set Mnemonic Key for Radio Button in Java

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

493 Views

Mnemonic key is set so that a user can use Keyboard keys to select a Radio Button. For example, a key can be set with ALT −radio2.setMnemonic(KeyEvent.VK_R);Above, we have set key ALT+R for radio2.The following is an example to set Mnemonic key radio button −package my; import java.awt.FlowLayout; import java.awt.event.KeyEvent; import javax.swing.ButtonGroup; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JRadioButton; public class SwingDemo {    public static void main(String[] args) {       JRadioButton radio1 = new JRadioButton("Male");       JRadioButton radio2 = new JRadioButton("Female");       radio2.setMnemonic(KeyEvent.VK_R);       ButtonGroup group = new ButtonGroup();       ... Read More

Fetch Domain Name by Passing Name in MySQL

Smita Kapse
Updated on 30-Jul-2019 22:30:26

347 Views

To fetch domain name by passing name in MySQL, you can use substring_index(). Let us first create a table −mysql> create table DemoTable ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserMailId varchar(200) ); Query OK,  0 rows affected (0.77 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(UserMailId) values('John9989@facebook.com'); Query OK,  1 row affected (0.18 sec) mysql> insert into DemoTable(UserMailId) values('983773CS@yahoo.com'); Query OK,  1 row affected (0.23 sec) mysql> insert into DemoTable(UserMailId) values('Chris95@gmail.com'); Query OK,  1 row affected (0.20 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------+-----------------------+ | UserId | UserMailId | +--------+-----------------------+ | ... Read More

What is itermonthdays2 in Python

Sri
Sri
Updated on 30-Jul-2019 22:30:26

159 Views

itermonthdays2().It is similar to itermonthdates(), Days returned will be tuples (i.e) it consists of a day number and a weekday number. this method is used to get an iterator for the month in the year.Exampleimport calendar i= calendar.Calendar() for days in i.itermonthdays2(2019, 5): print(days)Output(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (1, 6) (2, 0) (3, 1) (4, 2) (5, 3) (6, 4) (7, 5) (8, 6) (9, 0) (10, 1) (11, 2) (12, 3) (13, 4) (14, 5) (15, 6) (16, 0) (17, 1) (18, 2) (19, 3) (20, 4) (21, 5) (22, 6) (23, 0) (24, 1) (25, 2) (26, 3) (27, 4) (28, 5) (29, 6) (30, 0) (31, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6)

Highlight All Text in Java Swing Control Text Pane

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

360 Views

To highlight all the text, use the selectAll() method of the JTextPane component −JTextPane pane = new JTextPane(); pane.selectAll();The following is an example to highlight the JTextPane text. Here, we are displaying a code in the JTextPane and highlighting it −Examplepackage my; import java.awt.BorderLayout; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.text.BadLocationException; public class SwingDemo {    public static void main(String args[]) throws BadLocationException {       JFrame frame = new JFrame("Demo");       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       Container container = frame.getContentPane();       JTextPane pane = new JTextPane();       pane.setContentType("text/html");     ... Read More

Check If Location Services Are Enabled in Android App

George John
Updated on 30-Jul-2019 22:30:26

2K+ Views

This example demonstrate about How to check if Location Services are enabled in Android App.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.java     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.sample ; import android.content.Context ; import android.content.DialogInterface ; import android.content.Intent ; import android.location.LocationManager ; import android.os.Bundle ; import android.provider.Settings ; import android.support.v7.app.AlertDialog ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; import android.widget.Button ; import android.widget.TextView ; public class MainActivity extends AppCompatActivity ... Read More

Remove Empty Objects in an Object Array using MongoDB Query

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

900 Views

You can use $pull operator for this. Let us first create a collection with documents. Here, we have also added an empty object −> db.removeEmptyObjectsDemo.insertOne(    {       "_id" :101,       "LoginDate" :new ISODate(),       "UserDetails" : [          {             "UserName" : "John"          },          {          },          {             "UserName" : "Sam"          }       ]    } ); { ... Read More

HTML DOM Input URL Size Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

103 Views

The Input URL size property returns/sets the size property for input URL. If not defined this property returns ‘20’.SyntaxFollowing is the syntax −Returning size attributeinputURLObject.sizeSet size property to a numberinputURLObject.size = numberExampleLet us see an example for Input URL size property − Live Demo Input URL size    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } URL-size URL: ... Read More

Change JFrame Background Color in Java

Samual Sam
Updated on 30-Jul-2019 22:30:26

23K+ Views

At first, create a JFrame −JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(550, 300));Now, change the background color of the JFrame −frame.getContentPane().setBackground(Color.BLUE);The following is an example to change JFrame background color −Exampleimport java.awt.Color; import java.awt.Dimension; import javax.swing.JFrame; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       frame.setPreferredSize(new Dimension(550, 300));       frame.getContentPane().setBackground(Color.BLUE);       frame.pack();       frame.setVisible(true);    } }Output

Advertisements