本文整理汇总了Java中com.watabou.noosa.ui.Component类的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Component类属于com.watabou.noosa.ui包,在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WndHardNotification
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndHardNotification(Component titlebar, String message, String btnMessage, int time) {
super(titlebar, message);
timeLeft = time;
this.btnMessage = btnMessage;
btnOkay = new RedButton(btnMessage + " (" + time +")"){
@Override
protected void onClick() {
hide();
}
};
btnOkay.setRect(0, height + GAP, width, 16);
btnOkay.enable(false);
add(btnOkay);
resize(width, (int) btnOkay.bottom());
}
示例2: WndChanges
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndChanges() {
super();
resize( WIDTH, HEIGHT );
txtTitle = PixelScene.createText(TXT_TITLE, 9);
txtTitle.hardlight( Window.SHPX_COLOR );
txtTitle.measure();
txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
add( txtTitle );
BitmapTextMultiline txtChanges = PixelScene.createMultiline(TXT_CHANGES, 9);
Component content = new Component();
content.add(txtChanges);
text = new ScrollPane( content ) {
};
add( text );
text.setRect( 0, txtTitle.height(), WIDTH, HEIGHT - txtTitle.height() );
}
示例3: WndJournal
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndJournal() {
super();
resize(WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P);
txtTitle = PixelScene.renderText(TXT_TITLE, 9);
txtTitle.hardlight(Window.TITLE_COLOR);
txtTitle.x = PixelScene.align(PixelScene.uiCamera,
(WIDTH - txtTitle.width()) / 2);
add(txtTitle);
Component content = new Component();
Collections.sort(Journal.records);
float pos = 0;
for (Journal.Record rec : Journal.records) {
ListItem item = new ListItem(rec.feature, rec.depth);
item.setRect(0, pos, WIDTH, ITEM_HEIGHT);
content.add(item);
pos += item.height();
}
content.setSize(WIDTH, pos);
list = new ScrollPane(content);
add(list);
list.setRect(0, txtTitle.height(), WIDTH, height - txtTitle.height());
}
示例4: ScrollPane
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public ScrollPane(Component content) {
super();
this.content = content;
addToBack(content);
width = content.width();
height = content.height();
content.camera = new Camera(0, 0, 1, 1, PixelScene.defaultZoom);
Camera.add(content.camera);
}
示例5: ScrollPane
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public ScrollPane( Component content ) {
super();
this.content = content;
addToBack( content );
width = content.width();
height = content.height();
content.camera = new Camera( 0, 0, 1, 1, PixelScene.defaultZoom );
Camera.add( content.camera );
}
示例6: BadgesList
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public BadgesList( boolean global ) {
super( new Component() );
for (Badges.Badge badge : Badges.filtered( global )) {
if (badge.image == -1) {
continue;
}
ListItem item = new ListItem( badge );
content.add( item );
items.add( item );
}
}
示例7: WndJournal
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndJournal() {
super();
resize( WIDTH, PixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P );
txtTitle = PixelScene.createText( TXT_TITLE, 9 );
txtTitle.hardlight( Window.TITLE_COLOR );
txtTitle.measure();
txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
add( txtTitle );
Component content = new Component();
Collections.sort( Journal.records );
float pos = 0;
for (Journal.Record rec : Journal.records) {
ListItem item = new ListItem( rec.feature, rec.depth );
item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
content.add( item );
pos += item.height();
}
content.setSize( WIDTH, pos );
list = new ScrollPane( content );
add( list );
list.setRect( 0, txtTitle.height(), WIDTH, height - txtTitle.height() );
}
示例8: WndTitledMessage
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndTitledMessage( Component titlebar, String message ) {
super();
int width = YetAnotherPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
titlebar.setRect( 0, 0, width, 0 );
add( titlebar );
Highlighter hl = new Highlighter( message );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = width;
normal.measure();
normal.x = titlebar.left();
normal.y = titlebar.bottom() + GAP;
add( normal );
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
highlighted = PixelScene.createMultiline( hl.text, 6 );
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
}
resize( width, (int)(normal.y + normal.height()) );
}
示例9: ScrollPane
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public ScrollPane( Component content ) {
super();
this.content = content;
addToBack( content );
width = content.width();
height = content.height();
content.camera = new Camera( 0, 0, 1, 1, PixelScene.defaultZoom );
Camera.add( content.camera );
}
示例10: WndTitledMessage
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndTitledMessage( Component titlebar, String message ) {
super();
int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
titlebar.setRect( 0, 0, width, 0 );
add( titlebar );
Highlighter hl = new Highlighter( message );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = width;
normal.measure();
normal.x = titlebar.left();
normal.y = titlebar.bottom() + GAP;
add( normal );
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
highlighted = PixelScene.createMultiline( hl.text, 6 );
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
}
resize( width, (int)(normal.y + normal.height()) );
}
示例11: WndJournal
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndJournal() {
super();
resize( WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P );
txtTitle = PixelScene.createText( TXT_TITLE, 9 );
txtTitle.hardlight( Window.TITLE_COLOR );
txtTitle.measure();
txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
add( txtTitle );
Component content = new Component();
Collections.sort( Journal.records );
float pos = 0;
for (Journal.Record rec : Journal.records) {
ListItem item = new ListItem( rec.feature, rec.depth );
item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
content.add( item );
pos += item.height();
}
content.setSize( WIDTH, pos );
list = new ScrollPane( content );
add( list );
list.setRect( 0, txtTitle.height(), WIDTH, height - txtTitle.height() );
}
示例12: WndTitledMessage
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndTitledMessage( Component titlebar, String message ) {
super();
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
Highlighter hl = new Highlighter( message );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = WIDTH;
normal.measure();
normal.x = titlebar.left();
normal.y = titlebar.bottom() + GAP;
add( normal );
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
highlighted = PixelScene.createMultiline( hl.text, 6 );
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
}
resize( WIDTH, (int)(normal.y + normal.height()) );
}
示例13: WndJournal
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndJournal() {
super();
resize( WIDTH, HEIGHT );
txtTitle = PixelScene.createText( TXT_TITLE, 9 );
txtTitle.hardlight( Window.TITLE_COLOR );
txtTitle.measure();
txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 );
add( txtTitle );
Component content = new Component();
Collections.sort( Journal.records );
float pos = 0;
for (Journal.Record rec : Journal.records) {
ListItem item = new ListItem( rec.feature, rec.depth );
item.setRect( 0, pos, WIDTH, ITEM_HEIGHT );
content.add( item );
pos += item.height();
}
content.setSize( WIDTH, pos );
list = new ScrollPane( content );
add( list );
list.setRect( 0, txtTitle.height(), WIDTH, HEIGHT - txtTitle.height() );
}
示例14: WndTitledMessage
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndTitledMessage( Component titlebar, String message ) {
super();
int width = PixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
titlebar.setRect( 0, 0, width, 0 );
add( titlebar );
Highlighter hl = new Highlighter( message );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = width;
normal.measure();
normal.x = titlebar.left();
normal.y = titlebar.bottom() + GAP;
add( normal );
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
highlighted = PixelScene.createMultiline( hl.text, 6 );
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
}
resize( width, (int)(normal.y + normal.height()) );
}
示例15: WndKeymap
import com.watabou.noosa.ui.Component; //导入依赖的package包/类
public WndKeymap() {
int ww = Math.min( 160, PixelScene.uiCamera.width - 16 );
int wh = PixelScene.uiCamera.height - 24;
resize( ww, wh );
RedButton btnReset = new RedButton( "Reset To Defaults" ) {
@Override
protected void onClick() {
resetToDefaults();
populateList();
}
};
btnReset.setRect( 0, height - BTN_HEIGHT, width, BTN_HEIGHT );
add( btnReset );
listContent = new Component();
final ScrollPane list = new ScrollPane(listContent) {
@Override
public void onClick( float x, float y ) {
for (ListItem item : items.values()) {
if (item.onClick( x, y )) {
break;
}
}
}
};
populateList();
add(list);
list.setRect(0, 0, width, btnReset.top() );
}