Click to See Complete Forum and Search --> : show modal frame
brown monkey
Aug 28th, 2004, 02:20 AM
dunno if my subject meets my need. hehe. how do i do a frame that is modal. sample of this is an about frame. something like a .showdialog() in c#. thank you in advance. :)
Dillinger4
Aug 28th, 2004, 10:27 AM
You normally hook a JDialog to a JFrame using JDialog's(Frame parent, String title, boolean modal) constructor. For complex dialogs there are static methods in the JOptionPane class that can be invoked. You most likley want to use showMessageDialog(Component parent component, Object message, String title, int messagetype, Icon icon) or one of it's variants.
brown monkey
Aug 29th, 2004, 08:29 PM
thank you i'll try that one. :)
edit: got this jdialog thing and it's ok now. thank you.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class cAbout extends JDialog{
public cAbout(JFrame f){
super(f,"cAbout",true);
initializeComponent();
}
void initializeComponent(){
setSize(466,348);
Dimension s=Toolkit.getDefaultToolkit().getScreenSize();
setLocation(s.width/2-getSize().width/2,
s.height/2-getSize().height/2);
setVisible(true);
}
}
:bigyello:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.