Skip to content

Instantly share code, notes, and snippets.

@FinlayDaG33k
Last active May 18, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FinlayDaG33k/baa703f8a2b949bfa53ae9e7f8b8b6a8 to your computer and use it in GitHub Desktop.
Save FinlayDaG33k/baa703f8a2b949bfa53ae9e7f8b8b6a8 to your computer and use it in GitHub Desktop.
package finlaydag33k.swing.gui;
import java.awt.EventQueue;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Stream;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import net.miginfocom.swing.MigLayout;
public class Gui extends JFrame {
private JPanel contentPane;
static JTextArea filePanel = new JTextArea();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Gui frame = new Gui();
frame.setVisible(true);
try(Stream<Path> paths = Files.walk(Paths.get("/home/finlay/Pictures"))) {
paths.forEach(filePath -> {
if (Files.isRegularFile(filePath)) {
//System.out.println(filePath);
filePanel.append("Hii");
}
});
}
System.out.println(System.currentTimeMillis() - System.currentTimeMillis());
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Gui() {
setAlwaysOnTop(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new MigLayout("", "[][grow]", "[][grow]"));
JTextArea FilePanel = new JTextArea();
contentPane.add(FilePanel, "cell 1 1,grow");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment