Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding files to WebFileDrop not working #86

Closed
Endogen opened this issue Feb 17, 2014 · 5 comments
Closed

Adding files to WebFileDrop not working #86

Endogen opened this issue Feb 17, 2014 · 5 comments
Assignees

Comments

@Endogen
Copy link

Endogen commented Feb 17, 2014

Two possibilities:

  1. I don't understand the concept behind WebFileDrop
    or
  2. WebFileDrop doesn't allow me to add files

I tried to use setSelectedFiles() to add files to it but that didn't work - i tried that because getSelectedFiles gives me all the files currently inside, to it seems plausible. But i don't know if i got it right because i can't see a reason to name the methods get/setSELECTEDfiles...

What i tried:

public class FileDropTest extends WebFrame {
    ArrayList<File> files = new ArrayList<File>();
    WebFileDrop fileDrop = new WebFileDrop();

    public static void main(String[] args) {
        WebLookAndFeel.install();
        new FileDropTest().setVisible(true);
    }

    public FileDropTest() {
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setPreferredSize(new Dimension(400, 500));

        files.add(new File("text.txt"));

        fileDrop.setShowFileExtensions(true);
        fileDrop.setSelectedFiles(files); // Doesn't work??

        WebButton button = new WebButton("Show files");
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                fileDrop.setSelectedFiles(files); // Doesn't work??
                System.out.println(fileDrop.getSelectedFiles());
            }
        });
        add(button, BorderLayout.NORTH);
        add(fileDrop, BorderLayout.CENTER);

        pack();
        setLocationRelativeTo(null);
    }
}

Another thing:

        fileDrop.setShowFileExtensions(true);

doesn't work.

@mgarin
Copy link
Owner

mgarin commented Feb 18, 2014

Thanks for informing about these issues!
I have fixed them, changes will be available in v1.27 version.

@mgarin mgarin added this to the Small issues milestone Feb 18, 2014
@mgarin mgarin self-assigned this Feb 18, 2014
mgarin added a commit that referenced this issue Feb 21, 2014
#86 - WebFileDrop settings and selected files fix
#85 - WebRootPaneUI maximize is now disabled on title double-click when maximize button is hidden
Major improvements in StyleManager and skin installation behavior
Default style painters are now also custom and moved into separate skin package
Redundant PainterMethods interface and its implementations removed
From now on all specific style settings will be contained inside painters only
PanelPainter support added, WebPanel and WebPanelUI classes upgraded
NinePatchIcon painting within custom bounds fixed
WebScrollBarUI preferred size fix
@mgarin mgarin closed this as completed Feb 21, 2014
@Balderrama
Copy link

It doesn´t work, I have the same problem in the v1.27 version.
I need help please

@mgarin
Copy link
Owner

mgarin commented May 11, 2014

I will be fixing all issues related to WebFileDrop in v1.28 update.
I will also rename some old methods and will add usable new ones to simplify work with chosen files.

@mgarin
Copy link
Owner

mgarin commented Jun 26, 2014

I have committed a few fixes and improvements for WebFileDrop.
You will now be able to add/remove/set selected files and component will act accordingly.

Here is the full list of new methods available:

public List<File> getSelectedFiles ()
public void setSelectedFiles ( final List<File> files )

public void addSelectedFiles ( final List<File> files )
public void addSelectedFiles ( final File... files )
public void addSelectedFile ( final File file )

public void removeAllSelectedFiles ()
public void removeSelectedFiles ( final List<File> files )
public void removeSelectedFiles ( final File... files )
public void removeSelectedFile ( final File file )

This fix will be included into v1.28 update that will come out soon.

@mgarin mgarin added the fixed label Jun 26, 2014
@mgarin
Copy link
Owner

mgarin commented Jun 26, 2014

Changes and fixes are now available in v1.28 update:
https://github.com/mgarin/weblaf/releases/tag/v1.28

@mgarin mgarin closed this as completed Jun 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants