I have JFrame which is my central window, on it, I added simple JTabbedPane, it will have 4 tabs once I complete it. For now I'm having issues with second tab.
The goal of second tab is when I hit JButton "Requested" or "Scheduled" (action listener fires up), I should see a JScrollPane containing a JList object which contains certain number of (medical) Exam objects where each Exam has its string representation and that string is placed inside JLabel. Now, the functionality which I require is to select any Exam and after selecting it to hit Cancel button which will cancel selected Exam (programming logic for actual process of canceling exam is completed, I just need GUI) .
I'm having big problems displaying that JScrollPane in JPanel and being able to select Exam.
It looks like you're not adding the JScrollPane to the JPanel until the user presses one of the buttons. I don't recommend doing that because it can lead to things which are maybe the same as your big problems.
If you thought to do that because you don't have the data available until the user presses that button, then I recommend adding the JScrollPane to the JPanel in the initGUI() method, only with no data in the JList. Then when the user clicks the button and you get the data, add the data to the model of the JList.
posted 4 days ago
Sorry for replying so late, lectures and all that...Yes, I did what you've proposed and I read little bit of documentation on JList's. Specifically, I used JListModel and it worked.
Create Edit Print & Convert PDF Using Free API with Java