-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1
-
x86
-
windows_95
Name: sgC58550 Date: 05/29/97
After selecting a file in a FileDialog I print out the
returned information. _Sometimes_ I get garbled file- and
directory names, e.g. the output of the test program looks like:
File: ass.
but the expected output is:
File: NumberAnalyse.classE:\Javawdi\NumberAnalyse
Working directory is: E:\Javawdi\NumberAnalyse
Selcted file in FileDialog is: NumberAnalyse.class
Is there a bug or is it a problem in my test program?
regards
Werner Dittmann
Mail: ###@###.###
Here the source code of the simple test application:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class FileSelection implements ActionListener {
FileSelection() {
}
public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();
System.out.println("Menu Action Command: " + arg);
Frame fr = new Frame();
FileDialog fd = new FileDialog(fr);
// fr.setSize(300, 300);
// fr.show();
fd.setMode(FileDialog.LOAD);
fd.show();
arg = fd.getFile();
System.out.println("File: " + arg + fd.getDirectory());
fd.dispose();
fr.dispose();
}
}
public class NumberGUI extends Applet implements
WindowListener, ActionListener {
Frame fr;
NumberGUI(Frame f) {
fr = f;
}
public void init() {
// System.out.println(" In init()");
}
public void start() {
// System.out.println(" In start()");
}
public void stop() {
// System.out.println(" In stop()");
}
public void windowOpened(WindowEvent e) {
// System.out.println("In WindowOpened event");
}
public void windowClosing(WindowEvent e) {
// System.out.println("In WindowClosing event");
e.getWindow().dispose();
}
public void windowClosed(WindowEvent e) {
// System.out.println("In WindowClosed event");
System.exit(0);
}
public void windowIconified(WindowEvent e) {
// System.out.println("In WindowClosed event");
}
public void windowDeiconified(WindowEvent e) {
// System.out.println("In WindowDeiconified event");
}
public void windowActivated(WindowEvent e){
// System.out.println("In WindowActivated event");
}
public void windowDeactivated(WindowEvent e) {
// System.out.println("In WindowDeactivated event");
}
public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();
System.out.println("Menu Action Command: " + arg);
fr.dispose();
System.exit(0);
}
public static void main(String args[]) {
Frame f = new Frame("Number Analysis");
FileSelection fileSelect = new FileSelection();
NumberGUI numberGUI = new NumberGUI(f);
MenuBar mb = new MenuBar();
Menu mnu = new Menu("File");
MenuItem mi = new MenuItem("Open...");
mi.addActionListener(fileSelect);
mi.setActionCommand("OPN");
mnu.add(mi);
mi = new MenuItem("Exit");
mi.addActionListener(numberGUI);
mi.setActionCommand("EXT");
mnu.add(mi);
mb.add(mnu);
numberGUI.init();
numberGUI.start();
f.addWindowListener(numberGUI);
f.setMenuBar(mb);
f.add("Center", numberGUI);
f.setSize(300, 300);
f.show();
}
}
======================================================================
After selecting a file in a FileDialog I print out the
returned information. _Sometimes_ I get garbled file- and
directory names, e.g. the output of the test program looks like:
File: ass.
but the expected output is:
File: NumberAnalyse.classE:\Javawdi\NumberAnalyse
Working directory is: E:\Javawdi\NumberAnalyse
Selcted file in FileDialog is: NumberAnalyse.class
Is there a bug or is it a problem in my test program?
regards
Werner Dittmann
Mail: ###@###.###
Here the source code of the simple test application:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class FileSelection implements ActionListener {
FileSelection() {
}
public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();
System.out.println("Menu Action Command: " + arg);
Frame fr = new Frame();
FileDialog fd = new FileDialog(fr);
// fr.setSize(300, 300);
// fr.show();
fd.setMode(FileDialog.LOAD);
fd.show();
arg = fd.getFile();
System.out.println("File: " + arg + fd.getDirectory());
fd.dispose();
fr.dispose();
}
}
public class NumberGUI extends Applet implements
WindowListener, ActionListener {
Frame fr;
NumberGUI(Frame f) {
fr = f;
}
public void init() {
// System.out.println(" In init()");
}
public void start() {
// System.out.println(" In start()");
}
public void stop() {
// System.out.println(" In stop()");
}
public void windowOpened(WindowEvent e) {
// System.out.println("In WindowOpened event");
}
public void windowClosing(WindowEvent e) {
// System.out.println("In WindowClosing event");
e.getWindow().dispose();
}
public void windowClosed(WindowEvent e) {
// System.out.println("In WindowClosed event");
System.exit(0);
}
public void windowIconified(WindowEvent e) {
// System.out.println("In WindowClosed event");
}
public void windowDeiconified(WindowEvent e) {
// System.out.println("In WindowDeiconified event");
}
public void windowActivated(WindowEvent e){
// System.out.println("In WindowActivated event");
}
public void windowDeactivated(WindowEvent e) {
// System.out.println("In WindowDeactivated event");
}
public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();
System.out.println("Menu Action Command: " + arg);
fr.dispose();
System.exit(0);
}
public static void main(String args[]) {
Frame f = new Frame("Number Analysis");
FileSelection fileSelect = new FileSelection();
NumberGUI numberGUI = new NumberGUI(f);
MenuBar mb = new MenuBar();
Menu mnu = new Menu("File");
MenuItem mi = new MenuItem("Open...");
mi.addActionListener(fileSelect);
mi.setActionCommand("OPN");
mnu.add(mi);
mi = new MenuItem("Exit");
mi.addActionListener(numberGUI);
mi.setActionCommand("EXT");
mnu.add(mi);
mb.add(mnu);
numberGUI.init();
numberGUI.start();
f.addWindowListener(numberGUI);
f.setMenuBar(mb);
f.add("Center", numberGUI);
f.setSize(300, 300);
f.show();
}
}
======================================================================
- relates to
-
JDK-4420632 jdk1.3.1 rc1-b18: solaris: pasting from clipboard in FileDialog crashes VM
-
- Resolved
-