Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
I'm trying to insert some values in two parameters in CREO.
These two parameters are obtained through the values of a JTextField.
This code is in a jbutton. Below is the code:
What is happening is that it is not transferring these values and the application is locking the process, the solution is to end the process.
private void btnInsereParamActionPerformed(java.awt.event.ActionEvent evt) {
try {
Session session = pfcGlobal.GetProESession();
Model model = session.GetCurrentModel();
Parameter paramDescMat = model.GetParam("DESC_MAT");
Parameter paramCodMat = model.GetParam("COD_MAT");
paramDescMat.SetValue(pfcModelItem.CreateStringParamValue(txtDescMP.getText()));
paramCodMat.SetValue(pfcModelItem.CreateDoubleParamValue(Integer.parseInt(txtCodMP.getText())));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Erro", JOptionPane.WARNING_MESSAGE);
}
JOptionPane.showMessageDialog(null, "Parametros imputados com sucesso!", "Erro", JOptionPane.INFORMATION_MESSAGE);
}
First of all in this line you tried to put integer to double parameter. This is bad.
paramCodMat.SetValue(pfcModelItem.CreateDoubleParamValue(Integer.parseInt(txtCodMP.getText())));
Try to comment this line and do test your program again.
Thanks Yaroslav Sinitzin for the help!
The problem was that I was using a JPanel. I used a JDialog and it worked perfectly.
I also fixed the problem pointed out by you.
I found the solution here: http://communities.ptc.com/thread/56865