diff --git a/_example/table.go b/_example/table.go index 4f54863..fb4991b 100644 --- a/_example/table.go +++ b/_example/table.go @@ -12,43 +12,43 @@ func main() { panic(err) } defer termui.Close() - rows_1 := [][]string{ + rows1 := [][]string{ []string{"header1", "header2", "header3"}, - []string{"孙嘉你好吗", "Go-lang is so cool", "Im working on Ruby"}, + []string{"你好吗", "Go-lang is so cool", "Im working on Ruby"}, []string{"2016", "10", "11"}, } - table_1 := termui.NewTable() - table_1.Rows = rows_1 - table_1.FgColor = termui.ColorWhite - table_1.BgColor = termui.ColorDefault - table_1.Y = 0 - table_1.X = 0 - table_1.Width = 62 - table_1.Height = 7 + table1 := termui.NewTable() + table1.Rows = rows1 + table1.FgColor = termui.ColorWhite + table1.BgColor = termui.ColorDefault + table1.Y = 0 + table1.X = 0 + table1.Width = 62 + table1.Height = 7 - termui.Render(table_1) + termui.Render(table1) - rows := [][]string{ + rows2 := [][]string{ []string{"header1", "header2", "header3"}, []string{"Foundations", "Go-lang is so cool", "Im working on Ruby"}, []string{"2016", "11", "11"}, } - table := termui.NewTable() - table.Rows = rows - table.FgColor = termui.ColorWhite - table.BgColor = termui.ColorDefault - table.TextAlign = termui.AlignCenter - table.Separator = false - table.Analysis() - table.SetSize() - table.BgColors[2] = termui.ColorRed - table.Y = 20 - table.X = 0 - table.Border = true + table2 := termui.NewTable() + table2.Rows = rows2 + table2.FgColor = termui.ColorWhite + table2.BgColor = termui.ColorDefault + table2.TextAlign = termui.AlignCenter + table2.Separator = false + table2.Analysis() + table2.SetSize() + table2.BgColors[2] = termui.ColorRed + table2.Y = 10 + table2.X = 0 + table2.Border = true - termui.Render(table) + termui.Render(table2) termui.Handle("/sys/kbd/q", func(termui.Event) { termui.StopLoop() }) diff --git a/_example/table.png b/_example/table.png index a9c0f3b..5781b1d 100644 Binary files a/_example/table.png and b/_example/table.png differ