Ankith Reddy has Published 996 Articles

Java Program to get the previous leaf from a JTree

Ankith Reddy

Ankith Reddy

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

159 Views

Use the getPreviousLeaf() method to get the previous leaf in a JTree. Here, we are displaying the leaf before this node “eight” on Console -System.out.println("Get Previous Leaf = "+eight.getPreviousLeaf());The following is an example to get the previous leaf from a JTree -Examplepackage my; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; public ... Read More

How to disable action bar permanently in Android?

Ankith Reddy

Ankith Reddy

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

545 Views

This example demonstrate about How to disable action bar permanently 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.java     Step 3 ... Read More

Java Program to get the next sibling in a JTree

Ankith Reddy

Ankith Reddy

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

398 Views

Use the getNextSibling() method to get the next sibling. Here, we are getting the next sibling of child node “five” and displaying on Console −System.out.println("Get Next Sibling = "+five.getNextSibling());The following is an example to get the next sibling in a JTree −Examplepackage my; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; public ... Read More

Select last day of current year in MySQL?

Ankith Reddy

Ankith Reddy

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

1K+ Views

In order to get last day of current year, you can use LAST_DAY() from MySQL. The syntax is as follows−SELECT LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 12-MONTH(CURDATE()) MONTH));Let us implement the above syntax to know the last day of current year−mysql> SELECT LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 12-MONTH(CURDATE()) MONTH));This will produce the following output −+-------------------------------------------------------------------+ | LAST_DAY(DATE_ADD(CURDATE(), ... Read More

How to create a Default Cell Editor with textbox in Java?

Ankith Reddy

Ankith Reddy

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

276 Views

Create a JTextBox first −JTextField textField = new JTextField();Set the above JTextFile for the Default Cell Editor −TreeCellEditor editor = new DefaultCellEditor(textField); tree.setEditable(true); tree.setCellEditor(editor);The following is an example to create a default cell editor with textbox −Examplepackage my; import javax.swing.DefaultCellEditor; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeCellEditor; ... Read More

How to make a canvas in Java Swing?

Ankith Reddy

Ankith Reddy

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

3K+ Views

To make a canvas with Java Swing, use the Graphics2D class −public void paint(Graphics g) {    Graphics2D graphic2d = (Graphics2D) g;    graphic2d.setColor(Color.BLUE);    graphic2d.fillRect(100, 50, 60, 80); }Above, we have created a rectangle and also added color to it.The following is an example to make a canvas in ... Read More

HTML DOM activeElement Property

Ankith Reddy

Ankith Reddy

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

189 Views

The HTML DOM activeElement property is a read-only property to return the currently focused element in the document.Following is the syntax −document.activeElementLet us now see an example to implement the DOM activeElement property −Example Live Demo Heading Two Click in the element to get the active element. ... Read More

How to set all the values at once using the model in a JProgressBar with Java?

Ankith Reddy

Ankith Reddy

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

89 Views

The getModel() method is used to set all the values at once for a JProgressBar −int newVal = 5; int newMin = 0; int newMax = 100; progressBar.getModel().setRangeProperties(newVal, 0, newMin, newMax, true);The following is an example to set all the values at once using the model in a progress bar ... Read More

8085 program to check whether both the nibbles of 8 bit number are equal or not

Ankith Reddy

Ankith Reddy

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

690 Views

Here we will see how to check whether two nibbles of a number are same or not.Problem StatementWrite 8085 Assembly language program to check whether upper nibble and lower nibbles are same or not.DiscussionTo check the nibbles, we have to mask at first. So we need to mask the lower ... Read More

HTML
autocomplete Attribute

Ankith Reddy

Ankith Reddy

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

148 Views

The autocomplete attribute of the element allows you to set whether the autocomplete for the form should be on or off. The web browser automatically fills the values if the autocomplete is on. This only happens if the user already entered values before.Following is the syntax −Above, on | ... Read More

Advertisements