From 4b069392578049bfa1d699d929e1997a47e352d9 Mon Sep 17 00:00:00 2001 From: js Date: Sat, 11 Apr 2020 10:06:16 +0200 Subject: [PATCH] now list all the files, download button just display on console the file ou want to download --- src/gui/ArgumentsGen.java | 5 +++++ src/gui/ClientInterfaceGUI.java | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/ArgumentsGen.java b/src/gui/ArgumentsGen.java index 13ae039..ec06267 100644 --- a/src/gui/ArgumentsGen.java +++ b/src/gui/ArgumentsGen.java @@ -7,6 +7,9 @@ package gui; * and open the template in the editor. */ + import javax.swing.JFrame; + import javax.swing.SwingUtilities; + /** * @author Louis Royer * @author Flavien Haas @@ -174,6 +177,8 @@ public class ArgumentsGen extends javax.swing.JPanel { int portTracker = Integer.parseInt(portTrackerStr); ClientP2Pgui c = new ClientP2Pgui(hostnameServer, portServer, hostnameTracker, portTracker, protocolClient); c.connect(); + JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this); + topFrame.dispose(); } } diff --git a/src/gui/ClientInterfaceGUI.java b/src/gui/ClientInterfaceGUI.java index 1523e38..0d713da 100644 --- a/src/gui/ClientInterfaceGUI.java +++ b/src/gui/ClientInterfaceGUI.java @@ -60,9 +60,17 @@ public class ClientInterfaceGUI extends ClientInterface { int optionSearch = 0; String searchInput = ""; String[] list = clientManagement.listDirectory(); + System.out.println("running ClientInterfaceGUI and creating window"); + for(String listItem: list){ + System.out.println(listItem); + } 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.setVisible(true); } catch (EmptyDirectory e) { writeLog("Server has no file in directory", LogLevel.Error); }