Display Horizontal Grid Lines in JTable with Java

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

995 Views

To display horizontal grid lines in a table, use the setShowHorizontalLines() method and set it to TRUE. Let us first create a table −String[][] rec = {    { "1", "Steve", "AUS" },    { "2", "Virat", "IND" },    { "3", "Kane", "NZ" },    { "4", "David", "AUS" },    { "5", "Ben", "ENG" },    { "6", "Eion", "ENG" }, }; String[] header = { "Rank", "Player", "Country" }; JTable table = new JTable(rec, header);Now, let us display vertical grid lines −table.setShowHorizontalLines(true);You can also give a color to these lines −table.setGridColor(Color.orange);The following is an example to display ... Read More

8086 Program to Generate Fibonacci Sequence

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

8K+ Views

Here we will see how to generate Fibonacci sequence using 8086Problem StatementWrite 8086 Assembly language program to generate Fibonacci sequence. The limit of the sequence is stored at location offset 500. The item will be stored from offset 600 onwards.DiscussionTo generate Fibonacci sequence, we are putting the 00H and 01H into memory at first. Then we are taking the limit from location offset 500. The limit is decreased by 2 at first, because 00H and 01H is already present there. Now we are taking number from previous location, then add it with the value of current location, after that storing ... Read More

8085 Program to Sum of Two 8-Bit Numbers Without Carry

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

2K+ Views

Here we will see how to add two 8-bit numbers without carry in 8085.Problem StatementWrite 8085 Assembly language program to perform 8-bit addition without carry. The numbers are stored at F100, and F101. Result will be stored at F102.DiscussionIn 8085, there is ADD instruction to add two numbers. We will set the HL pair to point the numbers, then load accumulator with the number. Then add with ADD M operation which can add items from memory pointed by HL pair and accumulator.InputAddressData……F100CEF10121…… Flow Diagram ProgramAddressHEX CodesLabelsMnemonicsCommentsF00021, 01, F1 LXI H, F100HPoint to get the numbersF0037E MOV A, MLoad first number to AF00423 INX HPoint to ... Read More

HTML Doctypes

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

191 Views

Whenever you create an HTML document, the doctype is the first thing placed in the document.It conveys the web browser about the version of the HTML, this page is written on. It is not casesensitive.Let us see an example displaying DOCTYPE on the top −Example Live Demo Document Title comes here    Demo Heading    This is the demo text. OutputNow let us see some of the declarations for doctype −HTML5 DeclarationExampleHTML 4 StrictThis document type includes all HTML elements except those that have been deprecated, and those that appear in frameset documents.HTML 4 ... Read More

Replace String After Last Occurrence in MySQL Column

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

163 Views

For this, use the substring_index() method. Let us first create a table −mysql> create table DemoTable    -> (    -> FolderName varchar(100),    -> FolderLocation varchar(200)    -> ); Query OK, 0 rows affected (1.03 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('CProgram', 'C:/AllPrograms/.....'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Images', 'E:/MyImage/home/garbage'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+------------+-------------------------+ | FolderName | FolderLocation          | +------------+-------------------------+ | CProgram   | C:/AllPrograms/.....   ... Read More

Select Table Name as Column in UNION SELECT Query with MySQL

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

531 Views

You can use AS command for this. Let us first create a table −mysql> create table DemoTable    (    Name varchar(20)    ); Query OK, 0 rows affected (0.56 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.18 sec)Display all records from the table using select statement −mysql> select * from DemoTable;This will produce the following output −+------+ | Name | +------+ | John | +------+ 1 row in set (0.00 sec)Here is the query to create the second table.mysql> create table DemoTable2    (    Name varchar(20)   ... Read More

Java DatabaseMetaData getMaxRowSize Method with Example

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

94 Views

The getMaxRowSize() method of the DatabaseMetaData interface is used to find out the maximum number of bytes that the underlying database allows in a row.This method returns an integer value, representing the maximum row size. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the ... Read More

MySQL Stored Procedure to Create a Table

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

3K+ Views

Following is the query to create a stored procedure that creates a table. Here, we are creating a table with three columns, one of them is Id −mysql> DELIMITER //    mysql> CREATE PROCEDURE Stored_Procedure_CreatingTable()    BEGIN       create table DemoTable       (       Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,       UserFirstName varchar(20),       UserLastName varchar(20)       );    END;    //    Query OK, 0 rows affected (0.16 sec) mysql> DELIMITER ;Now you can call stored procedure with the help of CALL command −mysql> call Stored_Procedure_CreatingTable(); ... Read More

Disable Auto-Resizing to Make JTable Horizontally Scrollable in Java

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

842 Views

To disable auto resizing, you need to use the setAutoResizeMode() method. After that, set the table to AUTO_RESIZE_OFF.Let’s say the following is our table −String[][] rec = {    { "1", "Virat", "840" },    { "2", "David", "835" },    { "3", "Shikhar", "656" },    { "4", "Steve", "530" },    { "5", "Kane", "515" },    { "6", "Eion", "509" },    { "7", "AB de Villiers", "498" },    { "8", "Quinton", "470" },    { "9", "Glenn", "410" },    { "10", "Tom", "360" },    { "11", "Johnny", "320" },    { "12", "Shreyas", ... Read More

Generate G.P. Series of N Numbers in 8086

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

366 Views

In this program we will see how to find GP series using 8086.Problem StatementWrite 8086 Assembly language program to find GP series. The limit of the series is stored at 500, First term is stored at 501, and the common ratio is stored at 502.DiscussionGP generation is simple task. We are taking the limit as counter value, the first term is loaded into AL first, then the BL is holding the common ratio r. Now the result is storing memory offset 600 onwards. The AL is placing as it is, then repeatedly multiply BL with AL and store it into ... Read More

Advertisements