Ankith Reddy has Published 996 Articles

Can we create nested TitiledBorder in Java?

Ankith Reddy

Ankith Reddy

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

170 Views

Yes, we can create nested TitledBorder. Let us first create a component for which we will set the border −JLabel label = new JLabel();Now, we will create the 1st border −TitledBorder border = BorderFactory.createTitledBorder("Top Border"); border.setTitlePosition(TitledBorder.TOP);Following is how we will creater border 2. We have set the 1st border here ... Read More

HTML Tag

Ankith Reddy

Ankith Reddy

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

121 Views

The element in HTML is used to set keyboard input. Since the element deprecated now, therefore use instead.Note: The tag is not supported in HTML.Let us now see an example to implement the tag in HTML−Example Live Demo Shortcut Keys Use the following shortcut keys: ... Read More

How to set TitiledBorder Direction in Java?

Ankith Reddy

Ankith Reddy

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

157 Views

To set TitleBorder direction, you need to use the constants and set it for border. For example, for direction center −TitledBorder border = BorderFactory.createTitledBorder("Border"); border.setTitlePosition(TitledBorder.CENTER);Above, we have set the setTitlePosition() for the direction.The following is an example to set TitledBorder direction in Java −Examplepackage my; import java.awt.BorderLayout; import java.awt.Container; import ... Read More

OpenCV Python Program to blur an image?

Ankith Reddy

Ankith Reddy

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

612 Views

OpenCV is one of the best python package for image processing. Also like signals carry noise attached to it, images too contain different types of noise mainly from the source itself (Camera sensor). Python OpenCV package provides ways for image smoothing also called blurring. This is what we are going ... Read More

Projection result as an array of selected items in MongoDB?

Ankith Reddy

Ankith Reddy

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

155 Views

Use the distinct() for this, since it finds the distinct values for a specified field across a single collection or view and returns the results in an array.Let us first create a collection with documents −> db.projectionListDemo.insertOne({"_id":"1", "Subject":["MongoDB", "MySQL", "Java"]}); { "acknowledged" : true, "insertedId" : "1" } > db.projectionListDemo.insertOne({"_id":"2", ... Read More

How to find a node in a JTree Component with Java?

Ankith Reddy

Ankith Reddy

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

848 Views

To find a node in a JTree component, use the getNextMatch() method. Here, wer are trying to find a node that begins with character “A”. The search begins from the node set below with begnRow variable −int begnRow = 0; String prefix = "A"; TreePath treePath = tree.getNextMatch(prefix, begnRow, Position.Bias.Forward);We ... Read More

Check if hidden files are displayed in the FileChooser or not in Java

Ankith Reddy

Ankith Reddy

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

95 Views

The result FALSE for is FileHidingEnabled() means the hidden files are displayed in the FileChooser. The following will display FALSE since file isn’t hidden −JFileChooser file = new JFileChooser(); file.setMultiSelectionEnabled(false); file.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); file.setFileHidingEnabled(false); boolean res = file.isFileHidingEnabled();Above, at first, we have displayed the file by setting hidden to be FALSE −file.setFileHidingEnabled(false);The following ... Read More

Line detection in python with OpenCV?

Ankith Reddy

Ankith Reddy

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

3K+ Views

In this post, we are going to learn, how to detect lines in an image, with the help of a technique called Hough transform.Hough transform?Hough transform is a feature extraction method to detect any simple shape, if you can represent that shape in mathematical form. It somehow manage to detect ... Read More

Limit number of values in a field using MongoDB?

Ankith Reddy

Ankith Reddy

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

346 Views

To limit number of values in a field, use $slice operator.Let us first create a collection with documents −> db.numberOfValuesDemo.insertOne({"Values":[100, 200, 300, 900, 1000, 98]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cefb736ef71edecf6a1f6ab") }Display all documents from a collection with the help of find() method −> db.numberOfValuesDemo.find().pretty();Output{    "_id" ... Read More

HTML rel Attribute

Ankith Reddy

Ankith Reddy

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

146 Views

The rel attribute of the element is used to set the relationship between the current document and the linked document. This attribute introduced in HTML5 for the element. Following is the syntax −Above, value can be any of the following options that links to −alternate: An alternate version of ... Read More

Advertisements