I'm new to JLink and JAVA (and programming). I'm trying to create a
simple GUI for testing/learning. My program creates a simple window
with a button. When I click the button I want a JOptionPane dialog to
pop up displaying the name of the current model in session.
When I click the button the program locks up. If I comment out the
try-catch portion, the "Hello World" works fine so that leads me to
believe the listener is working properly. If I leave the GUI portion of
the program out and place the try-catch code in the start() method, the
message box pops up as expected. Which leads me to believe that portion
of the code is correct. I just can't seem to combine the two. I hope I
have explained this properly.
I hope someone can clue me in on what I'm doing wrong.
My code to register a listener with the button:
JButton goButton = new JButton("GO");
goButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
runGoButton();
}
});
My runGoButton() code:
public static void runGoButton(){
try {
Session session = pfcGlobal.GetProESession();
String curModel =
session.GetCurrentModel().GetFileName().toUpperCase();
JOptionPane.showMessageDialog(null, "Model name is: " +
curModel);
}
catch (jxthrowable ex) {
}
JOptionPane.showMessageDialog(null, "Hello World!");
}
Thanks
Mike Phillips
The information contained in this message is privileged and intended only for the recipients named. If the reader is not a representative of the intended recipient, any review, dissemination or copying of this message or the information it contains is prohibited. If you have received this message in error, please immediately notify the sender, and delete the original message and attachments.