once again, another dumb noob question
I have a class that extends JPanel. In it, I have a JScrollPane.
Within that JScrollPane is a JList. I know its probably something
stupid, but I can't for the life of me figure out why the JList will
not display in the JScrollPane. Any help is appreciated....
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.*;
public class ORNote extends JPanel{
protected JList assistantsList;
protected DefaultListModel assistantsDLM;
protected JScrollPane assistantsScroller;
protected String sSN;
protected int dxID, prID;
protected int WIDTH = 381;
public ORNote(String stringSSN, int intDxID, int intPrID) {
sSN = stringSSN;
prID = intPrID;
dxID = intDxID;
setLayout(null);
setSize(WIDTH, 100);
Dimension prefSize = new Dimension();
prefSize.setSize(WIDTH,200);
setPreferredSize(prefSize);
Border blackline = BorderFactory.createLineBorder(Color.black);
setBorder(blackline);
addWidgets();
validate();
}
protected void addWidgets(){
assistantsDLM = new DefaultListModel();
assistantsList = new JList(assistantsDLM);
assistantsScroller = new JScrollPane(assistantsList);
assistantsDLM.addElement("TEsting");
add(assistantsScroller);
assistantsScroller.setBounds(80, 30, 290, 50);
assistantsScroller.add(assistantsList);
assistantsScroller.setViewportView(assistantsList);
assistantsScroller.revalidate();
}
}