Ankith Reddy has Published 1070 Articles

Find size of text stored in a specific MySQL column?

Ankith Reddy

Ankith Reddy

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

209 Views

You can use length() from MySQL to find the size of text stores in a specific column. Let us first create a tablemysql> create table DemoTable    (    CustomerName longtext    ); Query OK, 0 rows affected (0.67 sec)Insert records in the table using insert command −mysql> insert into ... Read More

How do I get the resource id of an image if I know its name in Android?

Ankith Reddy

Ankith Reddy

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

2K+ Views

This example demonstrate about How do I get the resource id of an image if I know its name 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 ... Read More

IF() function in a MySQL Select statement?

Ankith Reddy

Ankith Reddy

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

315 Views

The IF() function returns a value based on a condition.The syntax is as follows−SELECT IF(yourCondition, yourMessageIfConditionBecomesTrue, yourMessageIfConditionBecomesFalse) from yourTableName; Let us first create a table: mysql> create table DemoTable    (    Value int    ); Query OK, 0 rows affected (0.60 sec)Insert records in the table using insert command ... Read More

Java Program to get the previous leaf from a JTree

Ankith Reddy

Ankith Reddy

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

95 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

420 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

243 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

175 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

123 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

Advertisements