本文整理汇总了Java中com.googlecode.lanterna.gui2.Panel.addComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Panel.addComponent方法的具体用法?Java Panel.addComponent怎么用?Java Panel.addComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.lanterna.gui2.Panel
的用法示例。
在下文中一共展示了Panel.addComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LanternaMenuPanel
import com.googlecode.lanterna.gui2.Panel; //导入方法依赖的package包/类
public LanternaMenuPanel() {
super(new BorderLayout());
Panel panel = new Panel();
panel.setLayoutManager(new BorderLayout());
panel.setPreferredSize(new TerminalSize(Integer.MAX_VALUE, 1));
bar = new MenuBar();
updateMenu(null);
panel.addComponent(bar, Location.LEFT);
if (Application.getInstance().hasSearchPages()) {
panel.addComponent(createSearchField(), Location.RIGHT);
}
addComponent(panel, Location.TOP);
}
示例2: LanternaCaption
import com.googlecode.lanterna.gui2.Panel; //导入方法依赖的package包/类
public LanternaCaption(Component component, String caption) {
super(new LinearLayout());
Panel panel = new Panel();
panel.addComponent(new Label(caption));
validationLabel = new Label("");
validationLabel.setForegroundColor(TextColor.ANSI.RED);
panel.addComponent(validationLabel);
addComponent(panel);
// if (component instanceof CheckBox) {
addComponent(component);
// } else {
// addComponent(component, VerticalLayout.MAXIMIZES_HORIZONTALLY);
// }
}
示例3: createSearchField
import com.googlecode.lanterna.gui2.Panel; //导入方法依赖的package包/类
protected Panel createSearchField() {
Panel panel = new Panel(new LinearLayout(Direction.HORIZONTAL));
textFieldSearch = new TextBox();
panel.addComponent(textFieldSearch);
final Button button = new Button("Search");
button.addListener(b -> LanternaFrontend.run(b, new SearchAction()));
panel.addComponent(button);
return panel;
}
示例4: LanternaEditorLayout
import com.googlecode.lanterna.gui2.Panel; //导入方法依赖的package包/类
public LanternaEditorLayout(IContent content, Action[] actions) {
setLayoutManager(new BorderLayout());
addComponent((Component) content, Location.CENTER);
Panel panelActions = new Panel(new LinearLayout(Direction.HORIZONTAL));
for (final Action action : actions) {
Button button = new Button(action.getName());
button.addListener(b -> LanternaFrontend.run(b, () -> action.action()));
panelActions.addComponent(button);
}
addComponent(panelActions, Location.BOTTOM);
}
示例5: MenuListDialog
import com.googlecode.lanterna.gui2.Panel; //导入方法依赖的package包/类
MenuListDialog(List<Runnable> items) {
super("");
if (items.isEmpty()) {
throw new IllegalStateException("MenuListDialog needs at least one item");
}
MenuItemListBox listBox = new MenuItemListBox(closeRunnable);
for (final Runnable item : items) {
listBox.addItem(item);
}
Panel mainPanel = new Panel();
mainPanel.setLayoutManager(new GridLayout(1).setLeftMarginSize(1).setRightMarginSize(1));
listBox.setLayoutData(
GridLayout.createLayoutData(GridLayout.Alignment.FILL, GridLayout.Alignment.CENTER, true, false))
.addTo(mainPanel);
Panel buttonPanel = new Panel();
buttonPanel.setLayoutManager(new GridLayout(2).setHorizontalSpacing(1));
buttonPanel.addComponent(new Button(LocalizedString.Close.toString(), closeRunnable).setLayoutData(
GridLayout.createLayoutData(GridLayout.Alignment.CENTER, GridLayout.Alignment.CENTER, true, false)));
buttonPanel.setLayoutData(
GridLayout.createLayoutData(GridLayout.Alignment.END, GridLayout.Alignment.CENTER, false, false))
.addTo(mainPanel);
setComponent(mainPanel);
}
示例6: main
import com.googlecode.lanterna.gui2.Panel; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Terminal terminal = new DefaultTerminalFactory().createTerminal();
Screen screen = new TerminalScreen(terminal);
screen.startScreen();
Panel panel = new Panel(new BorderLayout());
Table<String> table = new Table<>("- Quotation -");
table.getTableModel().addRow("135.09");
table.getTableModel().addRow("134.56");
table.getTableModel().addRow("134.27");
table.getTableModel().addRow("133.90");
table.getTableModel().addRow("132.81");
table.setLayoutData(BorderLayout.Location.RIGHT);
panel.addComponent(table);
TextBox textBox = new TextBox("EMPTY", TextBox.Style.MULTI_LINE);
textBox.setLayoutData(BorderLayout.Location.CENTER);
panel.addComponent(textBox);
// Create window to hold the panel
BasicWindow window = new BasicWindow();
window.setComponent(panel);
window.setHints(Arrays.asList(Window.Hint.FULL_SCREEN));
// Create gui and start gui
MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(),
new EmptySpace(TextColor.ANSI.BLUE));
gui.addWindowAndWait(window);
}