Arjun Thakur has Published 1109 Articles

MySQL select to count values equal to 0 and greater than 0 from a column?

Arjun Thakur

Arjun Thakur

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

848 Views

For this, use the CASE statement. Let us first create a table −mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.17 sec) ... Read More

How to enable row selection in a JTable with Java

Arjun Thakur

Arjun Thakur

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

2K+ Views

To enable row selection, use the setRowSelectionAllowed () method and set it to TRUE −table.setCell setRowSelectionAllowed(true);The following is an example to enable row selection in a JTable −Examplepackage my; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.border.TitledBorder; public class SwingDemo {    public static ... Read More

MySQL ORDER BY with different ordering for some of the values as descending and others ascending?

Arjun Thakur

Arjun Thakur

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

113 Views

You can use the field() for this. Let us first create a table −mysql> create table DemoTable    (    Value int    ); Query OK, 0 rows affected (0.80 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.18 ... Read More

How to display the JList items from top to bottom and left to right in Java?

Arjun Thakur

Arjun Thakur

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

327 Views

For this, set the layout orientation to the following −setLayoutOrientation(JList.VERTICAL_WRAP);The following is an example to display the JList items from top to bottom and left to right −Examplepackage my; import java.awt.BorderLayout; import java.util.ArrayList ; import java.util.List; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; public class SwingDemo {    public ... Read More

How to create Message Pop-Ups with Java?

Arjun Thakur

Arjun Thakur

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

558 Views

To create Message Pop-ups, use the following JOptionPane −JOptionPane.showMessageDialogWe are displaying a tree inside the message pop-ups. The following is an example to create Message Pop-Ups with Java −Examplepackage my; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; public class SwingDemo {    public static void main(String[] args) ... Read More

How to select a row where one of several columns equals a certain value in MySQL?

Arjun Thakur

Arjun Thakur

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

329 Views

For this, you can use multiple OR. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(10),    LastName varchar(10),    Age int,    CountryName varchar(10)    ); Query OK, 0 rows affected (0.58 sec)Insert some records ... Read More

How to create a border with a raised beveled edge in Java?

Arjun Thakur

Arjun Thakur

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

159 Views

Use the createRaisedBevelBorder() method to create a border with a raised beveled edge. We will set it on the label component −JLabel label; label = new JLabel("This has a border with a raised bevel edge!"); label.setBorder(BorderFactory.createRaisedBevelBorder());The following is an example to create a border with a raised beveled edge −Examplepackage ... Read More

Differences between Python 2.x and Python 3.x?

Arjun Thakur

Arjun Thakur

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

1K+ Views

There is always a debate in the coding community on which python version was the best one to learn: Python 2.x or Python 3.x.Below are key differences between pyton 2.x and python 3.x1. The print functionIn python 2.x, “print” is treated as a statement and python 3.x explicitly treats “print” ... Read More

Class or Static Variables in Python?

Arjun Thakur

Arjun Thakur

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

6K+ Views

When we declare a variable inside a class but outside any method, it is called as class or static variable in python. Class or static variable can be referred through a class but not directly through an instance.Class or static variable are quite distinct from and does not conflict with ... Read More

HTML