Hi,

after attempting this snippet of code provided by Carlos, it seems that java-linux 
allows resizing
of this Dialog despite the setResizable( false ) call, while java in winNT doesn't do 
so.
I tried it with jdk116v5 and netscape 4.5 on linux and netscape 4.5, MSIE4.01, sun 
jdk1.1.6 and
microsoft sdk3.1 on Windoze

I thing that this looks like a bug.
I tried chainging the layout to grid layout and flow layout as well, but the virtual 
machine seems
to refractory to manage ;-}.

Dimitris.

Carlos Alberto Roman Zamitiz wrote:

> Hi,
> Here's the code:
>
> import java.awt.Dialog;
> import java.awt.Color;
> import java.awt.Button;
> import java.awt.GridBagLayout;
> import java.awt.GridBagConstraints;
> import java.awt.Event;
> import java.awt.Panel;
> import java.awt.Graphics;
> import java.awt.Frame;
> import java.awt.Label;
> import java.awt.Dimension;
> import java.awt.event.ActionListener;
>
> // Class AlertDialog begins
> class AlertDialog extends Dialog implements ActionListener
> {
>  Label texto;
>  Button okButton;
>  Button cancelButton;
>  static String indicador;
>
>  // AlertDialog's constructor, which contains a message and 2 buttons
>  public AlertDialog(Frame parent,String titulo,String texto)
>  {
>   super(parent,titulo,true); // AlertDialog calls Dialog.
>   setBackground(Color.white);
>   setResizable(false); // AlertDialog can't resize
>
>   GridBagLayout gridbag=new GridBagLayout();
>   GridBagConstraints constraints=new GridBagConstraints();
>   setLayout(gridbag);
>
>   setSize(new Dimension(350,190));
>
>   // Etiqueta con el mensaje
>   buildConstraints(constraints,0,0,2,2,100,60);
>   constraints.fill=GridBagConstraints.BOTH;
>   constraints.anchor=GridBagConstraints.CENTER;
>   this.texto=new Label();
>   this.texto.setText(texto);
>   this.texto.setAlignment(Label.CENTER);
>   gridbag.setConstraints(this.texto,constraints);
>   add(this.texto);
>
>   // Boton de Aceptar
>   buildConstraints(constraints,0,2,1,1,50,40);
>   constraints.fill=GridBagConstraints.NONE;
>   constraints.anchor=GridBagConstraints.EAST;
>   okButton = new Button("Aceptar");
>   gridbag.setConstraints(okButton,constraints);
>   okButton.addActionListener(this);
>   add(okButton);
>
>   // Boton de Cancelar
>   buildConstraints(constraints,1,2,1,1,50,0);
>   constraints.fill=GridBagConstraints.NONE;
>   constraints.anchor=GridBagConstraints.WEST;
>   cancelButton = new Button("Cancelar");
>   gridbag.setConstraints(cancelButton,constraints);
>   cancelButton.addActionListener(this);
>   add(cancelButton);
>
>   show();
>  }
>
>  public void buildConstraints(GridBagConstraints gbc,int gx,int gy,int gw,int gh,int 
>wx,int wy)
>  {
>   gbc.gridx=gx;
>   gbc.gridy=gy;
>   gbc.gridwidth=gw;
>   gbc.gridheight=gh;
>   gbc.weightx=wx;
>   gbc.weighty=wy;
>  }
>
>  public void actionPerformed(ActionEvent evento)
>  {
>   Button botonEvento=(Button)evento.getSource();
>   if(botonEvento.getLabel().equals("Aceptar"))
>   {
>    indicador="acepta";
>    setVisible(false);
>   }
>   else if(botonEvento.getLabel().equals("Cancelar"))
>   {
>    indicador="rechaza";
>    setVisible(false);
>   }
>  }
> }
>
> Carlos Alberto Roman Zamitiz
> Departamento de Ingenieria en Computacion, Facultad de Ingenieria UNAM
> [EMAIL PROTECTED]
>
> On Sun, 25 Oct 1998, Dimitris Vyzovitis wrote:
>
> > Could you elaborate a bit?
> >
> > Dimitris
> >
> > > I have other problem: I done an AlertDialog, a child of Dialog, which is a
> > > modal Dialog. I'm using Netscape 4.07 and my Linux box has
> > > "Linux_JDK_1.1.5_v7" but users can resize my AlertDialog.
> > >
> > > Any suggestions? Thanks!
> >

--
Dimitrios Vyzovitis      -- Information Processing Laboratory
[EMAIL PROTECTED] -- Aristotle University of Thessaloniki
[EMAIL PROTECTED] -- Dept. of Electrical and Computer Engineering
                            http://egnatia.ee.auth.gr/~dviz


Reply via email to