Home Wiki Blog Forum GEXF.net

Gephi forums

Community support

ToolKit JFileChooser GUI Import File

Once it's running

ToolKit JFileChooser GUI Import File

Postby Lee_Johnston) » 21 Aug 2013 16:58

Hey guys, hows it going?

Back again to ask, no doubt a simple question but i've been looking at this code for so long thought id see if a fresh pair of eyes would do the trick.

I'm using the tool kit to import graphs into my own design and up until now i've been using the bellow method and taking the file in as so -

Code: Select all
try {
                File file = new File(getClass().getResource("/resources/LesMiserables.gexf").toURI());

                //File file = fileChooser.getSelectedFile();
                container = importController.importFile(file);
            } catch (Exception ex) {
                ex.printStackTrace();
                return;
            }


However, what i have been trying to do is take in a file via the JFileChooser and i don't know where im going wrong, if anyone would be able to give a hand?

Code: Select all
 int returnVal = fileChooser.showOpenDialog(this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {

                try{
                    File file = fileChooser.getSelectedFile();
                    container = importController.importFile(file);
                } catch (Exception ex) {
                    return;
                }
            }
Lee_Johnston)
 
Posts: 4
Joined: 04 Jun 2013 19:42

Re: ToolKit JFileChooser GUI Import File

Postby Lee_Johnston) » 26 Aug 2013 15:35

BUMP

Anyone know how to achieve this??
Lee_Johnston)
 
Posts: 4
Joined: 04 Jun 2013 19:42


Return to How-To and Troubleshooting

Who is online

Users browsing this forum: No registered users and 2 guests