Arjun Thakur has Published 1025 Articles

How to search between columns in MySQL?

Arjun Thakur

Arjun Thakur

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

180 Views

Use BETWEEN clause to search between columns. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Score1 int,    Score2 int    ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command ... Read More

Determine when a Frame or Window is Opened in Java

Arjun Thakur

Arjun Thakur

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

922 Views

To determine when a Window is opened in Java, use the WindowListener, which is the listener interface for receiving window events..WindowListener listener = new WindowAdapter() {    public void windowOpened(WindowEvent evt) {       Frame frame = (Frame) evt.getSource();       System.out.println("Opened "+frame.getTitle());    } };Above, we have ... Read More

HTML width Attribute

Arjun Thakur

Arjun Thakur

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

241 Views

The width attribute of the element is only used with image and allows you to set the width of the image added using −The width attribute introduced in HTML5 and acts as the submit button. Following is the syntax −Above, width represents the width in pixels.Let us now see ... Read More

Convert the column to a case-sensitive collation in MySQL?

Arjun Thakur

Arjun Thakur

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

604 Views

For this, you can use COLLATE. Following is the syntax −select *from yourTableName where yourColumnName LIKE yourValue COLLATE utf8_bin;Let us first create a table −mysql> create table DemoTable    (    LastName varchar(100)    ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command ... Read More

How to create Glue to fill the space between neighbouring components in Java?

Arjun Thakur

Arjun Thakur

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

583 Views

Let’s say we have 6 components and we need to fill the space between some of them −JButton button1 = new JButton("CSK"); JButton button2 = new JButton("DC"); JButton button3 = new JButton("MI"); JButton button4 = new JButton("SRH"); JButton button5 = new JButton("RR"); JButton button6 = new JButton("KKR");To fill the space ... Read More

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

1K+ 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

172 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

440 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

698 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

Advertisements