|
-
Oct 1st, 2002, 08:10 PM
#1
Thread Starter
Hyperactive Member
java message box
is thier a messagebox in java like in vb ????? if so how do i use it ?
-
Oct 2nd, 2002, 04:27 AM
#2
Addicted Member
There is a message box method in Java, however it is only available when using Swing (I think).
Swing allows you to use graphical components in Java classes. If you want to know more about this goto:
http://java.sun.com/docs/books/tutorial/uiswing/
It's a Swing tutorial. However, if you are just doing it for debugging etc. I suggest ignoring it as it can be very slow. Also, it's rather a lot of possibly unnecessary hassle.
Hope it helps
HD
-
Oct 2nd, 2002, 03:44 PM
#3
Thread Starter
Hyperactive Member
no its for user errors and for valadation
-
Oct 2nd, 2002, 04:52 PM
#4
Thread Starter
Hyperactive Member
ok cool thanks for the tutorial but dose it have a name so can search for it ?
-
Oct 3rd, 2002, 03:34 AM
#5
Addicted Member
Sorry I forgot to say what the thing's called
You can use the JOptionPane class (I think) and the method showMessageDialog(...). Have a look here:
http://java.sun.com/docs/books/tutor...ts/dialog.html
That should do it!
HD
-
Oct 3rd, 2002, 03:50 AM
#6
Thread Starter
Hyperactive Member
-
Oct 4th, 2002, 03:50 AM
#7
Thread Starter
Hyperactive Member
can someone give me a working example ??("JBuilder")
-
Oct 4th, 2002, 06:06 AM
#8
Addicted Member
Can't be sure if this will work - don't have chance to try it (supposed to be working )
/* All imports here - java.swing.* and the like
*
..
*/
JFrame frame = new JFrame("My Window");
JOptionPane.showMessageDialog(frame, "This is my window");
http://java.sun.com/docs/books/tutor...ialogDemo.java
is an example of using frames and dialogs with Swing.
I've not done much so I haven't got any examples.
HD
-
Oct 4th, 2002, 08:42 PM
#9
Thread Starter
Hyperactive Member
ya i tryed to run that example but it wouldnt compile had errors
-
Oct 4th, 2002, 09:15 PM
#10
Thread Starter
Hyperactive Member
Ok i got it to work now thanks :-)
Code:
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class Dialog extends JApplet
{
JFrame frame = new JFrame("My Window");
public Dialog()
{
JOptionPane.showMessageDialog(frame, "This is my window");
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|