George John has Published 1081 Articles

MySQL query to select date >= current date - 3 weeks?

George John

George John

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

786 Views

Use the concept of DATE_SUB(). Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ArrivalDate datetime    ); Query OK, 0 rows affected (1.02 sec)Note: Let’s say the current date is 2019-06-08Insert some records in the table using ... Read More

Select specific rows in a range with MySQL?

George John

George John

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

618 Views

Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(20)    ); Query OK, 0 rows affected (1.23 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName) values('John'); Query OK, 1 row affected ... Read More

How to make JTable single selectable in Java?

George John

George John

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

276 Views

To make JTable single selectable in Java, you need to set the selection mode to be SINGE_SELECTION. Let’s say the following is our table −String[][] rec = {    { "001", "Shirts", "40" },    { "002", "Trousers", "250" },    { "003", "Jeans", "25" },    { "004", "Applicances", ... Read More

How to create a vertical toolbar in Java?

George John

George John

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

525 Views

Let us first create a toolbar −JToolBar toolbar = new JToolBar();Now, set the orientation to create vertical toolbar −toolbar.setOrientation(SwingConstants.VERTICAL);The following is an example to create a vertical toolbar in Java −package my; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JToolBar; import javax.swing.SwingConstants; public class SwingDemo {    public ... Read More

How to add a title to an existing line border in Java?

George John

George John

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

307 Views

Here, we will see how to add a title to an existing Line border. Let’s say we have a label and the border is to be set −LineBorder linedBorder = new LineBorder(Color.blue); TitledBorder titledBorder = BorderFactory.createTitledBorder(linedBorder, "Demo Title"); JLabel label = new JLabel(); label.setBorder(titledBorder);The following is an example to add ... Read More

HTML