Smita Kapse has Published 498 Articles

Java program to set the content of the JLabel to be left-justified and bottom-aligned

Smita Kapse

Smita Kapse

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

215 Views

To set the text of the label component to be left-justified and bottom-aligned, you need to set the alignment. Set the label to be on the left and bottom aligned −JLabel label = new JLabel("Fav Sports", JLabel.LEFT); label.setVerticalAlignment(JLabel.BOTTOM);Here, we have set the size of the label as well as the ... Read More

How to encrypt a CLOB datatype in JDBC?

Smita Kapse

Smita Kapse

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

323 Views

Creating an Encrypted LOB(CLOB or, BLOB)Oracle database from 11g onwards provides SecureFiles feature to encrypt the Large object files (LOBs). You can create a secure file using the SECUREFILE keyword as −CREATE TABLE table_name (    myClob CLOB ) LOB(myClob) STORE AS SECUREFILE;You can encrypt a secured file using Encrypt ... Read More

Use of explicit keyword in C++

Smita Kapse

Smita Kapse

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

963 Views

Here we will see what will be the effect of explicit keyword in C++. Before discussing that, let us see one example code, and try to find out its output.Example#include using namespace std; class Point {    private:       double x, y;    public:       ... Read More

How to display count of notifications in toolbar icon in Android?

Smita Kapse

Smita Kapse

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

650 Views

This example demonstrate about How to display count of notifications in toolbar icon in Android.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 to get all collections where collection name like '%2015%'?

Smita Kapse

Smita Kapse

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

564 Views

Let us first create some collections that starts from year number i.e. 2015, 2019, etc −> use web; switched to db web > db.createCollection("2015-myCollection"); { "ok" : 1 } > db.createCollection("2019-employeeCollection"); { "ok" : 1 } > db.createCollection("2015-yourCollection"); { "ok" : 1 }Now you can display all the collections with ... Read More

How to get the data type name from the java.sql.Type code using JDBC?

Smita Kapse

Smita Kapse

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

760 Views

The java.sql.Types class represents the SQL datatype in integer format. The valueOf() method of the enumeration JDBCType accepts an integer value representing the java.sql.Type and, returns the JDBC type corresponding to the specified value.ExampleLet us create a table with name MyPlayers in MySQL database using CREATE statement as shown below −CREATE ... Read More

Search a sub-field on MongoDB?

Smita Kapse

Smita Kapse

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

309 Views

To search a sub-filed in MongoDB, you can use double quotes along with dot notation. Let us first create a collection with documents −> db.searchSubFieldDemo.insertOne( ...   { ...      "UserDetails": ...      {"UserEmailId":"John123@gmail.com", "UserAge":21} ...   } ... ); {    "acknowledged" : true,    "insertedId" : ... Read More

Inheritance and friendship in C++

Smita Kapse

Smita Kapse

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

2K+ Views

In C++, the friendship is not inherited. It means that, if one parent class has some friend functions, then the child class will not get them as friend.In this example it will generate an error because the display() function is friend of MyBaseClass but not the friend of MyDerivedClass. The ... Read More

Insert MongoDB document field only when it's missing?

Smita Kapse

Smita Kapse

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

330 Views

Let us first create a collection with documents −>db.missingDocumentDemo.insertOne({"StudentFirstName":"Adam", "StudentLastName":"Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3fb1eedc6604c74817ce6") } >db.missingDocumentDemo.insertOne({"StudentFirstName":"Carol", "StudentLastName":"Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3fb29edc6604c74817ce7") } >db.missingDocumentDemo.insertOne({"StudentFirstName":"David", "StudentLastName":"Miller", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3fb40edc6604c74817ce8") }Following is the query to display ... Read More

Disable only the vertical scrollbar in Java

Smita Kapse

Smita Kapse

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

1K+ Views

To disable only the vertical scrollbar, use the VERTICAL_SCROLLBAR_NEVER constant, which displays only the horizontal scrollbar.The following is an example to disable only the vertical scrollbar in Java −Examplepackage my; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; public class SwingDemo {    public static void ... Read More

Advertisements