2 * Jexer - Java Text User Interface
4 * License: LGPLv3 or later
6 * This module is licensed under the GNU Lesser General Public License
7 * Version 3. Please see the file "COPYING" in this directory for more
8 * information about the GNU Lesser General Public License Version 3.
10 * Copyright (C) 2015 Kevin Lamonte
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 3 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this program; if not, see
24 * http://www.gnu.org/licenses/, or write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
38 * This window demonstates the TTreeView widget.
40 public class DemoTreeViewWindow
extends TWindow
{
43 * Hang onto my TTreeView so I can resize it with the window.
45 private TTreeView treeView
;
50 * @param parent the main application
52 public DemoTreeViewWindow(TApplication parent
) {
53 super(parent
, "Tree View", 0, 0, 44, 16, TWindow
.RESIZABLE
);
55 // Load the treeview with "stuff"
56 treeView
= addTreeView(1, 1, 40, 12);
57 TDirectoryTreeItem root
= new TDirectoryTreeItem(treeView
, ".", true);
61 * Handle window/screen resize events.
63 * @param resize resize event
66 public void onResize(TResizeEvent resize
) {
67 if (resize
.getType() == TResizeEvent
.Type
.WIDGET
) {
68 // Resize the text field
69 treeView
.setWidth(resize
.getWidth() - 4);
70 treeView
.setHeight(resize
.getHeight() - 4);
75 // Pass to children instead
76 for (TWidget widget
: getChildren()) {
77 widget
.onResize(resize
);