Anvi Jain has Published 629 Articles

Insert a tab after the first tab of a JTabbedPane container

Anvi Jain

Anvi Jain

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

68 Views

We are inserting a tab just after the first tab by using the index value 1. Here, index 1 would be location 2nd i.e. just after the first tab of the JTabbedPane container.The following is an example to insert a tab after the first tab −Examplepackage my; import javax.swing.*; import ... Read More

Android NotificationBuilder Example

Anvi Jain

Anvi Jain

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

79 Views

This example demonstrate about Android NotificationBuilder.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.xml.     Step 3 − Add the following code to ... Read More

How to pull even numbers from an array in MongoDB?

Anvi Jain

Anvi Jain

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

510 Views

Use $mod to get the even numbers and pull them from the array. Let us first create a collection with documents −>db.pullEvenNumbersDemo.insertOne({"AllNumbers":[101, 102, 104, 106, 108, 109, 110, 112, 14, 17, 18, 21]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd45b072cba06f46efe9eea") }Following is the query to display all documents ... Read More

JDBC Class.forName vs DriverManager.registerDriver

Anvi Jain

Anvi Jain

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

4K+ Views

To connect with a database using JDBC you need to select get the driver for the respective database and register the driver. You can register a database driver in two ways −Using Class.forName() method − The forName() method of the class named Class accepts a class name as a String ... Read More

How to send parameters from a notification-click to an Android activity?

Anvi Jain

Anvi Jain

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

2K+ Views

This example demonstrate about How to send parameters from a notification-click to an Android activity.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.xml.   ... Read More

How does MongoDB Update() method work to set records of entire field?

Anvi Jain

Anvi Jain

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

56 Views

You can use $set operator along with update(). Let us first create a collection with documents −> db.workingOfUpdateMethod.insertOne({"ClientCountryName" : "AUS"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd506fe2cba06f46efe9efa") } > db.workingOfUpdateMethod.insertOne({"ClientCountryName" : "AUS"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd507022cba06f46efe9efb") } > db.workingOfUpdateMethod.insertOne({"ClientCountryName" : "AUS"}); {   ... Read More

How to play a custom sound on receiving notification in Android?

Anvi Jain

Anvi Jain

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

1K+ Views

This example demonstrate about How to play a custom sound on receiving notification in AndroidStep 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.xml.     ... Read More

How to set FlowLayout for JFrame in Java?

Anvi Jain

Anvi Jain

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

527 Views

To set FlowLayout for a frame, use the Container. At first, set a JFrame −JFrame frame = new JFrame();Now, use Container and set the layout as FlowLayout−Container container container = frame.getContentPane(); container.setLayout(new FlowLayout());The following is an example to set FlowLayout for JFrame −Examplepackage my; import java.awt.Container; import java.awt.FlowLayout; import javax.swing.JButton; ... Read More

MongoDB divide aggregation operator?

Anvi Jain

Anvi Jain

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

215 Views

You can use aggregate framework for this. Let us first create a collection with documents −>db.aggregationOperatorDemo.insertOne({"FirstValue":392883, "SecondValue":10000000000}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd541452cba06f46efe9f01") }Following is the query to display all documents from a collection with the help of find() method −> db.aggregationOperatorDemo.find().pretty();This will produce the following output ... Read More

How to add an extra new notification when push notification received in Android App?

Anvi Jain

Anvi Jain

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

269 Views

This example demonstrate about How to add an extra new notification when push notification received 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 ... Read More

Advertisements