views:

18

answers:

1

Hi there I would like to allow an existing JFrame (Calculating application) to print out a pre made JFrame (Error Shown = Textbox shows "Warning Wrong number entered") when I hit the calculating button and there is alphanumeric entered as a calculating value instead of just numeric numbers. I do not want to create a new JFrame within the "Calculating application" JFrame. Is there a way to link 2 JFrames together?

Please do help as I am very new to this programming.

A: 

You need to provide a bit better a description of your problem because "print out a pre made JFrame" and "not create a new JFrame" are a bit confusing.

You can use JOptionPane to popup a message dialog (JOptionPane.showConfirmDialog) when your error occurs. The popup should be parented by your JFrame so they are "linked" that way:

JOptionPane.showConfirmDialog(null, "Please enter numbers only", "naughty", JOptionPane.CANCEL_OPTION);
jowierun
Awesome idea man! Thanks for the help! However the answer provided doesn't really answer my question as I have just found out in order to like 2 different JFrames you need to just simply link up the JFrame classes. But your idea made the program simpler! Thanks again man!
JavaNoob
You're welcome dude.
jowierun