- 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
Nishtha Thakur has Published 564 Articles
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
6K+ Views
Let us first create a panel and set some buttons −JPanel panel = new JPanel(); JButton btn1 = new JButton("One"); JButton btn2 = new JButton("Two"); JButton btn3 = new JButton("Three"); JButton btn4 = new JButton("Four"); JButton btn5 = new JButton("Five"); panel.add(btn1); panel.add(btn2); panel.add(btn3); panel.add(btn4); panel.add(btn5);Now, use the setAlignmentX() and within ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
65 Views
You can use INFORMATION_SCHEMA.COLUMNS for this. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(20) ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
1K+ Views
Here we will see the Johnson’s Algorithm to find shortest path between two vertices. The graph is given here. The shortest path between the edges is like below. This program will take the number of vertices, number of edges, and the edges with their costs.Input − Vertices: 3Edges: 5Edge with costs ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
907 Views
Let’s say we have a Frame with layout set as BoxLayout −JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));Set the preferred size using setPreferredSize() and withing that specify the values for width and height −JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(100, 500));The following is an example to set preferred ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
281 Views
You can use $type operator to check whether a filed contains null value. Let us first create a collection with documents. We have also inserted a null in a field −> db.nullDemo.insertOne({"FirstName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5cc68a1eac184d684e3fa270") } > db.nullDemo.insertOne({"FirstName":null}); { "acknowledged" : true, ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
439 Views
To distribute the extra horizontal and vertical space, use the fields weightx and weighty. The following is an example to distribute extra horizontal and vertical space −Examplepackage my; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public class SwingDemo { public static void ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
2K+ Views
In C++, there is one good feature called inline function. This kind of functions are like the macros of C or C++. To use inline functions, we have to specify the inline keyword. We can use this type of functions anywhere, but we should follow some guideline.When inline can be ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
247 Views
Here we will see how to change the output of the printf() function from main(). Here we will define a function that will change all of the printf() statements with the given type to another type.We will use the #define macro to do this task. This macro will be defined ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
222 Views
This is a C++ program to find whether a path exists between 2 given nodesAlgorithmBegin function isReach() is a recursive function to check whether d is reachable to s: A) Mark all the vertices as unvisited. B) Mark the current node as visited and enqueue it and ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
Nishtha Thakur
92 Views
You can use aggregate framework. Let us first create a collection with documents −> db.topCountArrayDemo.insertOne( ... {"StudentId":101 , "StudentSubject": ["C", "MongoDB"]} ... ); { "acknowledged" : true, "insertedId" : ObjectId("5cc6b3209cb58ca2b005e669") } > db.topCountArrayDemo.insertOne( ... {"StudentId":102 , "StudentSubject": ["C", "Java"]} ... ); { "acknowledged" : true, ... Read More