Hi everyone! I am writing what is write now a graphical linux ls program that I am going to use for another program. The code I have put together should work, but for some reason doesn't. Thanks in advance for your help.
Code:import java.awt.*;
import javax.swing.*;
import java.io.*;
public class DTSTestAnalyzer
{
public DTSTestAnalyzer()
{
createWindow();
}
public static void main(String[] args)
{
DTSTestAnalyzer dtsTestAnalyzer = new DTSTestAnalyzer();
}
public void createWindow()
{
JFrame frame = new JFrame("A+ Test Analyzer");
int counter;
counter = 0;
while(counter <= 1)
{
JLabel textLabel = new JLabel("PLEASE PICK A COMPANY",SwingConstants.CENTER);
File dir = new File("~/Desktop/DTSTestAnalyzer/A+TestAnalyzer");
String line = "";
File[] subDirs = dir.listFiles(new FileFilter()
{
public boolean accept(File pathname)
{
return pathname.isDirectory();
}
});
for (File subDir : subDirs)
{
line = line + subDir.getPath();
}
TextArea textArea = new TextArea(line,10,20);
frame.getContentPane().add(textLabel, BorderLayout.CENTER);
frame.add(textArea);
}
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setSize(300, 300);
frame.setVisible(true);
}
}
