cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

jlink question - joptionpane pops up behind window

lylebeidler
1-Newbie

jlink question - joptionpane pops up behind window

Here's one for the JLink experts. I'm trying to use JOptionPane for my
error alerts, rather than the message window. The problem is, my dialog
boxes keep popping up behind the pro/e window, rather than in front.

I was advised to encase the JOptionPane in a JDialog, like this:



Object[] array = {

new JLabel("Enter some text:"),

};



JOptionPane pane = new JOptionPane(array, JOptionPane.ERROR_MESSAGE);

JDialog dialog = pane.createDialog(null, "Result Data");



dialog.setResizable(true);

dialog.setVisible(true);





But it still pops up behind the pro/e window. Has anyone else seen this &
figured out how to fix it?



We're all on WF3, on WinXP here.

Thanks.

--



Lyle Beidler
MGS Inc
178 Muddy Creek Church Rd
Denver PA 17517
717-336-7528
Fax 717-336-0514
<">mailto:-> -
<">http://www.mgsincorporated.com>
1 REPLY 1

I struggled with this quite a bit when I first started with J-Link & Java. It turns out it's a bug with J-Link: the first JoptionPane window you call in a Pro/E session will (nearly) always open behind the Pro/E window. Subsequent windows will appear in front.

It's a shame it works this way, because JoptionPane is so easy and compact to use. To get around it, you have to use Jdialog commands, which forces you to get into all of the annoying details of GUI creation even for simple tasks.

I am no Java expert, but I think the course most people choose it to just set up a method to create and show a basic GUI, and then add it as needed to your code.

Best Regards,
Top Tags