I've been successful creating an application that works both as an 
applet and as a client. I also have had no problems displaying JDialog's 
as well.  What I now would like to do is create a base XDlg class that 
will deal with the vast majority of my dozen plus JDialog's. By design, 
each XML file would consistently name the variables. So, JDialog is 
_dialog, and the (optional) ok/cancel JButton's _ok and _can. This 
approach works perfectly as a client application. However, as an applet, 
none of the variables are "discovered".

Is there a workaround/solution to this? Thanks.

Steve
-------------------------------------------------------
public class XDlg {
   protected   boolean     _saved;
   public      SwingEngine _se;
   public      JDialog     _dialog;
   public      JButton     _ok, _can;
  
   XDlg(URL url)
   {
       _se = new SwingEngine(this);
       render(url);
   }
  
   XDlg()
   {
   }
  
   protected void render(URL url)
   {
       try {
           _se.render(url);
       } catch (Exception e) { e.printStackTrace(System.out); 
D.fatal(e.toString()); }
   }
  
   public Action a_ok = new AbstractAction() {
       public void actionPerformed(ActionEvent e) {
           ok();
   }};
  
   public Action a_can = new AbstractAction() {
       public void actionPerformed(ActionEvent e) {
           can();
   }};
  
   public void ok()
   {
       save();
       setVisible(false);
   }
  
   public void can()
   {
       setVisible(false);
   }
  
   public void save()
   {
       _saved = true;
   }
  
   public void setVisible(boolean v)
   {
       if (_dialog != null)
           _dialog.setVisible(v);
   }
  
   public void show()
   {
       if (_ok != null)
           _dialog.getRootPane().setDefaultButton(_ok);
  
       _dialog.pack();
       _dialog.setVisible(true);
   }
}

public class Foo extends XDlg
{
   public JButton _customButton;

   Foo()
   {
     super(new URL(xxx));
     show();
   }
}


_______________________________________________
Forum mailing list
Forum@carlsbadcubes.com
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com

Reply via email to