Hey there,
I have already built my system to log in but I am having difficulties in proceeding with the new panel I want to show after log in is successful.

This is how I'm doing it:

I have built different panels for each use case of my app. So I have a panel that says LoginPanel.

I take username and password in correctly, and everything... Now, I want that when username and password are correct the LoginPanel should be removed, and the my JTabbedPane to be added onto the frame.

I tried:

frame.getContentPane().removeAll();
//frame.getContentPane().add(new MyJTabbedPane());
frame.getContentPane().add(new OneOfMyOtherPanels());
frame.validate();

But this is not working fine. Only part of my OneOfMyOtherPanels is being shown, not its entirety.

Anyone please guide me on how I should be doing this.

UPDATE: Sorry, I test every panel I build independently by building a main method inside each and putting them on separate frames. This panel I was testing has inside its main method code that adds an additional panel to it as well. Naturally, this other panel was not showing inside my LoginPanel's frame.

Anyways, I'd appreciate any input on whether I am doing this correctly or not. Thank you.

Please make a small simple complete program (SSCCE) that shows your problem and post it here.

NormR1,
this was my problem:

I have a panel CreateQuestion, another CreateCoourse. Now, inside each panel I have a main method where I build a frame and put the panel on it. However, on the main method inside CreateCourse I also added CreateQuestion onto the frame.

Now, when I added CreateCourse on a frame from a third class, I could not see CreateQuestion content... so, what happened is that I confused myself. Soon after I posted I saw what I was doing wrong. anyways, thank you for your help.

Since we're at it though, I have a question:

I want to make a method that makes sure my database and expected tables inside it exist before my application can be used. However, what I am having difficulties with is determining where to invoke that method.

I have this class, ConnectionHelper that does nothing but constructs a connection to my database and returns it through its ConnectionDB method. perhaps this is where I could invoke the method with a "CREATE IF NOT EXISTS..." for each table that I want in my database and an "INSERT INTO users (username, password) VALUES ('admin', 'admin')"?! any idea? Does this sound good to you?

IF you are having problems with your code, you need to post a SSCCE that shows the problem.

I have no experience with databases.

Alright NormR1,
I'm good with the code right now. thank you anyways. see you later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.