Smita Kapse has Published 558 Articles

How to create a JMenuBar Component in Java?

Smita Kapse

Smita Kapse

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

142 Views

To create a JMenuBar component, use the JMenuBar class −JMenuBar menuBar = new JMenuBar();Now, create menus inside the MenuBar −JMenu fileMenu = new JMenu("File");Add the above menu to the MenuBar −menuBar.add(fileMenu);The following is an example to create a JMenuBar Component in Java −Examplepackage my; import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JMenu; ... Read More

How do I terminate a thread in C++11?

Smita Kapse

Smita Kapse

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

6K+ Views

Here we will see, how to terminate the threads in C++11. The C++11 does not have direct method to terminate the threads.The std::future can be used to the thread, and it should exit when value in future is available. If we want to send a signal to the thread, but ... Read More

C++ Program to Find the maximum subarray sum using Binary Search approach

Smita Kapse

Smita Kapse

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

219 Views

Binary search is a fast search algorithm with run-time complexity of Ο(log n). This search algorithm works on the principle of divide and conquer. For this algorithm to work properly, the data collection should be in the sorted form.Binary search looks for a particular item by comparing the middle most ... Read More

Increment a field in MongoDB document which is embedded?

Smita Kapse

Smita Kapse

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

131 Views

Let’s say, here we are incrementing StudentScores for MongoDB which is inside StudentDetails −... "StudentScores": { ...    "StudentMathScore": 90, ...    "StudentMongoDBScore": 78 ... }Let us first create a collection with documents −> db.embeddedValueIncrementDemo.insertOne( ...    { ...       "StudentDetails": { ...          "StudentScores": ... Read More

How to set Echo Char for JPasswordField in Java?

Smita Kapse

Smita Kapse

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

3K+ Views

With echo char, you can set a character that would appear whenever a user will type the password in the JPasswordField.Let us first create a new JPassword field −JPasswordField passwd = new JPasswordField();Now, use the setEchoChar() to set the echo char for password field. Here, we have asterisk (*) as ... Read More

How to determine whether C++ code has been compiled in 32 or 64 bit?

Smita Kapse

Smita Kapse

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

762 Views

In C++, there is no direct way to check the environment architecture. There are two Macros for Windows systems, that can be used to check the architecture. These macros are _WIN64, and _WIN32. When the system is 64-bit, then the _WIN64 will be 1, otherwise the _WIN32 will be 1. ... Read More

Print prime numbers in a given range using C++ STL

Smita Kapse

Smita Kapse

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

462 Views

It is the program to print prime numbers in a given range.AlgorithmsBegin    Declare a user define datatype stl.    Declare a vector number to the stl datatype.    Declare variable a to the stl datatype.    Declare vector Prime_Number to the Boolean datatype.       Prime_Number[0] = false. ... Read More

Java Program to set the height of only a single row in a JTable with multiple rows

Smita Kapse

Smita Kapse

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

594 Views

To set the row height, use the setRowHeight and set a parameter that would be the number of pixels you need to set the row height.However, if you want to set the row height of a single row then you need to use the same method, but set an additional ... Read More

How to move the horizontal slider right-to-left in Java?

Smita Kapse

Smita Kapse

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

140 Views

At first, let us create a horizontal slider −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55);Now, we will set it to move right-to-left using setInverted() −slider.setInverted(true);The following is an example to move the horizontal slider right-to-left −Examplepackage my; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.WindowConstants; ... Read More

C++ Program to Find the Minimum value of Binary Search Tree

Smita Kapse

Smita Kapse

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

229 Views

It is a program to find the minimum value of a binary search tree.AlgorithmsBegin    Declare nd as a structure.    Declare d to the integer datatype.    Declare pointer lt to the structure nd type.    Declare pointer lt to the structure nd type.    Declare function new_nd() to ... Read More

Advertisements