Nishtha Thakur has Published 498 Articles

How to hide the track on the slider in Java?

Nishtha Thakur

Nishtha Thakur

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

252 Views

To hide the track on the slider, you need to use the setPaintTrack() method and set it to FALSE −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55); slider.setInverted(true); slider.setMinorTickSpacing(10); slider.setMajorTickSpacing(25); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setPaintTrack(false);The above method setPaintTrack() is by default set to TRUE.The following is an example to hide the track ... Read More

Retrieve values from nested JSON array in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To retrieve values from nested JSON array, you can use the below syntax −db.yourCollectionName.find({"yourOuterFieldName.yourInnerFieldName.yourNextInnerFieldName…...N": "yourValue"}).pretty();Let us first create a collection with documents −> db.nestedJSONArrayDemo.insertOne({ ...    "ClientDetails" : ...    { ...       "ClientPersonalDetails" : [ ...          { "CountryName" : "US" }, ...   ... Read More

How to arrange components in a Flow to be right-justified in Java?

Nishtha Thakur

Nishtha Thakur

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

118 Views

Use FlowLayout.RIGHT to arrange components in a FlowLayout to be right-justified. −JFrame frame = new JFrame("Language"); frame.setLayout(new FlowLayout(FlowLayout.RIGHT));The following is an example to arrange components in a flow to be right-justified −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public ... Read More

How to style an Android notification using InboxStyle?

Nishtha Thakur

Nishtha Thakur

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

152 Views

This example demonstrate about How to style an Android notification using InboxStyleStep 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.     Step 3 ... Read More

How to filter array elements in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

326 Views

You can use $setIntersection operator along with aggregate framework to filter array elements in MongoDB. Let us first create a collection with documents −> db.filterArrayElementsDemo.insertOne( { "Scores": [10, 45, 67, 78, 90, 98, 99, 92] } ); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2d582b64f4b851c3a13c8") }Following is the query ... Read More

Check whether field exist in MongoDB or not?

Nishtha Thakur

Nishtha Thakur

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

226 Views

You can use $exists operator for this. Let us first create a collection with documents −>db.checkFieldExistsDemo.insertOne({"StudentFirstName":"John", "StudentGender":"Male", "StudentMongoDBScore":89}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd909611a844af18acdffbd") } >db.checkFieldExistsDemo.insertOne({"StudentFirstName":"Emma", "StudentGender":"Female", "StudentMongoDBScore":58}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd909781a844af18acdffbe") } >db.checkFieldExistsDemo.insertOne({"StudentFirstName":"Carol", "StudentGender":"Male", "StudentMongoDBScore":77}); {    "acknowledged" : true,   ... Read More

How to ceate right justified JTextField in Java?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

To create right justified JTextField, set the alignment to be RIGHT. Here, we will be using the setHorizontalAlignment() method as well and within that the alignment would be set.Create a JTextField −JTextField emailId = new JTextField(20);Now, align it to the right −emailId.setHorizontalAlignment(JTextField.RIGHT);The following is an example to create right justified ... Read More

nextafter() and nexttoward() in C/C++

Nishtha Thakur

Nishtha Thakur

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

273 Views

Here we will see the effect of nextafter() and nextforward() functions in C or C++. These functions are present in the math.h or cmath library.if the functions are like nextafter(a, b) and nextforward(a, b). These functions are used to find the next representable value after a in the direction of ... Read More

Get at least one match in list querying with MongoDB?

Nishtha Thakur

Nishtha Thakur

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

438 Views

Use $in operator to get at least one match. Let us first create a collection with documents −> db.atleastOneMatchDemo.insertOne({"StudentFavouriteSubject":["MySQL", "MongoDB"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2db5db64f4b851c3a13ce") } > db.atleastOneMatchDemo.insertOne({"StudentFavouriteSubject":["Java", "C", "MongoDB"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2db71b64f4b851c3a13cf") } > db.atleastOneMatchDemo.insertOne({"StudentFavouriteSubject":["Python", "C++", "SQL Server"]}); { ... Read More

How do I search according to fields in inner classes using MongoDB db.coll.find()?

Nishtha Thakur

Nishtha Thakur

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

165 Views

Use dot notation(.) to search in inner classes using MongoDB. Let us first create a collection with documents −> db.searchInInnerDemo.insertOne( ...    { ...       "StudentFirstName" : "Robert", ...       "StudentTechnicalDetails": ...       { ...          "StudentBackEndTechnology" : "MongoDB", ...   ... Read More

Advertisements