Examples of CenteredFileDialog


Examples of se.llbit.chunky.ui.CenteredFileDialog

    mergeDumpBtn.setToolTipText(
        "Merge an existing render dump with the current render");
    mergeDumpBtn.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        CenteredFileDialog fileDialog =
            new CenteredFileDialog(null,
                "Select Render Dump", FileDialog.LOAD);
        fileDialog.setFilenameFilter(
            new FilenameFilter() {
              @Override
              public boolean accept(File dir, String name) {
                return name.toLowerCase().endsWith(".dump");
              }
            });
        fileDialog.setDirectory(PersistentSettings.
            getSceneDirectory().getAbsolutePath());
        fileDialog.setVisible(true);
        File selectedFile = fileDialog.getSelectedFile();
        if (selectedFile != null) {
          sceneMan.mergeRenderDump(selectedFile);
        }
      }
    });
View Full Code Here

Examples of se.llbit.chunky.ui.CenteredFileDialog

    public SkymapTextureLoader(RenderManager renderMan) {
      this.renderMan = renderMan;
    }
    @Override
    public void actionPerformed(ActionEvent e) {
      CenteredFileDialog fileDialog =
          new CenteredFileDialog(null, "Open Skymap", FileDialog.LOAD);
      String directory;
      synchronized (SkyboxTextureLoader.class) {
        directory = defaultDirectory;
      }
      fileDialog.setDirectory(directory);
      fileDialog.setFilenameFilter(
          new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
              return name.toLowerCase().endsWith(".png")
                  || name.toLowerCase().endsWith(".jpg")
                  || name.toLowerCase().endsWith(".hdr")
                  || name.toLowerCase().endsWith(".pfm");
            }
          });
      fileDialog.setVisible(true);
      File selectedFile = fileDialog.getSelectedFile();
      if (selectedFile != null) {
        synchronized (SkyboxTextureLoader.class) {
          File parent = selectedFile.getParentFile();
          if (parent != null) {
            defaultDirectory = parent.getAbsolutePath();
View Full Code Here

Examples of se.llbit.chunky.ui.CenteredFileDialog

      this.renderMan = renderMan;
      this.textureIndex = textureIndex;
    }
    @Override
    public void actionPerformed(ActionEvent e) {
      CenteredFileDialog fileDialog =
          new CenteredFileDialog(null, "Open Skybox Texture", FileDialog.LOAD);
      String directory;
      synchronized (SkyboxTextureLoader.class) {
        directory = defaultDirectory;
      }
      fileDialog.setDirectory(directory);
      fileDialog.setFilenameFilter(
          new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
              return name.toLowerCase().endsWith(".png")
                  || name.toLowerCase().endsWith(".jpg")
                  || name.toLowerCase().endsWith(".hdr")
                  || name.toLowerCase().endsWith(".pfm");
            }
          });
      fileDialog.setVisible(true);
      File selectedFile = fileDialog.getSelectedFile();
      if (selectedFile != null) {
        synchronized (SkyboxTextureLoader.class) {
          File parent = selectedFile.getParentFile();
          if (parent != null) {
            defaultDirectory = parent.getAbsolutePath();
View Full Code Here

Examples of se.llbit.chunky.ui.CenteredFileDialog

   * @param selected index of scene to be deleted
   */
  protected void exportScene(int selected) {
    if (selected >= 0 && selected < scenes.size()) {
      SceneDescription scene = scenes.get(selected);
      CenteredFileDialog fileDialog =
          new CenteredFileDialog(null, "Export to ZIP", FileDialog.SAVE);
      fileDialog.setDirectory(System.getProperty("user.dir"));
      fileDialog.setFile(scene.name+".zip");
      fileDialog.setFilenameFilter(
        new FilenameFilter() {
          @Override
          public boolean accept(File dir, String name) {
            return name.toLowerCase().endsWith(".zip");
          }
        }
      );
      fileDialog.setVisible(true);
      File selectedFile = fileDialog.getSelectedFile(".zip");
      if (selectedFile != null) {
        scene.exportToZip(selectedFile);
      }
    }
  }
View Full Code Here

Examples of se.llbit.chunky.ui.CenteredFileDialog

   * Save the current frame as a PNG image.
   * @param progressListener
   */
  public synchronized void saveSnapshot(ProgressListener progressListener) {

    CenteredFileDialog fileDialog = new CenteredFileDialog(null,
        "Save Current Frame", FileDialog.SAVE);
    String directory;
    synchronized (RenderManager.class) {
      directory = defaultDirectory;
    }
    fileDialog.setDirectory(directory);
    fileDialog.setFile(bufferedScene.name()+"-"+bufferedScene.spp+".png");
    fileDialog.setFilenameFilter(
      new FilenameFilter() {
        @Override
        public boolean accept(File dir, String name) {
          return name.toLowerCase().endsWith(".png");
        }
      }
    );
    fileDialog.setVisible(true);
    File selectedFile = fileDialog.getSelectedFile(".png");
    if (selectedFile != null) {
      synchronized (RenderManager.class) {
        File parent = selectedFile.getParentFile();
        if (parent != null) {
          defaultDirectory = parent.getAbsolutePath();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.