public void run() { Logger.log(Logger.DEBUG, "[ShowFileDialogOperation][run] Enter"); // set up the dialog m_frame = new Frame(""); m_fileDialog = new FileDialog(m_frame, m_title, m_mode); // centre the dialog Toolkit kit = m_fileDialog.getToolkit(); Dimension screenSize = kit.getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; Dimension dialogSize = m_fileDialog.getSize(); int dialogWidth = dialogSize.width; int dialogHeight = dialogSize.height; Dimension frameSize = m_frame.getSize(); int frameWidth = frameSize.width; int frameHeight = frameSize.height; //The dialog and frame report their width and height as 0. Regardless //of screen resolution the dialog's observed demensions are aproximately //256/400. We set the frame and dialog demensions to this if thier //demensions are 0. This way if non zero numbers are reported we can //start to use them. Until then the dialog will be more or less //centered. We do this for both the frame and the dialog because //Netscape cares about the location of the frame and IE cares about the //location of the filedialog. if (dialogWidth == 0 || dialogHeight == 0) { dialogWidth = 400; dialogHeight = 256; } if (frameWidth == 0 || frameHeight == 0) { frameWidth = 400; frameHeight = 256; } int frameUpperLeftX = (screenWidth - frameWidth) / 2; int frameUpperLeftY = (screenHeight - frameHeight) / 2; m_frame.setLocation(frameUpperLeftX, frameUpperLeftY); int dialogUpperLeftX = (screenWidth - dialogWidth) / 2; int dialogUpperLeftY = (screenHeight - dialogHeight) / 2; m_fileDialog.setBounds(dialogUpperLeftX, dialogUpperLeftY, dialogWidth, dialogHeight); //-------------------------------------------------------------- if (null != m_defaultDisplayValue && 0 != m_defaultDisplayValue.length()) { m_fileDialog.setFile(m_defaultDisplayValue); } if (null != m_suffix && 0 != m_suffix.length()) { m_fileDialog.setFilenameFilter(this); } m_fileDialog.setVisible(true); Logger.log(Logger.DEBUG, "[ShowFileDialogOperation][run] file selected"); m_frame.dispose(); Logger.log(Logger.DEBUG, "[ShowFileDialogOperation][run] disposed"); String dir = m_fileDialog.getDirectory(); Logger.log(Logger.DEBUG, "[ShowFileDialogOperation][run] dir[" + dir + "]"); String file = m_fileDialog.getFile(); Logger.log(Logger.DEBUG, "[ShowFileDialogOperation][run] file[" + file + "]"); if (dir != null && file != null) { m_fileNameAndPath = dir + file; } Logger.log(Logger.DEBUG, "[ShowFileDialogOperation][run] Exit"); }