Adding a JPanel to a new node dialog tab

Hi

 

I'm trying to add a ChemAxon Standardizer editor panel to a node dialog. 

 

I've been able to add the panel to a stand alone JFrame, when trying to add it as a new tab I have no luck. 

 

Code snippet: 

 

// creates a full standardizer editor application
        StandardizerEditor application = new StandardizerEditor();
        
        com.chemaxon.alchemist.configbuilder.ui.ConfigBuilderPanel panel = application.getPanel();
        
        addTab("Standardizer editor", panel);
        
        JPanel testPanel = new JPanel();
        
        addTab("Test", testPanel);

 

 

The tab 'Test' appears but the 'Standardizer editor' does not. I get not errors or console output so not really sure how to proceed. 

 

Are there any 'gotyas' when it comes to adding a JPanel? 

 

FYI 'ConfigBuilderPanel ' extends JPanel (http://www.chemaxon.com/jchem/doc/dev/java/api/chemaxon/alchemist/configbuilder/ConfigBuilderPanel.html). 

 

Cheers

 

Sam

Just two ideas, can you set the preferred size on the panel, and/or try to wrap the panel in another one such as JPanel panel2 = new JPanel(new BorderLayout()); panels2.add(panel, BorderLayout.CENTER); I actually have no clue, but it would give it a try.

A Swing/AWT component may only be part of one parent component. If the panel is already contained in the StandardizerEditor it may not be possible to add it to the node dialog.

Hi Both

 

I tried wrapping inside another panel, which causes the new tab to show but without the editor panel. 

 

In an act of desperation is had a look through what other getters were available. Getting the content panerather than the panel and adding this works. 

 

JPanel wrapperPanel = new JPanel(new BorderLayout());
wrapperPanel.add(new JLabel("Standardizer editor"), BorderLayout.NORTH);
wrapperPanel.add(application.getContentPane(), BorderLayout.CENTER);

 

I guess this relates to the container issue?

 

Thanks for the help!

 

Cheers

 

Sam