Chandu yadav has Published 1163 Articles

How can I define underlined text in an Android layout xml file?

Chandu yadav

Chandu yadav

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

1K+ Views

This example demonstrate about How can I define underlined text in an Android layout xml file.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 ... Read More

How to get the leaf after this node in a JTree component with Java?

Chandu yadav

Chandu yadav

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

112 Views

Use the getNextLeaf() method to get the leaf after this node in a JTree. Here, we are displaying the leaf after node “three” in Console −System.out.println("Next leaf after this node = "+three.getNextLeaf());The following is an example to get the leaf node after this node in a JTree component −package my; ... Read More

How do you fill in or pad a column with zeros using a MySQL query?

Chandu yadav

Chandu yadav

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

382 Views

You can use ZEROFILL for column to fill in or pad with zeros. Let us first create a table−mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected (0.58 sec)Following is the query to add zerofill attribute for Number column−mysql> alter table DemoTable change ... Read More

How to set margins in an Android LinearLayout programmatically?

Chandu yadav

Chandu yadav

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

4K+ Views

This example demonstrate about How to set margins in an Android LinearLayout programmatically.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 limit the values in a Number JSpinner Component with Java?

Chandu yadav

Chandu yadav

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

1K+ Views

To limit the values in a number JSpinner component, use the SpinnerNumberModel that allows to set the min, max, step size and even the initial value −value − current value of the model min − first number in the sequence max − last number in the sequence stepSize − difference ... Read More

HTML defaultPrevented Event Property

Chandu yadav

Chandu yadav

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

136 Views

The defaultPrevented event property in HTML is used to check whether the preventDefault() method was called or not. It returns a boolean value i.e. true if the preventDefault() method was called, else false.Following is the syntax −event.defaultPreventedLet us now see an example to implement the defaultPrevented event property in HTML ... Read More

How to create a Number Spinner in Java?

Chandu yadav

Chandu yadav

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

328 Views

At first, create a SpinnerModel −SpinnerModel value = new SpinnerNumberModel(50, 0, 75, 1);Now, set the values −JSpinner spinner = new JSpinner(value);The following is an example to create a number spinner −Examplepackage my; import javax.swing.*; public class SwingDemo {    public static void main(String[] args) {       JFrame frame ... Read More

What are the Selection Modes in a JTable with Java?

Chandu yadav

Chandu yadav

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

559 Views

Selection modes sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals. Let us see the selection modes one by one −Single Selection modeThe following is an example of Single Selection mode for a JTable. It allows you to select one cell at ... Read More

MySQL select to convert numbers to millions and billions format?

Chandu yadav

Chandu yadav

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

1K+ Views

You can use FORMAT() from MySQL to convert numbers to millions and billions format. Let us first create a table−mysql> create table DemoTable    (    Value BIGINT    ); Query OK, 0 rows affected (0.74 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(78000000000); Query ... Read More

How to select more than one row at a time in a JTable with Java?

Chandu yadav

Chandu yadav

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

1K+ Views

To select more than one row in a JTable, use the setRowSelectionInterval() method. Here, set the indexes as interval for one end as well as other end.For multiple rows in a range, set the range. Here, we are selecting rows from index 1 to index 2 i.e. two rows −table.setRowSelectionInterval(1, ... Read More

Advertisements