JDialog as a component of DesktopPane

I am developing an application with JDdesktopPane having internal frames.I need to have a dialog box with textfields where in I want users to enter data.Although I have successfully managed to do this there is onr major problem--the constructor I have used is this:JDialog();so if the Dialog is active and I mistakenly click on any other place in the JDesktopPane other than the Dialog, it(the dialog) vanishes from the JDesktop and lands in the computer's desktop.I beleive this is because I have not used JDialog(Frame owner) as the constructor.But since my Desktop contains only Internal frames i cannot use any Frame as the owner.I tried using JInternalFrame as the owner but that didnt work.
How do I make the JDialog stay within the JDesktop at all times.
thanks
RS

I am developing an application with JDdesktopPane having internal frames.I need to have a dialog box with textfields where in I want users to enter data.Although I have successfully managed to do this there is onr major problem--the constructor I have used is this:JDialog();so if the Dialog is active and I mistakenly click on any other place in the JDesktopPane other than the Dialog, it(the dialog) vanishes from the JDesktop and lands in the computer's desktop.I beleive this is because I have not used JDialog(Frame owner) as the constructor.But since my Desktop contains only Internal frames i cannot use any Frame as the owner.I tried using JInternalFrame as the owner but that didnt work.
How do I make the JDialog stay within the JDesktop at all times.
thanks
RS

