Last active
May 18, 2017 13:25
-
-
Save FinlayDaG33k/baa703f8a2b949bfa53ae9e7f8b8b6a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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