本文整理匯總了Java中com.googlecode.lanterna.gui2.Panel類的典型用法代碼示例。如果您正苦於以下問題:Java Panel類的具體用法?Java Panel怎麽用?Java Panel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Panel類屬於com.googlecode.lanterna.gui2包,在下文中一共展示了Panel類的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);
}