Package net.sf.jhylafax

Source Code of net.sf.jhylafax.ExecutableChooserPanel

package net.sf.jhylafax;

import java.io.File;
import org.xnap.commons.gui.FileChooserPanel;
import org.xnap.commons.util.QuotedStringTokenizer;

public class ExecutableChooserPanel extends FileChooserPanel {
 
 
  public ExecutableChooserPanel(File file, int columns) {
    super(file, columns);
  }

  public ExecutableChooserPanel(int columns) {
    super(columns);
  }

  @Override
  public File getFile() {
    QuotedStringTokenizer t = new QuotedStringTokenizer(getTextField().getText());
    return (t.hasMoreTokens()) ? new File(t.nextToken()) : new File("");
  }
 
  @Override
  public void setFile(File file) {
    if (file == null) {
      getTextField().setText("");
    }
    else if (file.getAbsolutePath().contains(" ")) {
      getTextField().setText("\"" + file.getAbsolutePath() + "\"");
    }
    else {
      getTextField().setText(file.getAbsolutePath());
    }
  }
 
}
TOP

Related Classes of net.sf.jhylafax.ExecutableChooserPanel

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.