Hello, I have recently started to study the java and now I ma creating one program regarding it. But, I don't know how can I call a JDilaog from a JInternalFrame? If ayone knows the details about it, then please provide me solution about it.
Hello, I have recently started to study the java and now I ma creating one program regarding it. But, I don't know how can I call a JDilaog from a JInternalFrame? If ayone knows the details about it, then please provide me solution about it.
If you want to call a JDialog from a JInternalFrame then you need to pass the JInternalFrame object to the constructor. First thing you would need to use the method of JOptionPane which is getFrameForComponent with the JInternalFrame. It will provide you required frame to use with your dialog. Then it is needed to provide the location for JDialog. For this purpose you can also make use of the setLocationRelativeTo (myInternalFrame) method. And there is also availability of the setLocationRelativeTo(null) for setting the JDialog to the center.
I think the code below can be useful for calling a JDialog from a JInternalFrame:Code:In JInternal frm { mdldlg = new mdldlg(internalframe,true) } In mdldlg extends JDialog { mdldlg(JFrame Jfrm , boolean modal) super(Jfrm, modal) }
You can use any one of the book to find out the solution :
- The Java Handbook
- Java in a Nutshell: A Desktop Quick Reference for Java Programmers
- The Java AWT Reference
- Thinking in Java
- Java Programming Language, 2nd Edition
- Core Java 1.2: Volume 1 Fundamentals
You need to visit different java web sites for getting knowledge about the Java. I think that you need to visit the sun website for getting better solution to know about the JDialog. So, just visit it and you may be able to get the solution as well as more advanced knowledge about it. You can also get to know about it by reading different online tutorials.
Make use of the methods below to call a JDialog from a JInternalFrame:
- JOptionPane.getFrameForComponent
- setLocationRelativeTo(myInternalFrame)
- setLocationRelativeTo(null)
Bookmarks