Hi I apologise for my english.
But I believe that I can help you
Frame Dialogo= new Frame();
FileDialog d = new FileDialog(Dialogo,"Abrir Encuesta");
d.setVisible(true);
String fname=d.getFile();
This is a java code for open file. If you modify this code, for example add 2 buttons in frame.
After you must create action listener events for buttons.
Other java code for ErrorMessage or ErrorDialog is follow
import java.awt.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author Eduardo Bieñkowski
* @version 1.0
*/
public class ErrorDialog extends Dialog {
public ErrorDialog(Frame parent, boolean modal)
{
super(parent, modal);
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(null);
setVisible(false);
setSize(249,150);
setBackground(new Color(-4198403));
label1 = new java.awt.Label();
label1.setBounds(40,35,166,21);
label1.setBackground(new Color(-4198403));
add(label1);
okButton = new java.awt.Button();
okButton.setLabel("OK");
okButton.setBounds(95,85,66,27);
okButton.setBackground(new Color(12632256));
add(okButton);
setTitle("About");
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
okButton.addActionListener(lSymAction);
//}}
}
public ErrorDialog(Frame parent, boolean modal, String titulo)
{
super(parent, modal);
//es la copia del constructor del visualcafe pero con el tÃtulo de la etiqueta para agregarlo
//{{INIT_CONTROLS
setLayout(null);
setVisible(false);
setSize(249,150);
setBackground(new Color(-4198403));
label1 = new java.awt.Label(titulo);
label1.setBounds(40,35,166,23);
label1.setBackground(new Color(-4198403));
add(label1);
okButton = new java.awt.Button();
okButton.setLabel("OK");
okButton.setBounds(95,85,66,27);
okButton.setBackground(new Color(12632256));
add(okButton);
setTitle("Error");
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
okButton.addActionListener(lSymAction);
//}}
}
public ErrorDialog(Frame parent, String title, boolean modal)
{
this(parent, modal);
setTitle(title);
}
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension d = getSize();
super.addNotify();
// Only do this once.
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
Component components[] = getComponents();
for (int i = 0; i < components.length; i++)
{
Point p = components[i].getLocation();
p.translate(getInsets().left, getInsets().top);
components[i].setLocation(p);
}
// Used for addNotify check.
fComponentsAdjusted = true;
}
public void setVisible(boolean b)
{
if (b)
{
Rectangle bounds = getParent().getBounds();
Rectangle abounds = getBounds();
setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
bounds.y + (bounds.height - abounds.height)/2);
}
super.setVisible(b);
}
//{{DECLARE_CONTROLS
java.awt.Label label1;
java.awt.Button okButton;
//}}
// Used for addNotify check.
boolean fComponentsAdjusted = false;
class SymWindow extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == ErrorDialog.this)
AboutDialog_WindowClosing(event);
}
}
void AboutDialog_WindowClosing(java.awt.event.WindowEve nt event)
{
dispose();
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == okButton)
okButton_Clicked(event);
}
}
void okButton_Clicked(java.awt.event.ActionEvent event)
{
//{{CONNECTION
// Clicked from okButton Hide the Dialog
dispose();
//}}
}
}
regards
Eduardo since Uruguay
[email protected]
Edduardo B.
Montevideo
Uruguay