now list all the files, download button just display on console the file ou want to download

This commit is contained in:
js 2020-04-11 10:06:16 +02:00
parent e1fdddac54
commit 4b06939257
2 changed files with 14 additions and 1 deletions

View File

@ -7,6 +7,9 @@ package gui;
* and open the template in the editor. * and open the template in the editor.
*/ */
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
/** /**
* @author Louis Royer * @author Louis Royer
* @author Flavien Haas * @author Flavien Haas
@ -174,6 +177,8 @@ public class ArgumentsGen extends javax.swing.JPanel {
int portTracker = Integer.parseInt(portTrackerStr); int portTracker = Integer.parseInt(portTrackerStr);
ClientP2Pgui c = new ClientP2Pgui(hostnameServer, portServer, hostnameTracker, portTracker, protocolClient); ClientP2Pgui c = new ClientP2Pgui(hostnameServer, portServer, hostnameTracker, portTracker, protocolClient);
c.connect(); c.connect();
JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this);
topFrame.dispose();
} }
} }

View File

@ -60,9 +60,17 @@ public class ClientInterfaceGUI extends ClientInterface {
int optionSearch = 0; int optionSearch = 0;
String searchInput = ""; String searchInput = "";
String[] list = clientManagement.listDirectory(); String[] list = clientManagement.listDirectory();
System.out.println("running ClientInterfaceGUI and creating window");
for(String listItem: list){
System.out.println(listItem);
}
JFrame win = new JFrame(); JFrame win = new JFrame();
win.setVisible(true); win.setTitle("Client");
win.setSize(550, 250);
win.setLocationRelativeTo(null);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.add(new DownloadSelectionGen(list, clientManagement, loggerC)); win.add(new DownloadSelectionGen(list, clientManagement, loggerC));
win.setVisible(true);
} catch (EmptyDirectory e) { } catch (EmptyDirectory e) {
writeLog("Server has no file in directory", LogLevel.Error); writeLog("Server has no file in directory", LogLevel.Error);
} }