George John has Published 1167 Articles

How to make a JTree editable in Java?

George John

George John

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

406 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

886 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

HTML DOM accessKey Property

George John

George John

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

96 Views

The HTML DOM accessKey property is used to set the accessKey attribute of an element. However, the accesskey attribute in HTML is used to set a shortcut key to activate or focus on an element.Following is the syntax to set the accessKey property −HTMLElementObject.accessKey = charAbove, char is the shortcut ... 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

357 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

405 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

How to create a horizontal slider with custom min, max, and initial value in Java

George John

George John

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

208 Views

While creating horizontal slider, we can set custom values as well. Let us take three integer variable and set the int values for min, max as well as the initial value of the slider −int val = 75; int min = 0; int max = 100;Set it to the slider ... Read More

HTML href Attribute

George John

George John

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

121 Views

The href attribute of the element sets the the hyperlink target. Following is the syntax −Above, URL is the hyperlink you need to mention for the area, which can be a relative link, absolute link, script, protocol, etc.Let us now see an example to implement the href attribute of ... Read More

Advertisements