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. :)
Printable View
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. :)
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.
thank you i'll try that one. :)
edit: got this jdialog thing and it's ok now. thank you.
:bigyello:Code: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);
}
}