I am trying to create a BLANK JList for the user to see befor elements are added. Over all what is happening is I am using JFileChooser to select txt documents to be added to a list, then the vowels in each txt document are counted and displayed in the other list. The list must be visible before the user selects anything and the list must be blank. Yes there are two empty JList but obviously if I can get help with one the other is easy. So far nowhere on the internet touches on this particular subject.
Setting row count(visible) does not work, nor setsize(). Unless I am using it wrong. Please explain with examples. Thanks in advance!
Code:
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import javax.swing.*;
public class VowelCounterApp extends JFrame implements ActionListener
{
/**
*
*/
private static final long serialVersionUID = 1L;
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JScrollPane scrollPane = new JScrollPane();
JList selectList = new JList();
JList showList = new JList();
JFileChooser fileChooser = new JFileChooser();
JButton addFiles = new JButton("Add Files");
JButton process = new JButton("Process");
JButton clear = new JButton("Clear");
JButton help = new JButton("Help");
public VowelCounterApp()
{
JFrame appWindow = new JFrame("Vowel Counter");
appWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
appWindow.setSize(1500, 600);
appWindow.setLayout(new BorderLayout());
appWindow.setVisible(true);
appWindow.add(panel1, BorderLayout.WEST);
appWindow.add(panel2, BorderLayout.EAST);
panel1.add(selectList);
selectList.add(scrollPane);
panel2.add(showList);
showList.add(scrollPane);
}
public void actionPerformed(ActionEvent e)
{
}
public static void main(String[] args)
{
new VowelCounterApp();
}
}