mirror of
https://github.com/rivo/tview.git
synced 2024-11-17 03:26:09 +00:00
23 lines
779 B
Go
23 lines
779 B
Go
// Demo code for the Frame primitive.
|
|
package main
|
|
|
|
import (
|
|
"github.com/gdamore/tcell"
|
|
"github.com/rivo/tview"
|
|
)
|
|
|
|
func main() {
|
|
app := tview.NewApplication()
|
|
frame := tview.NewFrame(tview.NewBox().SetBackgroundColor(tcell.ColorBlue)).
|
|
SetBorders(2, 2, 2, 2, 4, 4).
|
|
AddText("Header left", true, tview.AlignLeft, tcell.ColorWhite).
|
|
AddText("Header middle", true, tview.AlignCenter, tcell.ColorWhite).
|
|
AddText("Header right", true, tview.AlignRight, tcell.ColorWhite).
|
|
AddText("Header second middle", true, tview.AlignCenter, tcell.ColorRed).
|
|
AddText("Footer middle", false, tview.AlignCenter, tcell.ColorGreen).
|
|
AddText("Footer second middle", false, tview.AlignCenter, tcell.ColorGreen)
|
|
if err := app.SetRoot(frame, true).Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|