George John has Published 1081 Articles

I want to return the next node after this node in a JTree with Java

George John

George John

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

222 Views

Use the getNextNode() method to get the next node after this node in Java. Here, we are displaying the next node of child node “eight” -System.out.println("Next node after this node = "+eight.getNextNode());The following is an example to return the next node after this node in a JTree -Examplepackage my; import ... Read More

How to make a background 25% transparent on Android?

George John

George John

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

321 Views

This example demonstrate about How to make a background 25% transparent on 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 − Add ... Read More

How to set a value in a particular JTable cell with Java?

George John

George John

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

1K+ Views

Let’s say initially our table is the following with a specific cell [2, 1] with value “Kane” −The following is an example to set a new value to the above table. Here, we will update the cell [2, 1] −table.setValueAt("Guptill", 2, 1);Let us see the complete example −Examplepackage my; import ... Read More

How to make a JTree editable in Java?

George John

George John

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

608 Views

To make JTree editable in Java, use the TreeCellEditor class. With that, set the setEditable() method to true −TreeCellEditor editor = new DefaultCellEditor(textField); tree.setEditable(true); tree.setCellEditor(editor);The above will make the tree editable. The following is an example to make a JTree editable in Java −Examplepackage my; import javax.swing.DefaultCellEditor; import javax.swing.JFrame; import ... Read More

Can we get total number of rows in a MySQL database?

George John

George John

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

3K+ Views

To get the total number of rows in a MySQL database, you can use aggregate function SUM() along with inbuilt column TABLE_ROWS from INFORMATION_SCHEMA.TABLES.The syntax is as follows−SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database();Let’s say we are using the database with the name ‘sample’.Now we will get the total ... Read More

How can I set a table in a JPanel in Java?

George John

George John

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

1K+ Views

Let us first set rows and columns for our table −String[][] rec = {    { "1", "Steve", "AUS" },    { "2", "Virat", "IND" },    { "3", "Kane", "NZ" },    { "4", "David", "AUS" },    { "5", "Ben", "ENG" },    { "6", "Eion", "ENG" }, ... Read More

How to update MySQL column with random value?

George John

George John

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

2K+ Views

To update column with random value, you can use the below syntax−update yourTableName set yourColumnName =round(1+rand()*100);The above syntax will generate a value between 1 to 100. Let us see an example and create a table−mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected ... Read More

Disable Tooltip for a component with an already enabled tooltip in Java

George John

George John

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

472 Views

Let’s say we have set the tooltips for all the components using the following method in Java, for example −setToolTipText("Enter Age");Here, we have already enabled tooltips for all the components using the setToolTipText(). But, after enabling all of them, we disabled the tooltips using the following −ToolTipManager.sharedInstance().setEnabled(false);The following is an ... Read More

How to create a database on command line in MySQL?

George John

George John

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

4K+ Views

First, you need to open the command prompt. You can open using shortcut windows+R key.The screenshot is as follows −Now type CMD and press OK button −Now the following command prompt would be visible −Now reach the MySQL bin directory. The screenshot is as follows −Following is the query to ... Read More

8085 program to count number of elements which are less than 0A

George John

George John

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

543 Views

In this section we will count elements which are lesser than 0AH using 8085.problem StatementThere is an array of some elements. Write 8085 Assembly language program to count number of elements that are lesser than 0AH.DiscussionThe array is placed at location F051H onwards. The F050 is holding the size of ... Read More

Advertisements