Hello all.

Is there any one that could suggest some key words or links (besides
"How to use JTabbedPane") that could generate some links to tutorials
that describe how to implement the process of adding tabs to
JTabbedPane during runtime?

or profide some feedback on what kind of learning trail to follow?

Thanks

Recommended Answers

All 6 Replies

Simply call the add method, then validate and/or repaint.

Simply call the add method, then validate and/or repaint.

Kind of a loaded statement. But I like that kind simple learning trail.

If I may, I would like to see if any related concepts trigger some good links for writing
good code.

Before I can repaint I presume that I will need to work with many tabs and many JIternalFrames.
I just learned the abstractAction so I will probably need to pass some kind of reference on which
InternalFrame of a JDesktopPane that needs to referenced. In general Is there a way to
keep track of these many JInternalframes and there many tabs? Do to the fact that I am
trying to sort out how the command Pattern may help I have lost the the concept of
what the role of Desktops and InternalFrames play in the events that are fired on there
children(if there is such a thing.

Simply call the add method, then validate and/or repaint.

I will take your word for it. I need to cut through the rest and mark this as solved
Thanks

Simply call the add method, then validate and/or repaint.

Oh, you mean like this.

public void insertSelectedTab() {

        String M = (" --> in actionPerformed() var: e.getActionCommand() : xxxxxxxx<-- \n");
        System.out.println(M);
        pane=getPane();
        int c = pane.getTabCount();
        pane.addTab("New Tab Title", pane.getTabComponentAt(c-1));
        pane.validate();
        pane.repaint();

        
    }

is there a way to make that param actually load a "template" GUI form of sorts
every time insertSelectedTab() is used?

I can make the class template.java. How would I add that?
e.g.= pane.addTab("New Tab Title", pane.getTabComponentAt(c-1));

Uhm,

pane.addTab("New Tab Title", new JPanel());

?

Uhm,

pane.addTab("New Tab Title", new JPanel());

?

Oh,well of course.

public static void insertSelectedTab() throws FileNotFoundException, IOException, SQLException, UnknownUserNameException, IncorrectPasswordException, LoginException, ProfileException, model.err.LoginException {

        String M = (" --> in insertSelectedTab() var: xxxxxxxx<-- \n");
        System.out.println(M);
        
        name =OneNoteSetupTabFrame.getInsertTabName();
        System.out.println(C + M + AND + name + ": CreateSystemStartFolders.getInsertTabName() : \n");
        
        pane = getPane();
        int c = pane.getTabCount();
        CreateContentTabPanels gp = new CreateContentTabPanels();
        pane.addTab(name, gp.noteContentTab());
        pane.validate();
        pane.repaint();



    }

output

CLASS 
   OneNoteSetupTabFrame: 
 --> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<-- 
 : insert:var insert : 

 --> in insertSelectedTab() var: xxxxxxxx<-- 

CLASS 
NotesAction: 
 --> in insertSelectedTab() var: xxxxxxxx<-- 
 : November: CreateSystemStartFolders.getInsertTabName() : 

CLASS 
   OneNoteSetupTabFrame: 
 --> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<-- 
 : insert: var insert: ; returns :

Some where in the code I create some files. Do you know how to use XML to keep track
of tabs added and the file created so I can learn serialization?
I will need to delete this tab and file too.
Thanks
output

CLASS 
   OneNoteSetupTabFrame: 
 --> in createOneNoteTab(November) var: name : <-- 
 : : caller 
--->:  setupTestFolder(November) : var: xxxx : xxxxxxx <-----

 --> in  setupTestFolder(November) var: name : xxxxxxxx<-- 

 --> in bExists() var: xxxxxxxxx : xxxxxxxx<-- 

CLASS 
   OneNoteSetupTabFrame: 
 --> in bExists() var: xxxxxxxxx : xxxxxxxx<-- 
 : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\Groceries\November: folderLocation : 

CLASS 
   OneNoteSetupTabFrame: 
 --> in bExists() var: xxxxxxxxx : xxxxxxxx<-- 
 : false: var bExists : returns : 

CLASS 
   OneNoteSetupTabFrame: 
 --> in  setupTestFolder(November) var: name : xxxxxxxx<-- 
 : : caller 
--->: allowCreationOfOneNoteTab(November) : var: name : xxxxxxx <-----

 --> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<-- 

CLASS 
   OneNoteSetupTabFrame: 
 --> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<-- 
 : : caller 
--->: CreateOneNoteCategoryFile.setupOneNoteTabFolder(November) : var: name; <-----

 --> in  setupOneNoteTabFolder(November) var: frameName : xxxxxxxx<-- 

 --> in setOneNoteFolderSystemDir() var: xxxxxxxxx : xxxxxxxx<-- 

CLASS 
CreateOneNoteCategoryFile extends CreateSystemStartFolders: 
 --> in setOneNoteFolderSystemDir() var: xxxxxxxxx : xxxxxxxx<-- 
 : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\Groceries\November:systemDir : 

CLASS 
CreateOneNoteCategoryFile extends CreateSystemStartFolders: 
 --> in setOneNoteFolderSystemDir() var: xxxxxxxxx : xxxxxxxx<-- 
 : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\Groceries\November: systemDir : 

CLASS 
CreateOneNoteCategoryFile extends CreateSystemStartFolders: 
 --> in  setupOneNoteTabFolder(November) var: frameName : xxxxxxxx<-- 
 : insert: var insert: ; returns : 

CLASS 
   OneNoteSetupTabFrame: 
 --> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<-- 
 : insert:var insert : 

 --> in insertSelectedTab() var: xxxxxxxx<-- 

CLASS 
NotesAction: 
 --> in insertSelectedTab() var: xxxxxxxx<-- 
 : November: CreateSystemStartFolders.getInsertTabName() : 

CLASS 
   OneNoteSetupTabFrame: 
 --> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<-- 
 : insert: var insert: ; returns :
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.