All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jhotdraw.gui.JFileURIChooser Maven / Gradle / Ivy

The newest version!
/*
 * @(#)JFileURIChooser.java
 * 
 * Copyright (c) 2009-2010 by the original authors of JHotDraw and all its
 * contributors. All rights reserved.
 * 
 * You may not use, copy or modify this file, except in compliance with the 
 * license agreement you entered into with the copyright holders. For details
 * see accompanying license terms.
 */
package org.jhotdraw.gui;

import java.io.File;
import java.net.URI;
import javax.swing.JComponent;
import javax.swing.JFileChooser;

/**
 * JFileURIChooser.
 *
 * @author Werner Randelshofer
 * @version $Id: JFileURIChooser.java 717 2010-11-21 12:30:57Z rawcoder $
 */
public class JFileURIChooser extends JFileChooser implements URIChooser {

    @Override
    public void setSelectedURI(URI uri) {
        setSelectedFile(new File(uri));
    }

    @Override
    public URI getSelectedURI() {
        return getSelectedFile() == null ? null : getSelectedFile().toURI();
    }

    @Override
    public JComponent getComponent() {
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy