# InsertWizCreateJCX.java Sample

This topic inludes the source code for the InsertWizCreateJCX.java Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/ExtensionDevKit/ControlDevKit/DBScripter/dbScript/designUI/

## Sample Source Code

`001 package dbScript.designUI; 002 003 import com.bea.ide.control.ControlWizard; 004 import java.util.ArrayList; 005 import javax.swing.*; 006 import java.awt.BorderLayout; 007 import java.util.prefs.Preferences; 008 import com.bea.ide.control.EditorSupport; 009 import java.io.*; 010 import java.awt.event.ActionEvent; 011 import java.awt.event.ActionListener; 012 import javax.swing.JList; 013 import javax.swing.ListSelectionModel; 014 import java.text.MessageFormat; 015 import java.awt.Dimension; 016 import java.beans.PropertyChangeListener; 017 import java.beans.PropertyChangeEvent; 018 import com.bea.ide.control.EditorContext; 019 020 021 public class InsertWizCreateJCX extends com.bea.ide.control.ControlWizardSimple 022 { 023 private JndiDsPanel _jndiPanel; 024 025 private JList _scripts; 026 private JList _scriptsSelected; 027 private JButton _btnSelect; 028 private JButton _btnRemove; 029 private String _sFileName; 030 031 private int _panelNum = 0; 032 public static boolean _fPanelIsInited=false; 033 private String _packageName; 034 private String _jcxName; 035 private int _configReq=this.CONFIG_INSERT_INSTANCE; 036 public static EditorContext _ctx; 037 038 public ArrayList getInstanceAnnotations() 039 { 040 ArrayList list = super.getInstanceAnnotations(); 041 return list; 042 043 } 044 045 public boolean onFinish() 046 { 047 if (!_jndiPanel.isValidState()) 048 return false; 049 050 return super.onFinish(); 051 } 052 053 public int getConfigurationInfo() 054 { 055 return (this.CONFIG_INSERT_INSTANCE + this.CONFIG_CREATE_EXTENSION_FILE); 056 } 057 058 public EditorContext getEditorContext() 059 { 060 return super.getContext(); 061 } 062 063 public JComponent getComponent() 064 { 065 if (_jndiPanel == null) 066 { 067 _jndiPanel = new JndiDsPanel(this); 068 try 069 { 070 _jndiPanel.buildUI(); 071 _jndiPanel.retrieveDataSourceNames(); 072 _jndiPanel.addPropertyChangeListener("enabled", new PropertyChangeListener() 073 { 074 public void propertyChange(PropertyChangeEvent e) 075 { 076 if ((e.getNewValue().toString()=="true") && !_fPanelIsInited) 077 { 078 _jndiPanel.setInitialEnabledState(); 079 } 080 } 081 }); 082 083 } catch (Exception e) { 084 e.printStackTrace(); 085 } 086 } 087 return _jndiPanel; 088 } 089 090 public void setPackage(String packageName) 091 { 092 _packageName = packageName; 093 } 094 095 public void setName(String JcxName) 096 { 097 _jcxName = JcxName; 098 } 099 public void setConfiguration(int iCfg) 100 { 101 _configReq = iCfg; 102 } 103 104 public String getExtensionFileContent() 105 { 106 return _jndiPanel.getJcxFileContent(_packageName, _jcxName); 107 } 108 109 }`