Anvi Jain has Published 629 Articles

How to set color to MatteBorder in Java?

Anvi Jain

Anvi Jain

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

152 Views

Set color to MatteBorder using the Color class −Border border = new MatteBorder(5, 10, 5, 5, Color.BLUE);Now, set it to a button component in Java −JButton button = new JButton("Matte Border"); button.setBorder(border);The following is an example to set color to MatteBorder in Java −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import ... Read More

Removing an element from C++ std::vector<> by index?

Anvi Jain

Anvi Jain

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

280 Views

Remove an element from C++ std::vector by index can be done by following way −Example Live Demo#include #include using namespace std; int main() {    vector v; //declare vector    //insert elements into vector    v.push_back(-10);    v.push_back(7);    v.push_back(6);    // Deletes the first element (v[0])    v.erase(v.begin() );   ... Read More

What is a free function in C++?

Anvi Jain

Anvi Jain

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

280 Views

The C/C++ library function void free(void *ptr) deallocates the memory previously allocated by a call to calloc, malloc, or realloc. Following is the declaration for free() function.void free(void *ptr)This function takes a pointer ptr. This is the pointer to a memory block previously allocated with malloc, calloc or realloc to ... Read More

How to close the notification panel after notification button is clicked in Android?

Anvi Jain

Anvi Jain

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

1K+ Views

This example demonstrate about How to close the notification panel after notification button is clicked 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

Add MD5 hash value to MongoDB collection?

Anvi Jain

Anvi Jain

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

1K+ Views

To add MD5 hash value, use hex_md5(). Let us first create a collection with documents −>db.addMd5HashValueDemo.insertOne({"UserName":"Adam", "UserPassword":"Adam123456"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6a4c66d78f205348bc619") } >db.addMd5HashValueDemo.insertOne({"UserName":"Chris", "UserPassword":"Chris_121#"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6a4e46d78f205348bc61a") }Following is the query to display all documents from a collection with ... Read More

How to create notifications that do not go away when clicked in Android?

Anvi Jain

Anvi Jain

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

66 Views

This example demonstrate about How to start an activity when user clicks a 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 use clock() function in C++

Anvi Jain

Anvi Jain

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

1K+ Views

Here we will see how to use the clock() in C++. This clock() is present in the time.h or ctime header file. Here we will find the elapsed time of a process using this clock() functionTo get the elapsed time, we can get the time using clock() at the beginning, ... Read More

C++ Program to Implement Caesar Cypher

Anvi Jain

Anvi Jain

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

20K+ Views

It is a mono-alphabetic cipher wherein each letter of the plaintext is substituted by another letter to form the ciphertext. It is a simplest form of substitution cipher scheme.This cryptosystem is generally referred to as the Shift Cipher. The concept is to replace each alphabet by another alphabet which is ... Read More

How to change the maximum value of a JSlider in Java?

Anvi Jain

Anvi Jain

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

307 Views

To change the maximum value of a slider in Java, use the setMaximum() method wherein set the maximum value.Let’s say the following is our slider in Java −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55); slider.setMinorTickSpacing(10); slider.setMajorTickSpacing(25); slider.setPaintTicks(true); slider.setPaintLabels(true);Now, set the maximum value −slider.setMaximum(150);The following is an example to change ... Read More

How to read all the coming notifications in android?

Anvi Jain

Anvi Jain

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

4K+ Views

This example demonstrate about How to read all the coming notifications 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 src/MyListener.javapublic interface MyListener {   ... Read More

Advertisements