Similar Messages

  • How to return the hWND of a JDialog or AWT component?

    can anyone help me try and return the handle for a JDialog or a AWT component? I just don't seem to be able to get anything to work, and any references to code all come from 2002 and i'm not sure if it works in Java 1.5
    I'm trying to return the handle of a JDialog, could anyone help me do this?
    Thank you :)

    can anyone help me try and return the handle for a
    JDialog or a AWT component? I just don't seem to be
    able to get anything to work, and any references to
    code all come from 2002 and i'm not sure if it works
    in Java 1.5
    I'm trying to return the handle of a JDialog, could
    anyone help me do this?
    Thank you :)Do not know what a hWND is. By handle do you mean reference? if that's what you mean just pass the Object. As to the code working in v1.5 ... try it and see.

  • Restrict Movement of JDialog in Parent Component

    I have created a non-modal JDialog. I would like to restrict the movement of the JDialog so that it cannot be moved outside the bounds of its parent component. Help is appreciated!
    lissa7613

    You could use a JDesktopPane with JInternalFrames, this is their default behaviour. Read this section from the Swing tutorial on "How to Use Internal Frames":
    http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html
    Otherwise, you would have to add a ComponentListener to the JDialog. Whenever the JDialog is moved, you would check its location and if it is outside the bounds of the parent frame then you would reset its location. Here is a tutorial on "Using a Component Listener":
    http://java.sun.com/docs/books/tutorial/uiswing/events/componentlistener.html

  • How to get the parent Frame of a component ?

    Hi,
    I'm wondering how to get the parent JFrame (or JDialog) of a component.
    Thanks for tips

    I'm using this code:
    public Component getFrame(Component comp)
        Component frame = comp;
        while ((frame != null) && !(frame instanceof Frame))
            frame = frame.getParent();
        if (frame == null)
            frame = comp;  // no parent found
        return frame;
    }

  • Use a JDialog as ToolTip

    Hi,
    First, I want to thanks every contributor of these amazing forums. Secondly, I want to know if is possible to use a JDialog as a Component's Tooltip. The reason for this, its that I want to display an information and I need the be able to click on the tooltip, to go to the clicked information. Any help will be appreciate it. Thanks in advance.
    PS. Sorry for my English, hope is understandable.
    With Regards,
    Miguel

    Hi camickr,
    Thanks for your fast reply I have already override the getToolTip method (for tool tip refresh purposes). The JEditorPane is a great idea, but how i use it in the getToolTip method of my components if the expected return type shopuld be JToolTip.
    PS. I am already using HTML in the tool tip for formatting purposes and to use a icon. It is possible to call a method within the HTML? My problem is that I'm displaying (in the tool tip) information from a JTable and I want to be able to click on a part of the text (what could be a jLabel in the Editor Pane) and as soon as the click happens I want to set the select row of the JTable corresponding to the clicked information.
    Thanks in advance
    Miguel
    Edited by: miguelNieves0714 on Apr 16, 2009 2:14 PM

  • How can i change the icon in the top left of a jdialog

    how can i change the icon in the top left of a jdialog.
    thnkx in advance

    You cannot directly. If you have a jFrame (e.g.) with your own icon you can use one of the JDialog costructors using (Component owner, ... ). Then the dialog will display the same icon.

  • Editor pane crashes when run more that once

    Hello,
    I'm using an editor pane in my application to display an html file for on-line help.
    The page runs fine, with all the hyperlinks working fine as well.
    The problem is when I call the editor pane for a second time it always crashes in the middle of loading.
    Anyone got an ideas????
    Cheers for any help,
    Al

    MNot that I'm aware of. Here's the code:
    public class OnLineHelp extends JDialog implements HyperlinkListener
    //Component Initialisation------------------------------------------------------
    JScrollPane editorScrollPane;
    JEditorPane finalPane;
    JEditorPane editorPane = new JEditorPane();
    GridBagLayout gridBagLayout1 = new GridBagLayout();
    //Constructor-------------------------------------------------------------------
    public OnLineHelp(Frame parent)
    super(parent);
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try
    jbInit();
    catch(Exception e)
    e.printStackTrace();
    pack();
    private void jbInit() throws Exception
    this.setTitle("Rift Modeller Help"); //frame title
    this.getContentPane().setLayout(gridBagLayout1);
    setResizable(true);
    editorPane.setPreferredSize(new Dimension(700, 500));
    editorPane.setMinimumSize(new Dimension(700, 500));
    editorPane.setDisabledTextColor(Color.black);
    editorPane.setEditable(false);
    try
    editorPane.setPage(ClassLoader.getSystemResource("Images/help.htm"));
    editorPane.setVisible(true);
    catch(IOException e)
    System.err.println("Error: URL Not Recognised");
    finalPane = editorPane;
    editorPane.addHyperlinkListener(this);
    editorScrollPane = new JScrollPane(editorPane);
    editorScrollPane.setHorizontalScrollBarPolicy
    (JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScrollPane.setVerticalScrollBarPolicy
    (JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    editorScrollPane.setMinimumSize(new Dimension(700, 500));
    editorScrollPane.setPreferredSize(new Dimension(700, 500));
    finalPane.setMinimumSize(new Dimension(700, 500));
    this.getContentPane().add(editorScrollPane,
    new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(2, 2, 2, 2), 0, 0));
    //method to enable hyperlink----------------------------------------------------
    public void hyperlinkUpdate(HyperlinkEvent he)
    try
    if(he.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
    finalPane.setPage(he.getURL());
    catch (Exception e)
    System.out.println(System.err);
    //Overridden so we can exit when window is closed-------------------------------
    protected void processWindowEvent(WindowEvent e)
    if (e.getID() == WindowEvent.WINDOW_CLOSING)
    cancel();
    super.processWindowEvent(e);
    //Close dialog------------------------------------------------------------------
    void cancel()
    dispose();
    }

  • HOW TO SHOW COMPONENT IN JDIALOG WHILE MAIN APP SLEEPING?

    I have done a code below and it is working but the only problem is when the main program start to sleep by use Thread.sleep(10000) for 10 secs and it will prompt out a JDialog contain JLabel inside it with message "Please wait.... program is sleeping.". And when the thread ends the JDialog will auto disappear and it back to the main program.
    The problem is:
    When the JDialog appear, it doesn't show the component so I only be able to view the JDialog window without contain any component. I already use container to add the component into JDialog but it still doesn't show. I only be able to see the JDialog window contain empty component when the main window is sleeping.
    How to make the components also appear in the JDialog when the main program is sleeping?
    Below is the code pls have a try:
    import java.util.*;
    import java.lang.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class testThread extends JFrame
    public static java.util.Timer thisTimer;
    public static doTask a;
    public static testThread tT;
    public Container cMain;
    public Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    public JButton exitBtn;
    public JButton startThreadBtn;
    /** Creates a new instance of testThread */
    public static void main(String args[])
    new testThread();
    public testThread()
    //System.out.println("Start to call JDialog");
    tT = this;
    int realW = (int)screenSize.getWidth();
    int realH = (int)screenSize.getHeight();
    int mainW = 500;
    int mainH = 300;
    setBounds((int)((realW-mainW)/2), (int)((realH-mainH)/2), mainW, mainH);
    setVisible(true);
    exitBtn = new JButton("EXIT");
    exitBtn.setBounds((int)((500-100)/2), (int)((300-50)/5), 100, 50);
    exitBtn.addActionListener
    new ActionListener()
    public void actionPerformed(ActionEvent e)
    System.exit(0);
    startThreadBtn = new JButton("Start Thread");
    startThreadBtn.setBounds((int)((500-100)/2), (int)((300-50)/5*4), 100, 50);
    startThreadBtn.addActionListener
    new ActionListener()
    public void actionPerformed(ActionEvent e)
    try
    System.out.println("Start to call JDialog");
    a = new doTask();
    thisTimer = new java.util.Timer();
    thisTimer.schedule(a, 0);
    System.out.println("Thread start to sleep first 10 secs");
    Thread.sleep(10000);
    System.out.println("Thread start to sleep second 5 secs");
    Thread.sleep(5000);
    System.out.println("Thread Wake Up");
    a.terminate();
    thisTimer.cancel();
    catch(InterruptedException ie)
    ie.printStackTrace();
    cMain = this.getContentPane();
    cMain.setLayout(null);
    cMain.add(exitBtn);
    cMain.add(startThreadBtn);
    public class doTask extends TimerTask
    JDialog infoDialog;
    public void run()
    System.out.println("TASK IS RUNNING");
    int screenWidth = (int)screenSize.getWidth();
    int screenHeight = (int)screenSize.getHeight();
    int w = 300;
    int h = 200;
    infoDialog = new JDialog(tT, true);
    infoDialog.setTitle("Please Wait!!!");
    Container c = infoDialog.getContentPane();
    c.setLayout(new BorderLayout());
    JLabel infoLbl = new JLabel("Please Wait... Program is sleeping!!!", JLabel.CENTER);
    c.add(infoLbl, BorderLayout.CENTER);
    infoDialog.setBounds((int)((screenWidth-w)/2), (int)((screenHeight-h)/2), w, h);
    infoDialog.setVisible(true);
    public void terminate()
    infoDialog.setVisible(false);
    infoDialog.dispose();
    this.cancel();
    }

    I have done a code below and it is working but the only problem is when the main program start to sleep by use Thread.sleep(10000) for 10 secs and it will prompt out a JDialog contain JLabel inside it with message "Please wait.... program is sleeping.". And when the thread ends the JDialog will auto disappear and it back to the main program.
    The problem is:
    When the JDialog appear, it doesn't show the component so I only be able to view the JDialog window without contain any component. I already use container to add the component into JDialog but it still doesn't show. I only be able to see the JDialog window contain empty component when the main window is sleeping.
    How to make the components also appear in the JDialog when the main program is sleeping?
    Below is the code pls have a try:
    import java.util.*;
    import java.lang.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class testThread extends JFrame
    public static java.util.Timer thisTimer;
    public static doTask a;
    public static testThread tT;
    public Container cMain;
    public Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    public JButton exitBtn;
    public JButton startThreadBtn;
    /** Creates a new instance of testThread */
    public static void main(String args[])
    new testThread();
    public testThread()
    //System.out.println("Start to call JDialog");
    tT = this;
    int realW = (int)screenSize.getWidth();
    int realH = (int)screenSize.getHeight();
    int mainW = 500;
    int mainH = 300;
    setBounds((int)((realW-mainW)/2), (int)((realH-mainH)/2), mainW, mainH);
    setVisible(true);
    exitBtn = new JButton("EXIT");
    exitBtn.setBounds((int)((500-100)/2), (int)((300-50)/5), 100, 50);
    exitBtn.addActionListener
    new ActionListener()
    public void actionPerformed(ActionEvent e)
    System.exit(0);
    startThreadBtn = new JButton("Start Thread");
    startThreadBtn.setBounds((int)((500-100)/2), (int)((300-50)/5*4), 100, 50);
    startThreadBtn.addActionListener
    new ActionListener()
    public void actionPerformed(ActionEvent e)
    try
    System.out.println("Start to call JDialog");
    a = new doTask();
    thisTimer = new java.util.Timer();
    thisTimer.schedule(a, 0);
    System.out.println("Thread start to sleep first 10 secs");
    Thread.sleep(10000);
    System.out.println("Thread start to sleep second 5 secs");
    Thread.sleep(5000);
    System.out.println("Thread Wake Up");
    a.terminate();
    thisTimer.cancel();
    catch(InterruptedException ie)
    ie.printStackTrace();
    cMain = this.getContentPane();
    cMain.setLayout(null);
    cMain.add(exitBtn);
    cMain.add(startThreadBtn);
    public class doTask extends TimerTask
    JDialog infoDialog;
    public void run()
    System.out.println("TASK IS RUNNING");
    int screenWidth = (int)screenSize.getWidth();
    int screenHeight = (int)screenSize.getHeight();
    int w = 300;
    int h = 200;
    infoDialog = new JDialog(tT, true);
    infoDialog.setTitle("Please Wait!!!");
    Container c = infoDialog.getContentPane();
    c.setLayout(new BorderLayout());
    JLabel infoLbl = new JLabel("Please Wait... Program is sleeping!!!", JLabel.CENTER);
    c.add(infoLbl, BorderLayout.CENTER);
    infoDialog.setBounds((int)((screenWidth-w)/2), (int)((screenHeight-h)/2), w, h);
    infoDialog.setVisible(true);
    public void terminate()
    infoDialog.setVisible(false);
    infoDialog.dispose();
    this.cancel();
    }

  • Very intermittent JDialog issue - the panel component is transparent

    Hi,
    I am running JRE/JDK 1.6_06 on Windows XP SP2 and am getting a very intermittent issue
    (happens perhaps 1 out 200 times or so). The issue is that a new JDialog does not show its
    panel component and what should be in the panel is transparent. You see what would be underneath
    the JDialog in the panel. The JDialog itself is visible.
    Here are some additional details.
    1) If I switch to another windows app and then back to my Java App, the contents then display correctly.
    2) As a workaround, I tried repainting the JDialog after it was visible in another Thread but that did not help.
    3) I have my own application tracing to confirm no threading issue involved.
    4) The memory/cpu are all good. This is not a race condition.
    5) There is no signs of trouble in terms of an exception being thrown. The RunTime from Java is
    completely clean. No issues.
    6) If I simply close the JDialog and recreate the JDialog again all is well.
    7) In my code, I null the JDialog instance at the point when the user closes down the dialog.
    (I thought that perhaps some kind of garbage clean up might be involved?)
    I suspect a low-level devise driver type issue between the JVM and Windows.
    I will see if I can reproduce this on Linux.
    If anyone has ever heard of or seen any issue like this before that would be helpful.
    Again, there are no signs of trouble from the Java Runtime. I believe the Runtime is unaware of
    any issue. I simply do not see the contents of the dialog. Again very intermittent. Hard to reproduce.
    Let me know if I you need additional details. This is just to get going on this issue.
    Thanks.
    David Bardwell

    Here is an update as I guess this problem is very deep and I will need to come up with a
    test case for a real Swing bug and file a bug with Sun.
    The problem does not reproduce with JRE 1.5.0_15 on Windows in exhaustive testing.
    Before I launch the dialog where I see a transparent panel, I have a database query which
    is done in worker thread. I show the user a panning wait dialog which they can use to cancel
    the query. It appears that this extra work of the panning dialog is important in having this issue
    occur. If I simply do all the work in a single thread, I have not seen the issue reproduce. But again,
    it is not always easy to get the issue to reproduce.
    At this time, I suspect a threading issue (bug) which causes this issue.
    Thanks for at least reading about my issue. I will update this item as I have more information so
    that I can share what I learn with any interested readers.

  • Clicking mouse after closing JDialog sends event to last component (1.1.8)

    There seems to be a bug in Java 1.1.8 that I'm looking for a workaround.
    I have a JButton on a JFrame that brings up a modal JDialog when you click it. After closing the dialog, if you click on the JFrame without moving the mouse, it will click the button on the frame that was last clicked, even if the mouse is not over the button.
    Steps to reproduce:
    1. Use the mouse to click on the button on the frame to bring up the dialog.
    2. Close the dialog with the mouse or keyboard and don't move the mouse at all. (Note that the mouse should be over the JFrame at this point, but not over the frame's button.)
    3. Click the mouse again.
    Result:
    This causes the button on the frame to be clicked.
    It seems as if the frame thinks that the mouse pointer is located where it was when the dialog came up.
    Does anyone know how to prevent this from happening or a workaround?

    We are using 1.1.8 because our product has to run on Mac OS 8.x - 9.x (and this is the latest JRE supported by these platforms).
    When I say don't move the mouse, what I mean is when closing the dialog, if you don't move the mouse, it doesn't matter where the mouse pointer is, as long as it's over the frame. When you click it, the last button to get clicked will be clicked again. It's as if the frame thinks that the mouse hasn't moved since the dialog came up. This isn't a focus problem because if I set the focus on another control after opening the dialog (by calling requestFocus()), this problem still happens. I can also tab to another control after closing the dialog, but when clicking the mouse it still clicks the last button that was clicked. It's as if the frame needs to reset where the mouse position is when it becomes activated.

  • Problem with JDialogs

    Hi All,
    I have a problem with JDialogs in my standalone application. This app pops-up multiple JDialogs, say a stack of JDialogs.
    I have a standalone application which runs as a JFrame, call it JFrame1, which is working fine. JFrame1 pops-up a JDialog, on some button click on JFrame1, call it JDialog1, which is also working fine. Now JDialog1 pops-up another JDialog, again on some button click on JDialog1, call it JDialog2, which is too working fine. But, after I finish with JDialog2 and dispose it my JDialog1 is not working fine, though that is the front dialog at present.
    Any ideas why JDialog1 is not working fine? Am I missing anything?
    Thanks,
    Srinivas.

    Hi,
    I have a component called DateComponent that works similar to a JComboBox. When you click a small button of DateComponent, it pops-up a Calendar similar to the drop down list of JComboBox and user can pick a date from it. It gets closed when it loses focus.
    I have this DateComponent on JFrame1, JDialog1 and JDialog2. The Calendar is not being diaplayed on JDialog1 upon clicking the small button of DateComponent after JDialog2 is disposed. But it is being diaplayed properly on JDialog1 before JDialog1 opens JDialog2. What could be wrong?
    I am using JDK1.3.1.
    Thanks,
    Srinivas.

  • Problem with refreshing JFrames and JDialogs

    My program is based on few JDialogs and one JFrame. I'm still changing them, one time one of the JDialogs is visible, other time JFrame. During this change I call dispose() for one window or frame and I create (if it wasn't created before) other component and call setVisible(true) for it. Problem is that sometimes (only sometimes! like 5% of calls) my windows appears but they are not refreshing (not showing new objects added to their lists or sth like that) until I resize my window by dragging mouse on the edge of it. Is there anyway to ensure that window will be displayed properly?

    I ran into this problem about a year ago...so I don't really remember but I think a call to validate(), or paint() or repaint() or something like that should do the trick (forgive me for not knowing the exact one but as I said it has been a while). Its been about that year since I stopped coding in java and moved to c#. You want the window to redraw its self what ever that is.

  • How can I change the layout on this JDialog?

    Hi , I have the following Dialog with some content. As of now, the line after the separator is displayed in two lines. I was looking for a way to show that in one line and change the column widths a bit so that the rest of the content can each be shown on one line as well, according to the look and feel of a table.
    Here's the code:Please download [TableLayout.jar|http://java.sun.com/products/jfc/tsc/articles/tablelayout/apps/TableLayout.jar] in order to compile.
    Thanks!
    import layout.TableLayout;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSeparator;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextPane;
    import javax.swing.text.StyledEditorKit;
    public class MyDialogTest implements layout.TableLayoutConstants {
         JTabbedPane pane;
         JDialog myDialog;
         JTextPane infoPanel;
        public MyDialogTest() {
             myDialog = new JDialog();
             myDialog.setTitle("MyDialogTest");
             pane = new JTabbedPane();
             JPanel panel = new JPanel(new BorderLayout());
             panel.add(makeTab(), BorderLayout.CENTER);
             pane.addTab("About", panel);
             myDialog.getContentPane().add(pane);
             myDialog.setSize(500, 620);
             myDialog.setResizable(false);
             myDialog.setVisible(true);
        private Component makeTab() {
             JPanel aboutPanel = new JPanel();
            double [][] size = {{PREFERRED, FILL},{PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED, PREFERRED, FILL}};
            TableLayout layout = new TableLayout(size);
            aboutPanel.setLayout(layout);
            JLabel headerLabel = new JLabel("About This Application");
            aboutPanel.add(headerLabel, "0, 0, 1, 0");
            aboutPanel.add(new JLabel("Version 4.1"), "0, 1, 1, 1");
            aboutPanel.add(new JLabel(" "), "0, 2, 1, 2");
            aboutPanel.add(new JLabel("Customer Service: 1-800-888-8888"), "0, 3, 1, 3");
            JLabel yahooUrl = new JLabel("www.yahoo.com");
            aboutPanel.add(yahooUrl, "0, 4");
            aboutPanel.add(new JLabel(" "), "0, 5");
            aboutPanel.add(new JSeparator(), "0, 6, 1, 6");
            aboutPanel.add(new JLabel(" "), "0, 7");
            infoPanel = new JTextPane();
            infoPanel.setEditable(false);
            infoPanel.setEditorKit(new StyledEditorKit());
            infoPanel.setContentType("text/html");
            makeInfoPanel();
            aboutPanel.add(infoPanel, "0, 8, 1, 8");
            JButton copyToClipboardButton = new JButton("Button1");
            JButton moreInformationButton = new JButton("Button2");
            JPanel buttonPanel = new JPanel();
            buttonPanel.add(copyToClipboardButton);
            buttonPanel.add(moreInformationButton);
            aboutPanel.add(buttonPanel, "0, 9");
            return aboutPanel;
        private void makeInfoPanel() {
              StringBuffer infoPaneContent = new StringBuffer("<html><head></head><body><table>");
              infoPaneContent.append("<tr><td>Version 4.1 (build  111708-063624"+ "</td></tr>");
              infoPaneContent.append("<tr><td>Customer IP Address:</td>&nbsp <td>10.53.62.11</td></tr>");
              infoPaneContent.append("<tr><td>JMS Server:</td>&nbsp <td>myserver</td></tr>");
              infoPaneContent.append("<tr><td>Quote Server:</td>&nbsp <td>qs2w62m3/qs106w60m3</td></tr>");
              infoPaneContent.append("<tr><td>Login ID:</td>&nbsp <td>programmer girl</td></tr>");
              infoPaneContent.append("<tr><td>Java Version:</td> &nbsp<td>"+ System.getProperty("java.version") + "</td></tr>");
              infoPaneContent.append("<tr><td>Operating System:</td> &nbsp<td>"+ System.getProperty("os.name") + " "+ System.getProperty("os.version") + " ("+ ")" + "</td></tr>");
             infoPaneContent.append("<tr><td>Browser Version:</td>&nbsp <td>"+ "Mozilla/4.0(compatible: MSIE 6.0; Windows NT 5.1; SV!; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648" + "</td></tr>");
              Runtime rt = Runtime.getRuntime();
              infoPaneContent.append("<tr><td>Free Memory (KB):</td>&nbsp <td>("+ rt.freeMemory() / 1000 + " / " + rt.totalMemory() / 1000+ ")</td></tr>");
              infoPaneContent.append("<tr><td>Symbols In Use:</td>&nbsp<td>symbol</td></tr>");
              infoPaneContent.append("<tr><td>JMS :</td>&nbsp<td>connected</td></tr>");
              infoPaneContent.append("<tr><td>Market Data :</td>&nbsp<td>connected</td></tr>");
              infoPaneContent.append("<tr></tr>");
              infoPaneContent.append("<tr></tr>");
              infoPaneContent.append("</table></body></html>");
              infoPanel.setText(infoPaneContent.toString());
         public static void main(String[] args) {
              MyDialogTest test = new MyDialogTest();
    }

    Just sign out and sign in with your UK Apple ID
    Edit: If you press your name on this page (top left), you get "Actions" on the right side. Here you can change timezone, location etc.

  • How do i check if an JInternalFrame is in a DesktopPane?

    Hey boys and girls :D
    I have a JDesktopPane which controls my layout. I add JInternalFrames to the desktopPane everytime i open a new window. The problem is when i open a window, close it and then open it again, then i get the following error:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
    So my thought is that i could check if the frame im trying to open, allready is in the desktopPane, then i could just set that frame visible and leave the desktop.add(frame) out.
    The code im talking about is this and it doesnt work with the isVisible() i want to replace that with something which checks if the frame allready is in the desktopPane.
    Isnt it the way to do it?
    private void createItemMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                                  
            CreateItemGUI frame = control.getCreateItemGUI();
            if(frame.isVisible()){
                frame.setVisible(false);
            }else{
                frame.setVisible(true);
                desktopPane.add(frame);
        }  And the whole code:
    * MainGUI.java
    * Created on 13. april 2008, 11:46
    package userclasses;
    import javax.swing.JInternalFrame;
    * @author  Jesper Johnsen
    public class MainGUI extends javax.swing.JFrame {
        private Katrinelund control;
        /** Creates new form MainGUI */
        public MainGUI(Katrinelund control) {
            this.control = control;
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            desktopPane = new javax.swing.JDesktopPane();
            jMenuBar1 = new javax.swing.JMenuBar();
            FileMenu = new javax.swing.JMenu();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenuItem2 = new javax.swing.JMenuItem();
            jMenuItem3 = new javax.swing.JMenuItem();
            itemControlMenu = new javax.swing.JMenu();
            searchItemMenuItem = new javax.swing.JMenuItem();
            createItemMenuItem = new javax.swing.JMenuItem();
            customerControlMenu = new javax.swing.JMenu();
            searchCustomerMenuItem = new javax.swing.JMenuItem();
            createCustomerMenuItem = new javax.swing.JMenuItem();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Katrinelind administration");
            setBounds(new java.awt.Rectangle(0, 0, 2000, 800));
            desktopPane.setBackground(new java.awt.Color(255, 255, 255));
            FileMenu.setText("File");
            jMenuItem1.setText("?bn");
            FileMenu.add(jMenuItem1);
            jMenuItem2.setText("Luk");
            jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem2ActionPerformed(evt);
            FileMenu.add(jMenuItem2);
            jMenuItem3.setText("Vis Frames");
            jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    showFrames(evt);
            FileMenu.add(jMenuItem3);
            jMenuBar1.add(FileMenu);
            itemControlMenu.setText("Varestyring");
            searchItemMenuItem.setText("S?g vare(r)");
            searchItemMenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    searchItemMenuItemActionPerformed(evt);
            itemControlMenu.add(searchItemMenuItem);
            createItemMenuItem.setText("Tilf?j vare");
            createItemMenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    createItemMenuItemActionPerformed(evt);
            itemControlMenu.add(createItemMenuItem);
            jMenuBar1.add(itemControlMenu);
            customerControlMenu.setText("Kundestyring");
            searchCustomerMenuItem.setText("S?g kunde(r)");
            customerControlMenu.add(searchCustomerMenuItem);
            createCustomerMenuItem.setText("Tilf?j kunde");
            customerControlMenu.add(createCustomerMenuItem);
            jMenuBar1.add(customerControlMenu);
            setJMenuBar(jMenuBar1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1273, Short.MAX_VALUE)
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 778, Short.MAX_VALUE)
            pack();
        }// </editor-fold>
        private void searchItemMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                                  
            SearchGUI frame = control.getSearchGUI();
            frame.setVisible(true);
            desktopPane.add(frame);
        private void createItemMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                                  
            CreateItemGUI frame = control.getCreateItemGUI();
            if(frame.isVisible()){
                frame.setVisible(false);
            }else{
                frame.setVisible(true);
                desktopPane.add(frame);
        private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
            quit();
        private void showFrames(java.awt.event.ActionEvent evt) {
            System.out.println(desktopPane.getComponents());
        public void addFrameToDesktop(JInternalFrame frame){
            frame.setVisible(true);
            desktopPane.add(frame);
        public void quit(){
            System.exit(0);
        // Variables declaration - do not modify
        private javax.swing.JMenu FileMenu;
        private javax.swing.JMenuItem createCustomerMenuItem;
        private javax.swing.JMenuItem createItemMenuItem;
        private javax.swing.JMenu customerControlMenu;
        private javax.swing.JDesktopPane desktopPane;
        private javax.swing.JMenu itemControlMenu;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JMenuItem jMenuItem2;
        private javax.swing.JMenuItem jMenuItem3;
        private javax.swing.JMenuItem searchCustomerMenuItem;
        private javax.swing.JMenuItem searchItemMenuItem;
        // End of variables declaration
    }

    In future, Swing related questions should be posted in the [Swing forum|http://forum.java.sun.com/forum.jspa?forumID=57]
    Your code cannot be compiled and run as it has references to classes not part of the standard JDK. To get better help sooner, post a SSCCE that clearly demonstrates your problem.
    db

  • How to load a background Image on a JDialog object

    Hi All, Actually i am new to java programing and i am stuck in this problem. I am developing a java application which is dialog based (using JDialog objects) and i want to load a background image on my dialog. I hope this could be done and i really appreciate your help because i must deliver this project and this is a user interface requirement.

    Try something along the lines of this: Create a new class called BackgroundImagePanel and have it extend JPanel.
    Have an attribute in the class for your image, and a method to set it.
    Override isOpaque() to return true.
    Override the paintComponenet method as such:
    public void paintComponent (Graphics g) {
    super.paintComponent(g);
    if( image == null ) return;
    Icon icon = new ImageIcon(image);
    icon.paintIcon(this, g, x, y);
    Add this panel to your JDialog and then add other component to this panel.
    You might have to tweak this a bit, but it should get you close...
    Bill

Maybe you are looking for

  • "Ask for Finder Items" Automator action broken?

    OK, I'm pulling my hair out on Automator (again). I'm on OS X Lion 10.7.1. Here's what I want to do: I have image files named "something-something (S1).png" and I want to create a copy of each file named "something-something (S2).png" then resize tha

  • Development Tools: Which of them i really need?

    Hi, guys! I've just started to learn Java language & gonna develop midlets for most modern wireless devices. Please tell me what tools i really need to download. I've already downloaded Wireless Toolkit (with latest patch) & JRE. I guess i need some

  • How do I get an app to request access to photos?

    I have a USMLE world App which requires access to my photos in order to work.  However, when I access Settings >privacy>photos, the app is not listed as requesting access.  It is also not listed as an app under "settings".

  • Vectors : Converting to double[ ] array

    Hello, I have a vector which I know consists of double values only. I am trying to create an array of double from this vector but am having some difficulty. Firstly if I try this : double[] high = (double[])datavector.high.toArray(new double[0]);JBui

  • Group Web-Calendar, how does one edit an event's 'Notes'?

    I have an OSX Leopard server hosting several Group Calendars. One question I keep getting is how to edit the 'Notes' section of a web event. When you hover over an event in the Web Calendar, the last field of information presented is 'Notes'. Clickin