Skip to content

Commit 02cd824

Browse files
authored
Update README.md
1 parent e9ad6ab commit 02cd824

File tree

1 file changed

+80
-2
lines changed

1 file changed

+80
-2
lines changed

README.md

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,82 @@
1-
# ConsoleTable4java
2-
A `console based` (Non-GUI) table creator module in java , for `Adaptive` table creation inside console/terminal
1+
# Console Table For Java (ct4j)
2+
The `Java Console Table (ct4j)` is a `Java library` that helps to create adaptive tables inside the console or terminal. This module is designed to create and customize tables for the console in the easiest way possible.
3+
4+
## Features
5+
- Create a table for the console.
6+
- Set the headers of the table.
7+
- Add data/rows to the table.
8+
- Customize the table by setting horizontal separator, vertical separator, and corner joint.
9+
- Set table headers to uppercase.
10+
11+
## Installation
12+
You can use this module by cloning it and specifying the `package ConsoleTable;`
13+
```
14+
git clone https://github.com/Cozmeh/ConsoleTable4java.git
15+
```
16+
> clone it in your desired folder using the above command in terminal(cmd)
17+
18+
Alternatively, you can download the `jcTable.jar` file from the `Releases` and add it to your project's classpath.
19+
20+
## Usage
21+
To use the this module, you need to import the `ct4j` class into your project after adding the `jcTable.jar` to your project's classpath. Then, create an object of the `ct4j` class and use its methods to set up the table and add data to it.
22+
23+
Here's an example usage of the ct4j module:
24+
```
25+
import ConsoleTable.ct4j;
26+
27+
public class Example {
28+
29+
public static void main(String[] args) throws Exception {
30+
31+
ct4j table = new ct4j();
32+
33+
// Set table headers
34+
table.setHeader("Name", "Age", "City");
35+
36+
// Add data/rows to the table
37+
table.addRow("Krishna", "24", "Dwaraka");
38+
table.addRow("Arjuna", "21", "Hastinapur");
39+
40+
// Customize the table
41+
table.setHorizontalSeparator('-');
42+
table.setVerticalSeparator('|');
43+
table.setCornerJoint('+');
44+
table.setUppercaseHeaders(true);
45+
46+
// Print the table
47+
table.printTable();
48+
49+
}
50+
}
51+
52+
```
53+
54+
> Output
55+
56+
```
57+
+---------+-----+------------+
58+
| NAME | AGE | CITY |
59+
+---------+-----+------------+
60+
| Krishna | 24 | Dwaraka |
61+
| Arjuna | 21 | Hastinapur |
62+
+---------+-----+------------+
63+
```
64+
This code will create a table with three columns: `Name, Age, and City`. It will then add two rows of data to the table and print the table to the console.
65+
66+
## Customization
67+
You can customize the appearance of the table by using the following methods:
68+
69+
- `setHorizontalSeparator(char HorizontalSeparator)`
70+
- Set the horizontal separator for the table (default is -).
71+
- `setVerticalSeparator(char VerticalSeparator)`
72+
- Set the vertical separator for the table (default is |).
73+
- `setCornerJoint(char CornerJoint)`
74+
- Set the corner joint for the table (default is +).
75+
- `setUppercaseHeaders(Boolean uppercaseHeader)`
76+
- Set the headers of the table to uppercase (default is false).
77+
78+
### Note
79+
- Incase of any problem, you can create an `Issue`
80+
- If interested , feel free to `Contribute`
381

482

0 commit comments

Comments
 (0)