> Hi all,
>
[quoted text clipped - 10 lines]
>
> Dan
Sounds like a job for JDialog to me. Extend it, and add your own getter
functions.
For example, let's say you have a custom JDialog called MyJDialog, and
you created an internal property called userInput of type String, which
you created a getter function for called public String getUserInput();
In that case, here's the code to go in your JFrame.
MyJDialog dialog = new MyJDialog(this, true); // make it modal (means
nothing else can have focus until this dialog is disposed)
dialog.show();
String result = dialog.getUserInput();
If you want the user to be able to still access the JFrame while the
JDialog is showing, pass in a value of false as the second parameter to
the constructor.
John Davison
Dan Madeira - 13 Mar 2004 13:56 GMT
> > Hi all,
> >
[quoted text clipped - 29 lines]
>
> John Davison
Ok, thanks a lot for the advice, but I've run into another problem...
I had to alter a couple of lines of code and now Java is giving me the
exception:
java.lang.IllegalArgumentException: adding a window to a container
when refering to the line:
frame.getContentPane().add(new ManualInput(),BorderLayout.CENTER);
which is my line for adding the entire thing to the main JDialog.
This is after it asked me to change frame.add() to
frame.getContentPane().add() which I guess is a problem with using AWT
code instead of swing, but after changing all the references it gives
me the above exception.
Could you please help me a tiny bit more?
Thanks
Andrew Thompson - 13 Mar 2004 14:12 GMT
>>> Hi all,
>>>
>>> I have a slight problem at the moment...
> Could you please help me a tiny bit more?
I'll help you to help yourself a whole _lot_ more..
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JDialog.html>
The API docs, starting with the ones
for the component you are trying to use..

Signature
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
Dan Madeira - 13 Mar 2004 15:04 GMT
> > Hi all,
> >
[quoted text clipped - 29 lines]
>
> John Davison
Actually, ignore that second message, I've managed to get working perfectly.
Thanks,
Dan