Ankith Reddy has Published 996 Articles

How to create a nested JSplitPane in Java?

Ankith Reddy

Ankith Reddy

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

295 Views

Let us first create three components −JComponent one = new JLabel("Label One"); one.setBorder(BorderFactory.createLineBorder(Color.yellow)); JComponent two = new JLabel("Label Two"); two.setBorder(BorderFactory.createLineBorder(Color.orange)); JComponent three = new JLabel("Label Three"); three.setBorder(BorderFactory.createLineBorder(Color.blue));Now, we will split one and two components.JSplitPane split1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, one, two); split1.setDividerLocation(0.5); split1.setDividerSize(2);After that the above splitted pane would be splitted ... Read More

How do I split a numerical query result in MySQL?

Ankith Reddy

Ankith Reddy

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

175 Views

To split a numerical query result, you can use the CONCAT() function in MySQL. Let us first create a table −mysql> create table DemoTable    (    StudentId int    ); Query OK, 0 rows affected (0.68 sec)Now you can insert some records in the table using insert command −mysql> ... Read More

Iterator Invalidation in C++

Ankith Reddy

Ankith Reddy

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

1K+ Views

In C++, we have different containers like vector, list, set, map etc. To iterate through these containers, we can use the iterators. We should be careful when we are using iterators in C++. When we are using iterating over a container, then sometimes, it may be invalidated. If the shape, ... Read More

Composite Design Pattern in C++

Ankith Reddy

Ankith Reddy

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

1K+ Views

Composite pattern is used where we need to treat a group of objects in similar way as a single object. Composite pattern composes objects in term of a tree structure to represent part as well as whole hierarchy. This type of design pattern comes under structural pattern as this pattern ... Read More

How to apply NOW() to timestamps field in MySQL Workbench?

Ankith Reddy

Ankith Reddy

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

983 Views

Let us first create a table −create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate timestamp );Insert some records in the table using insert command. Here, we have included the current date with NOW() −INSERT INTO DemoTable(ShippingDate) VALUES(now());Display all records from the table using select ... Read More

How to create an invisible fixed width component between two components in Java?

Ankith Reddy

Ankith Reddy

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

334 Views

Use the createHorizontalStrut() method to create an invisible width component between two components. Let’s say we have some button and we are creating a fixed width between them −box.add(button4); box.add(Box.createHorizontalStrut(50)); box.add(button5); box.add(Box.createHorizontalStrut(30)); box.add(button6);The following is an example to create an invisible fixed width component between two components −Examplepackage my; import ... Read More

Bidirectional Iterators in C++

Ankith Reddy

Ankith Reddy

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

452 Views

Here we will see the concept of Bidirectional iterators in C++.The bidirectional iterators support all of the features of forward iterators, and also prefix and postfix decrement operators.This type of iterator can access elements in both directions, like towards the end and towards the beginning.The random access iterator is also ... Read More

Concatenate two tables in MySQL with a condition?

Ankith Reddy

Ankith Reddy

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

703 Views

To concatenate two tables, UNION ALL in MySQL. Let us create a table −mysql> create table DemoTable1    (    Id int,    FirstName varchar(20)    ); Query OK, 0 rows affected (1.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 'John'); Query OK, ... Read More

How to set the maximized bounds for a Frame in Java?

Ankith Reddy

Ankith Reddy

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

482 Views

To set maximized bounds, use the setMaximizedBounds() method. Here, we will create a frame, which when maximized will form a shape −JFrame frame = new JFrame("Login!");Above, we have created a frame and now we will use the Rectangle class to specify an area of coordinates −Rectangle bounds = new Rectangle(50, ... Read More

HTML size Attribute

Ankith Reddy

Ankith Reddy

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

434 Views

The size attribute of the element is used to set the width of the input. The more the width would lead to a textbox with more width. You can set the size attribute for the following input types − text, search, email, password, tel and url.Following is the syntax ... Read More

Advertisements