cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
nileshrathodn
Level 6

problems while re-visiting custom code panel!!

Hi all,
I have made a custom code panel in my installer made by InstallAnywhere Enterprise Edition 2009. When I click next on this panel and again by clicking previous come to this panel The custom code panel does not work properly.
I have read something like "I have to set non-static flag" for setupUI method of installanywhere. but how to do that???
In installanywhere help it's written that I should find in UserGuide document.. But I am not able to find anything in that document.......
Can anybody guide me regarding this please?????

Thanking you,
Nilesh Rathod.
Labels (1)
0 Kudos
(5) Replies
pv7721
Level 20

When you say that your panel doesn't work correctly when navigating through it using the Previous & Next buttons, what exactly happens (and what should have happened?)
0 Kudos
nileshrathodn
Level 6

pv7721 wrote:
When you say that your panel doesn't work correctly when navigating through it using the Previous & Next buttons, what exactly happens (and what should have happened?)


I have added two radio buttons say r1 & r2 and a button say b1 and a Jlist.On clicking r1 I disable jlist and the button b1. also r1 and r2 are in group. After pressing next and again coming back to this panel this panel doesn't work(disable and all) properly)
0 Kudos
pv7721
Level 20

Would it be possible to post the custom panel code?
0 Kudos
nileshrathodn
Level 6

pv7721 wrote:
Would it be possible to post the custom panel code?


import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import com.zerog.ia.api.pub.*;
import com.zerog.ia.auto.project.actions.ShowMessageDialog;
import com.zerog.ia.installer.actions.ShowDialogAction;
import javax.swing.plaf.FontUIResource;

public class JVMS extends CustomCodePanel
{


Font f = null;
Font f1 = null;
JList jList = null;
JLabel l1 = null;
JLabel l2 = null;
ButtonGroup bg = null; // @jve:decl-index=0:
GUIAccess gui= null;
Frame fr = null;
CustomCodePanelProxy ccpp; // @jve:decl-index=0:
JButton b1 = null;
JRadioButton r1 = null;
JRadioButton r2 = null;
DefaultListModel listmodel = null;
Vector vec = null; // @jve:decl-index=0:
JOptionPane z = null;
public String ne = null;

public boolean setupUI(CustomCodePanelProxy proxy)
{gui = (GUIAccess)proxy.getService(com.zerog.ia.api.pub.GUIAccess.class);
fr = gui.getFrame();
z = new JOptionPane();
listmodel = new DefaultListModel();
vec = new Vector();
bg = new ButtonGroup();
jList = new JList(listmodel);
r1 = new JRadioButton();
r2 = new JRadioButton();
l1 = new JLabel();
l2 = new JLabel();
f = new Font("TimesNewRoman",0,12);
f1 = new Font("TimesNewRoman",1,12);
b1 = new JButton();
r2.setBounds(new Rectangle(38, 39, 21, 21));
r2.setBackground(new java.awt.Color(239,243,255));


r2.setSelected(true);
r1.setBounds(new Rectangle(37, 13, 21, 21));
r1.setBackground(new java.awt.Color(239,243,255));


l1.setBounds(new Rectangle(74, 42, 298, 16));
l1.setText("Choose a Java VM already installed on the system");

l2.setBounds(new Rectangle(76, 15, 298, 16));
l2.setText("Install a Java VM specifically for Contract Manager");


b1.setBounds(109,268,160,24);

jList.setBounds(15,75,343,184);

b1.setText("Search Another Location");

ccpp = proxy;

InstallerResources ir = (InstallerResources)proxy.getService(InstallerResources.class);

vec = ir.getJavaVMList();
for(int i=0; i {
listmodel.addElement(vec.get(i));
}


jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jList.setSelectedIndex(0);
jList.setVisibleRowCount(5);
// JScrollPane listScrollPane = new JScrollPane(jList);



try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception ex){

}




r2.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
System.out.println("itemStateChanged()"); // TODO Auto-generated Event stub itemStateChanged()
}
});
r2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {

jList.setEnabled(true);
b1.setEnabled(true);
ccpp.setVariable("bundledvm",0);
ccpp.setVariable("installedvm",1);


}
});

r1.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
System.out.println("itemStateChanged()"); // TODO Auto-generated Event stub itemStateChanged()
}
});
r1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
jList.setEnabled(false);
b1.setEnabled(false);
ccpp.setVariable("bundledvm",1);
ccpp.setVariable("installedvm",0);
ccpp.setVariable("JAVA_HOMEx","ecmfroot");
jList.clearSelection();




}
});

jList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
if (evt.getValueIsAdjusting())
return;
String n = jList.getSelectedValue().toString().trim();
ne = n.substring(0,n.length()-9);
ccpp.setVariable("JAVA_HOMEx",ne);
z.showConfirmDialog(null,"jlist "+jList.isEnabled()+"\n Button :"+b1.isEnabled()+"\n Bundled :"+r1.isEnabled()+"\n Installed :"+r2.isEnabled()+"\nJAVA Path :"+ne);
}
});

b1.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mouseClicked(java.awt.event.MouseEvent e)
{
System.out.println("mouseClicked()");
}
});

b1.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
System.out.println("actionPerformed()");
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int option = chooser.showOpenDialog(JVMS.this);
if (option == JFileChooser.APPROVE_OPTION)
{
String loc = (((chooser.getSelectedFile()!=null)? chooser.getSelectedFile().getAbsolutePath():"nothing"));

fun(loc);
}
else {
}

}
});

if(r1.isSelected())
{
ccpp.setVariable("bundledvm",1);
ccpp.setVariable("installedvm",0);
}
else if(r2.isSelected())
{
ccpp.setVariable("installedvm",1);
ccpp.setVariable("bundledvm",0);
}

this.setSize(398, 310);
this.setLayout(null);
add(jList);
add(b1);
add(r1);
add(r2);
bg.add(r2);
bg.add(r1);
add(l1);
add(l2);

return true;

}
void fun(String loc)
{
File folder = new File(loc);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles.isFile())
{
String str = listOfFiles.getName();
if(str.equalsIgnoreCase("java.exe"))
{
listmodel.addElement(listOfFiles.getPath());
}
}
else if (listOfFiles.isDirectory())
{
fun(listOfFiles.getPath());
}
}
}
public void panelIsDisplayed(CustomCodePanelProxy proxy)
{





}



public boolean okToContinue()
{

return true;
}
public String getTitle()
{
return "Choose JVM from List";
}
}


I know that we have panel (ready made) to select JVM but i want to disable "Search another Location" when r1 is selected.

Thank you,
0 Kudos
nileshrathodn
Level 6

pv7721 wrote:
Would it be possible to post the custom panel code?


Hi,
I have sent the custom code panel code.
Can you help me now please??

Thanking you,
Nilesh Rathod.
0 Kudos