当前位置: 首页>>代码示例>>Java>>正文


Java Panel类代码示例

本文整理汇总了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);
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:19,代码来源:LanternaMenuPanel.java

示例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);
	// }
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:17,代码来源:LanternaCaption.java

示例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;
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:13,代码来源:LanternaMenuPanel.java

示例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);
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:14,代码来源:LanternaEditorLayout.java

示例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);
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:28,代码来源:MenuListDialog.java

示例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);
}
 
开发者ID:michaelliao,项目名称:crypto-exchange,代码行数:31,代码来源:AgentClient.java


注:本文中的com.googlecode.lanterna.gui2.Panel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。