Parent « Dialog « Java Swing Q&A





1. How do I set the position of a dialog so it is centered in it's parent frame?    stackoverflow.com

I have a dialog class with a constructor like the following

public SampleDialog(JComponent parent, String title){
    super((Frame)SwingUtilities.getAncestorOfClass(Frame.class, parent), title, false);
    setLocationRelativeTo(parent);
    init();
  ...

2. How can I return a value from a JDialog box to the parent JFrame?    stackoverflow.com

I have created a modal JDialog box with a custom drawing on it and a JButton. When I click the JButton, the JDialog box should close and a value should ...

3. how to create a JDialog which can only floating within its parent frame    stackoverflow.com

I want to create a JDialog which can only float within its parent Frame. That is it cannot be dragged out from its parent frame. Any idea? mouse-motion listener? thanks, EDIT:

  1. My applicaiton is ...

5. Two JDialogs with the same parent    coderanch.com

See if this helps. It uses a synchronized method to make everyone wait their turn. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class EventTest { public static void main(String[] args) { JFrame f = new JFrame(); EventMaker1 em1 = new EventMaker1(f); EventMaker2 em2 = new EventMaker2(f); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(em1.getUIPanel(), "North"); f.getContentPane().add(em2.getUIPanel(), "South"); f.setSize(300,175); f.setLocation(100,200); f.setVisible(true); } } interface Schedulable { public void ...

6. Problem with two Dialogs sharing a parent    coderanch.com

I have an applet which appears as a button, and when the user clicks on it, a modal Dialog (mainDialog) is opened. When certain events occur on mainDialog, a smaller modal Dialog (subDialog) appears. Both Dialogs have the applet frame as their parents, and the problem is that input is be blocked to subDialog when it is shown. I have tried ...





10. Parent and Child JDialogs    coderanch.com

Of recent I've been undergoing some program design in the area of swing to acquaint myself with java's GUI capabilities. What I'm working at is with the basic intent of practicing to lead to competence and consequently create a basic application. The idea behind the application is a simple one: the components of this application are three. They include, a JFrame ...

11. Change JPanel text of Parent JPanel from JDialog    java-forums.org

I am working on an Java Desktop Application. I am displaying multiple JPanels in a JFrame. A Jpanel includes collection of components like buttons and other JPanels. When the button of that JPanel is clicked it opens a JDialog. Now my problem is when I perform button click on that JDialog how can I update the texts of that particular parent ...

12. How to set JPanel as parent of JDialog?    forums.oracle.com

Hi all, I write my own class which extends from JPanel. Within this class, I want to create a JDialog with its parent is this class. Could anyone show to how to archive this case? Note: Must be in Java 5 or lower. Thanks, Ringo Edited by: Ringo.CS on Sep 24, 2008 12:02 AM

13. Making JFrame a parent of JDialog    forums.oracle.com

nick2price wrote: All of my buttons should be created in the constructor of the class, while all labels and text fields should be created outside but added in the constructor? The general rule is that you use the most limited scope necessary. That is, anything that needs to have a class scope should be declared in the class while anything not ...