simrat khanuja wrote:well everything seems to be working fine
simrat khanuja wrote:the scroll pane is not working
These two statements contradict each other.
Generally, when you ask for help, your job is to make it as easy as possible for other to help you. That means posting properly formatted code. Many people will look at this, see the java that is hard to read, and figure "I can better spend my time somewhere else".
Next, you should tell us what the problem is EXACTLY. "not working" could mean
not show up
show a vertical but not horizontal
show up but not actually scroll anything
crash the program when used
probably about 100 other things
People who hang out here tend to be programmers. Programmers like specs. "Specs" is derived from "specifications". So please tell us all the details on what EXACTLY you mean by "not working".
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
It looks to me that you are doing two things wrong in your development process.
One is trying to do too much in one class. You should use Swing classes for display. Not to implement Listeners, nor to implement database queries. Put them into different classes. Your class is turning into a stovepipe, which is a well‑known antipattern. Separate all the database access into classes for itself. Get that working at the command line before you consider putting a GUI on it.
The other thing I think you are doing wrong is doing too much all at once. You have written 90 lines of code with poorly‑named variables in and you are wondering why the scroll pane isn't working right. You should compile the code after every ten lines or less.
Please go back and format the code properly so everything is correctly indented. That catch for example in not correctly formatted. Give all the variables names which tell us what they mean. Don't have all the Components as fields. They can probably all be converted to local variables in the constructor or a setUpGUI method. Don't invoke static members on an instance name. Use a class name;thiscounts as an instance name.
I think this discussion would fit better in our GUIs forum. Moving.