• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java WidgetsConstants类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中jcurses.widgets.WidgetsConstants的典型用法代码示例。如果您正苦于以下问题:Java WidgetsConstants类的具体用法?Java WidgetsConstants怎么用?Java WidgetsConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

WidgetsConstants类属于jcurses.widgets包,在下文中一共展示了WidgetsConstants类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: CursesWindow

点赞 3

import jcurses.widgets.WidgetsConstants; //导入依赖的package包/类
/**
 * creates a new input window
 *
 * @param x x-position
 * @param y y-position
 * @param width  width of the window
 * @param height height of the window
 * @param title title of window
 */
public CursesWindow(int x, int y, int width, int height, String title) {
    super(x, y, width, height, false, title);
    this.windowWidth = width;
    chatLog = new TextArea();
    chatLog.setColors(new CharColor(CharColor.WHITE, CharColor.BLACK));
    textField = new TextField();
    button = new Button("Send");
    button.setShortCut('\n');
    button.addListener(this);

    int innerHeight = height - 5;
    GridLayoutManager manager = new GridLayoutManager(1, innerHeight);
    super.getRootPanel().setLayoutManager(manager);
    manager.addWidget(chatLog  , 0,  0, 1, innerHeight - 2, WidgetsConstants.ALIGNMENT_CENTER, WidgetsConstants.ALIGNMENT_CENTER);
    manager.addWidget(textField, 0, innerHeight - 2, 1, 1, WidgetsConstants.ALIGNMENT_CENTER, WidgetsConstants.ALIGNMENT_CENTER);
    manager.addWidget(button   , 0, innerHeight - 1, 1, 1, WidgetsConstants.ALIGNMENT_CENTER, WidgetsConstants.ALIGNMENT_CENTER);
    
}
 

开发者ID:arianne,
项目名称:stendhal,
代码行数:28,
代码来源:CursesWindow.java

示例2: Message

点赞 3

import jcurses.widgets.WidgetsConstants; //导入依赖的package包/类
/**
 * The constructor
 *
 * @param title the message's title
 * @param text the message's text
 * @param buttonLabel the label on the message's button
 *
 */
@SuppressWarnings("LeakingThisInConstructor")
public Message(String title, String text, String buttonLabel)
{
    super(getWidth(text, title) + 4, getHeight(text) + 7, true, title);

    DefaultLayoutManager manager = (DefaultLayoutManager) getRootPanel().getLayoutManager();

    _label = new Label(text);
    _button = new Button(buttonLabel);
    _title = title;

    _button.addListener(this);

    manager.addWidget(_label, 0, 0, getWidth(text, _title) + 2, getHeight(text) + 2, WidgetsConstants.ALIGNMENT_CENTER,
            WidgetsConstants.ALIGNMENT_CENTER);

    manager.addWidget(_button, 0, getHeight(text) + 2, getWidth(text, _title) + 2, 5, WidgetsConstants.ALIGNMENT_CENTER,
            WidgetsConstants.ALIGNMENT_CENTER);

}
 

开发者ID:gmt2001,
项目名称:PhantomBot,
代码行数:29,
代码来源:Message.java

示例3: Message

点赞 3

import jcurses.widgets.WidgetsConstants; //导入依赖的package包/类
/**
 *  The constructor
 * 
 * @param title the message's title
 * @param text the message's text
 * @param buttonLabel the label on the message's button
 * 
 */
public Message(String title, String text, String buttonLabel) {
	super(getWidth(text, title)+4, getHeight(text)+7,true,title);

	DefaultLayoutManager manager = (DefaultLayoutManager)getRootPanel().getLayoutManager();

	_label = new Label(text);
	_button = new Button(buttonLabel);
	_title = title;

	_button.addListener(this);

	manager.addWidget(_label,0,0,getWidth(text, _title)+2, getHeight(text)+2, WidgetsConstants.ALIGNMENT_CENTER, 
			WidgetsConstants.ALIGNMENT_CENTER);

	manager.addWidget(_button,0,getHeight(text)+2,getWidth(text, _title)+2, 5, WidgetsConstants.ALIGNMENT_CENTER, 
			WidgetsConstants.ALIGNMENT_CENTER);
}
 

开发者ID:sunhong,
项目名称:jcurses,
代码行数:26,
代码来源:Message.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)