- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Chandu yadav has Published 1163 Articles
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
12K+ Views
To get last inserted document, use sort() along with limit(1).Let us first create a collection with documents −> db.getLastInsertedDocument.insertOne({"Name":"John"}); { "acknowledged" : true, "insertedId" : ObjectId("5cefb17eef71edecf6a1f6a8") } > db.getLastInsertedDocument.insertOne({"Name":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5cefb181ef71edecf6a1f6a9") } > db.getLastInsertedDocument.insertOne({"Name":"Robert"}); { "acknowledged" : true, "insertedId" ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
95 Views
To get the total number of leaved of a JTree, apply the getLeafCount() method on the root node. Let’s say our root node is “node”, therefore to count the number of leaves, use −node.getLeafCount()The following is an example to get the total number of leaves of a JTree −package my; ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
1K+ Views
A common mistake for people new to programming is a misunderstanding of the way that boolean operators works, which stems from the way the python interpreter reads these expressions. For example, after initially learning about "and " and "or" statements, one might assume that the expression X = (‘x’ or ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
108 Views
The matte border gives a “matte” look. Let’s say the following is our component −JLabel label; label = new JLabel("This has matte border!");Let us create a matte border with BorderFactory class. Here, we have given color YELLOW using the Color class −label.setBorder(BorderFactory.createMatteBorder(3, 5, 10, 5, Color.YELLOW));The following is an example ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
275 Views
The target attribute of the element allows you to display the response generated after submitting the form.Following is the syntax −Here, _blank is used to display the response in new window or tab, _self display the response in the same frame, _parent displays the response in the parent frame, ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
110 Views
Yes, using map(). Let us first create a collection with documents −> dblistOfSpecificValuesDemoinsertOne({"StudentName":"John"}); { "acknowledged" : true, "insertedId" : ObjectId("5cefcc8fef71edecf6a1f6bb") } > dblistOfSpecificValuesDemoinsertOne({"StudentName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5cefcc94ef71edecf6a1f6bc") } > dblistOfSpecificValuesDemoinsertOne({"StudentName":"Robert"}); { "acknowledged" : true, "insertedId" : ObjectId("5cefcc98ef71edecf6a1f6bd") } > dblistOfSpecificValuesDemoinsertOne({"StudentName":"David"}); { ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
137 Views
At first, create a JDesktopPane −JDesktopPane desktopPane = new JDesktopPane();Now, create an Internal Frame −JInternalFrame intFrame = new JInternalFrame("Our Frame", true, true, true, true); intFrame.setBounds(50, 90, 200, 250);Set Pallette layer for JDesktopPane and add the Internal Frame to JDesktopPane −intFrame.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); desktopPane.add(intFrame, JDesktopPane.PALETTE_LAYER);The following is an example to set palette ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
82 Views
Let us first create a collection with documents −> dbworkingOfRegularExpressionDemoinsertOne({ "StudentDetails" : { "StudentName" : "John" }, "StudentAge":21 }); { "acknowledged" : true, "insertedId" : ObjectId("5cf227acb64a577be5a2bc07") } > dbworkingOfRegularExpressionDemoinsertOne({ "StudentDetails" : { "StudentName" : "JOHN" }, "StudentAge":19 }); { "acknowledged" : true, "insertedId" : ObjectId("5cf227b8b64a577be5a2bc08") } ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
110 Views
Use the setTabPlacement() method to set the tab location. To make it visible in the bottom, use the BOTTOM constant −JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);The following is an example to specify tab location to make it visible in the bottom −package my; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; public ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
79 Views
Use the following constants for the JScrollBar to display the vertical and horizontal scrollbars always even if it is not required −scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);The following is an example to display the vertical and horizontal scrollbars always even if it is not required −Examplepackage my; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.Box; import ... Read More