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


Java FileChooser类代码示例

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


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

示例1: EditorManager

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
public EditorManager(){
    FileChooser.setDefaultPrefsName("white-ui-editor");
    FileChooser.setSaveLastDirectory(true);

    events = new Array<>();
    assetManager = new AssetManager();
    assetManager.load("badlogic.jpg", Texture.class);
    assetManager.load("icon/select.9.png",Texture.class);
    assetManager.load("icon/align_left.png",Texture.class);
    assetManager.load("icon/align_right.png",Texture.class);
    assetManager.load("icon/align_center.png",Texture.class);
    assetManager.load("icon/align_h_center.png",Texture.class);
    assetManager.load("icon/align_bottom.png",Texture.class);
    assetManager.load("icon/align_top.png",Texture.class);
    assetManager.load("icon/label.png",Texture.class);
    assetManager.load("icon/image.png",Texture.class);
    assetManager.load("icon/group.png",Texture.class);
    assetManager.load("icon/button.png",Texture.class);
    assetManager.load("icon/checkbox.png",Texture.class);
    assetManager.load("icon/textfield.png",Texture.class);
    assetManager.finishLoading();
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:23,代码来源:EditorManager.java

示例2: load

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
public void load(Runnable callback) {
    chooser.setMode(FileChooser.Mode.OPEN);
    chooser.setDirectory(new File(""));
    chooser.setListener(new FileChooserAdapter(){
        @Override
        public void selected(Array<FileHandle> files) {
            FileHandle first = files.first();
            if(first != null) try {
                load(first.file(), callback);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    this.chooser.centerWindow();
    this.stage.addActor(this.chooser.fadeIn());
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:18,代码来源:EditorIO.java

示例3: getFontIcon

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
private Drawable getFontIcon(FileChooser.FileItem item) {
    FileHandle fileHandle = item.getFile();
    BitmapFont bitmapFont;
    try {
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fileHandle);
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.size = CB.getScaledInt(50);
        parameter.characters = SkinFont.DEFAULT_CHARACTER;
        parameter.genMipMaps = true;
        parameter.minFilter = Texture.TextureFilter.MipMapNearestNearest;
        bitmapFont = generator.generateFont(parameter);
    } catch (Exception e) {
        return getImageIcon(item);
    }

    Drawable drawable = new BitmapFontDrawable(bitmapFont, item.getFile().nameWithoutExtension());
    return drawable;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:19,代码来源:FontFileIconProvider.java

示例4: NewFileListener

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
public NewFileListener(FileChooser fileChooser, DataManager dataManager) {
    this.fileChooser = fileChooser;
    this.dataManager = dataManager;

    if(ChiptuneTracker.getInstance().isChangeData()) {
        String text;
        if(dataManager.getCurrentFile() == null) {
            text = "New file has been modified. Save changes?";
        }
        else {
            text = dataManager.getCurrentFile()+" has been modified. Save changes?";
        }

        Dialogs.showOptionDialog(ChiptuneTracker.getInstance().getAsciiTerminal().getStage(), "Save Resource", text, Dialogs.OptionDialogType.YES_NO_CANCEL, this);

        ((View) ChiptuneTracker.getInstance().getScreen()).setListActorTouchables(Touchable.disabled);
    }
    else {
        clearAction();
        additionalYesActions();
    }
}
 
开发者ID:julianmaster,项目名称:ChiptuneTracker,代码行数:23,代码来源:NewFileListener.java

示例5: addInputFiles

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@LmlAction("addInputFiles") void addInputFiles() {
    final FileChooser fileChooser = new FileChooser(FileChooser.Mode.OPEN);
    fileChooser.setIconProvider(new AppIconProvider(fileChooser));
    fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES_AND_DIRECTORIES);
    fileChooser.setMultiSelectionEnabled(true);
    fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
            .rule("Image files", "png", "jpg", "jpeg").get()); //TODO localize
    fileChooser.setListener(new FileChooserAdapter() {
        @Override
        public void selected (Array<FileHandle> files) {
            PackModel pack = getSelectedPack();
            for (FileHandle file : files) {
                pack.addInputFile(file, InputFile.Type.Input);
            }
        }
    });
    stage.addActor(fileChooser.fadeIn());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:19,代码来源:PackInputFilesController.java

示例6: addIgnoreFiles

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@LmlAction("addIgnoreFiles") void addIgnoreFiles() {
    final FileChooser fileChooser = new FileChooser(FileChooser.Mode.OPEN);
    fileChooser.setIconProvider(new AppIconProvider(fileChooser));
    fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
    fileChooser.setMultiSelectionEnabled(true);
    fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
            .rule("Image files", "png", "jpg", "jpeg").get()); //TODO localize
    fileChooser.setListener(new FileChooserAdapter() {
        @Override
        public void selected (Array<FileHandle> files) {
            PackModel pack = getSelectedPack();
            for (FileHandle file : files) {
                pack.addInputFile(file, InputFile.Type.Ignore);
            }
        }
    });
    stage.addActor(fileChooser.fadeIn());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:19,代码来源:PackInputFilesController.java

示例7: initiateFromFilePicker

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
public void initiateFromFilePicker() {
    FileHandle rootDir = null;
    if (sourceFile != null) {
        rootDir = sourceFile.parent();
    }

    final FileChooser fileChooser = new FileChooser(rootDir, FileChooser.Mode.OPEN);
    fileChooser.setIconProvider(new AppIconProvider(fileChooser));
    fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
    fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
            .rule("PNG or 9-Patch", "png", "9.png").get());
    fileChooser.setMultiSelectionEnabled(false);
    fileChooser.setListener(new FileChooserAdapter() {
        @Override
        public void selected (Array<FileHandle> files) {
            FileHandle file = files.first();
            initiateWithSourceFile(file);
        }
    });
    Stage stage = interfaceService.getCurrentController().getStage();
    stage.addActor(fileChooser.fadeIn());

    if (sourceFile != null && FileUtils.fileExists(sourceFile)) {
        fileChooser.setSelectedFiles(sourceFile);
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:27,代码来源:NinePatchToolController.java

示例8: pickAtlasPath

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@LmlAction("pickAtlasPath") void pickAtlasPath() {
    FileHandle dir = FileUtils.obtainIfExists(edtAtlasPath.getText());

    final FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
    fileChooser.setIconProvider(new AppIconProvider(fileChooser));
    fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
    fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
            .rule("Texture atlas (*.json;*.pack;*.atlas)", "json", "pack", "atlas").get());
    fileChooser.setListener(new FileChooserAdapter() {
        @Override
        public void selected (Array<FileHandle> file) {
            FileHandle chosenFile = file.first();
            edtAtlasPath.setText(chosenFile.path());
        }
    });
    stage.addActor(fileChooser.fadeIn());

}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:19,代码来源:TextureUnpackerDialogController.java

示例9: pickOutputDir

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@LmlAction("pickOutputDir") void pickOutputDir() {
    FileHandle dir = FileUtils.obtainIfExists(edtOutputDir.getText());
    if (dir == null && FileUtils.fileExists(edtAtlasPath.getText())) {
        dir = FileUtils.obtainIfExists(edtAtlasPath.getText()).parent();
    }

    FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
    fileChooser.setIconProvider(new AppIconProvider(fileChooser));
    fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
    fileChooser.setListener(new FileChooserAdapter() {
        @Override
        public void selected (Array<FileHandle> file) {
            FileHandle chosenFile = file.first();
            edtOutputDir.setText(chosenFile.path());
        }
    });
    stage.addActor(fileChooser.fadeIn());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:19,代码来源:TextureUnpackerDialogController.java

示例10: openProject

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@LmlAction("openProject") public void openProject() {
      final ProjectModel project = getProject();
      FileHandle dir = fileChooserHistory.getLastDir(FileChooserHistory.Type.PROJECT);
      if (FileUtils.fileExists(project.getProjectFile())) {
          dir = project.getProjectFile().parent();
      }

      final FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
      fileChooser.setIconProvider(new AppIconProvider(fileChooser));
      fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setFileTypeFilter(new FileUtils.FileTypeFilterBuilder(true)
	.rule(getString("projectFileDescription", AppConstants.PROJECT_FILE_EXT), AppConstants.PROJECT_FILE_EXT).get());
      fileChooser.setListener(new FileChooserAdapter() {
          @Override
          public void selected (Array<FileHandle> file) {
              FileHandle chosenFile = file.first();
              loadProject(chosenFile);
          }
      });
      getStage().addActor(fileChooser.fadeIn());
  }
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:22,代码来源:GlobalActions.java

示例11: pickOutputDir

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@LmlAction("pickOutputDir") public void pickOutputDir() {
    final PackModel pack = getSelectedPack();
    if (pack == null) return;

    FileHandle dir = FileUtils.obtainIfExists(pack.getOutputDir());
    if (dir == null) {
        dir = fileChooserHistory.getLastDir(FileChooserHistory.Type.OUTPUT_DIR);
    }

    FileChooser fileChooser = new FileChooser(dir, FileChooser.Mode.OPEN);
    fileChooser.setIconProvider(new AppIconProvider(fileChooser));
    fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
    fileChooser.setListener(new FileChooserAdapter() {
        @Override
        public void selected (Array<FileHandle> file) {
            FileHandle chosenFile = file.first();
            fileChooserHistory.putLastDir(FileChooserHistory.Type.OUTPUT_DIR, chosenFile);
            pack.setOutputDir(chosenFile.file().getAbsolutePath());
        }
    });
    getStage().addActor(fileChooser.fadeIn());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:23,代码来源:GlobalActions.java

示例12: setupListeners

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
private void setupListeners() {

        fcBtn.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                super.clicked(event, x, y);
                FileChooser fileChooser = UI.INSTANCE.getFileChooser();
                fileChooser.setSelectionMode(mode);
                fileChooser.setListener(new SingleFileChooserListener() {
                    @Override
                    protected void selected(FileHandle file) {
                        fileHandle = file;
                        path = file.path();

                        textField.setText(file.path());
                        if (fileSelected != null) {
                            fileSelected.selected(file);
                        }
                    }
                });
                UI.INSTANCE.addActor(fileChooser.fadeIn());
            }
        });

    }
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:26,代码来源:FileChooserField.java

示例13: setupListeners

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
private void setupListeners() {
    fcBtn.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            FileChooser fileChooser = UI.INSTANCE.getFileChooser();
            fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
            fileChooser.setListener(new SingleFileChooserListener() {
                public void selected(FileHandle file) {
                    if (FileFormatUtils.isImage(file)) {
                        setImage(file);
                    } else {
                        Dialogs.showErrorDialog(UI.INSTANCE, "This is no image");
                    }
                }
            });
            UI.INSTANCE.addActor(fileChooser.fadeIn());
        }
    });
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:21,代码来源:ImageChooserField.java

示例14: process

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final FileChooser actor,
        final String rawAttributeData) {
    final ActorConsumer<?, FileChooser> action = parser.parseAction(rawAttributeData, actor);
    if (action == null) {
        parser.throwErrorIfStrict(
                "File deleter attribute expects an action that returns a FileDeleter instance. Action not found for: "
                        + rawAttributeData);
    }
    final Object result = action.consume(actor);
    if (result instanceof FileChooser.FileDeleter) {
        actor.setFileDeleter((FileChooser.FileDeleter) result);
    } else {
        parser.throwErrorIfStrict(
                "Unable to set file deleter. A method returning FileDeleter instance is required; got result: "
                        + result);
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:19,代码来源:FileDeleterLmlAttribute.java

示例15: process

import com.kotcrab.vis.ui.widget.file.FileChooser; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final FileChooser actor,
        final String rawAttributeData) {
    final ActorConsumer<?, FileChooser> action = parser.parseAction(rawAttributeData, actor);
    if (action == null) {
        parser.throwErrorIfStrict(
                "File type filter attribute expects an action that returns a FileTypeFilter instance. Action not found for: "
                        + rawAttributeData);
    }
    final Object result = action.consume(actor);
    if (result instanceof FileTypeFilter) {
        actor.setFileTypeFilter((FileTypeFilter) result);
    } else {
        parser.throwErrorIfStrict(
                "Unable to set file type filter. A method returning FileTypeFilter instance is required; got result: "
                        + result);
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:19,代码来源:FileTypeFilterLmlAttribute.java


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