本文整理匯總了Java中com.badlogic.gdx.files.FileHandle.name方法的典型用法代碼示例。如果您正苦於以下問題:Java FileHandle.name方法的具體用法?Java FileHandle.name怎麽用?Java FileHandle.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.files.FileHandle
的用法示例。
在下文中一共展示了FileHandle.name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateFiles
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private void updateFiles(boolean push){
if(push) stack.push(directory);
navigation.setText(directory.toString());
GlyphLayout layout = Pools.obtain(GlyphLayout.class);
layout.setText(Core.font, navigation.getText());
if(layout.width < navigation.getWidth()){
navigation.setCursorPosition(0);
}else{
navigation.setCursorPosition(navigation.getText().length());
}
Pools.free(layout);
files.clearChildren();
FileHandle[] names = getFileNames();
Image upimage = new Image("icon-folder-parent");
TextButton upbutton = new TextButton(".." + directory.toString());
upbutton.clicked(()->{
directory = directory.parent();
updateFiles(true);
});
upbutton.left().add(upimage).padRight(4f).size(14*2);
upbutton.getCells().reverse();
files.top().left().add(upbutton).align(Align.topLeft).fillX().expandX().height(50).pad(2).colspan(2);
upbutton.getLabel().setAlignment(Align.left);
files.row();
ButtonGroup<TextButton> group = new ButtonGroup<TextButton>();
group.setMinCheckCount(0);
for(FileHandle file : names){
if( !file.isDirectory() && !filter.test(file)) continue; //skip non-filtered files
String filename = file.name();
TextButton button = new TextButton(shorten(filename), "toggle");
group.add(button);
button.clicked(()->{
if( !file.isDirectory()){
filefield.setText(filename);
updateFileFieldStatus();
}else{
directory = directory.child(filename);
updateFiles(true);
}
});
filefield.changed(()->{
button.setChecked(filename.equals(filefield.getText()));
});
Image image = new Image(file.isDirectory() ? "icon-folder" : "icon-file-text");
button.add(image).padRight(4f).size(14*2f);
button.getCells().reverse();
files.top().left().add(button).align(Align.topLeft).fillX().expandX()
.height(50).pad(2).padTop(0).padBottom(0).colspan(2);
button.getLabel().setAlignment(Align.left);
files.row();
}
pane.setScrollY(0f);
updateFileFieldStatus();
if(open) filefield.clearText();
}