New screen-tabs after user signs in - java

In GUI NetBeans I have JFrame with a JTabbedPane. There are 3 tabs on the top, each one for a different user. Each tab has JPanel where user have to enter password. After the password is verified I got rid of the other two tabs by asking tabbed pane to remove other two tabs by a method `remove(), since once the user is signed in other two users tabs are not relevant anymore.
Now I'm left with only one tab, however after a user had signed in I want that user to see new tabs - panels, while removing the previous tabs I don't know how to put this into code since I don't know where I should create the new screen with tabbed pane that will become visible to the user.
I tried to add another JTabbedPane, to a frame alongside the first tabbed pane, and make it not visible until user is verified, while the first tabbed pane is removed, however in a NetBeans design window the new pane is on top of the first one so I cant add components to a new tab pane.
I know Im not doing it in the correct way. Can somebody give me advice on how to code solution for getting new tab screen for the user who has signed in?

Related

How to switch the right side of the Jsplite between blank/JTabbedPane

I have a Jsplitpane where on the left side I show a list and on the right side there is JTabbedPane. If I click on a list item, then the JTabbedPane will update the info. Everything works good.
Now my question is, when no list item is clicked on ( so basically when you run it first time), then I want to to replace the JTabbedPane with empty panel (blank right side). I tried to do setVisibility to be off on the JtabbedPane but then the divider is pushed all the way to the right. Is there a quick way to just make this JtabbedPane blank and then somehow make it appear later on. Here are screenshots to better explain the situation:
Fully functional window
What I want when no item is clicked
What happens if no item is clicked

How to get JFrame's button sizes?

I created a JFrame and in the top right corner I have 3 buttons (minimize, maximize, close). How do I get the size of these buttons? I want to place a new button just to the left of the minimize button in the title bar but I need to know how much space these existing buttons take up so that I don't place my button on top of them. ie If you open a recent version of the Chrome browser you'll see a button beside the minimize button in the browser window. I want to do the same sort of thing in my Java application.
What your describing is very advanced.
An alternative route would be to use:
setUndecorated(true);
Then create your own window decorations. This way everything matches and you can add all of the button that you want.

How can I refer to a specific tab using JTabbedPane?

I'm trying to add an applet to one of my tabs, but each time I try to add it to a certain tab, it's creating a new tab.
I have already made the tabbed pane using netbeans, added panels to both of the tabs and tried to replace the panel with my applet panel and it's not working correctly. My questions is how can I refer to the "Game" tab and add the applet to that panel?
https://dl.dropbox.com/s/q0lfuz9cxp757n8/Screenshot%202014-07-13%2001.06.42.png
Here's what I'm trying
TabbedPane tabbedPane = new TabbedPane();
tabbedPane.gameTab.add(gamePanel);
And it keeps creating a new tab as seen in the image, but I'm trying to add the gamePanel to the existing "Game" tab.
First of all you don't want to keep creating a new JTabbedPane. You want to update the existing tabbed pane.
Read the JTabbedPane API. There are several approaches you could use:
1) Use the remove(...) method to remove the current tab, then use the add(...) method to add a new tab. The API allows you to add a tab to the end or at a specific index. This is probably the easiest.
2) Use the getComponentAt(...) method to get the panel that was added to a specific table. Then you can add any component to this panel, assuming you have a proper layout.
In both cases the question is why isn't the applet added when you initially create the tab?

JTabbedPane Forced Size

I have a JFrame that has 3 components on it.
The design is like this:
My problem happens in the JTabbedPane.
The pane begins off with a settings panel, which is added to it when the whole JFrame loads up. Then, when the user connects, a new tab is added to the pane (the actual chat panel).
When that tab is added to the pane, it overlaps the bottom of the java applet loaded from the local file, which is NOT what I want to do. Here is how it looks:
As you can tell, the bottom of the highscores and java applet has been cut off. How do I resize the JTabbedPane to make it resize towards the bottom, instead of upwards?
Call pack() after adding a tab to the pane.

LWUIT tabs, how to make tabs as title of a container?

Hi I'm new in LWUIT please help me figure this out, I want to make my tabs to stay in tact when I scroll the list within the container that the Tab houses. For example I have a tab on which I add 3 tabcomponent and these components are containers, the first container has different containers in it, the second container has an HTMLComponent and the third one has a list which contains a lot of element more than 100. When I scroll this list the Tabs disappear as the list moves down, so how do i stop this and make only the list scrollable and the Tabs to be always visible like a title?
form.setScrollable(false);
form.setLayout(new BorderLayout());
form.addComponent(BorderLayout.CENTER, tabs);
Now when adding a component as a tab make sure it is scrollable.

Categories