Hello!
I'm beginner in JACL (I don't use Tcl). I have this problem. In java I
crete some class called Loging that consist of JFrame, JLabels and
JTextField. That's OK. Then I create LogingCmd and LogingExtension
classes to Loging class can be accessible from shell.
In Loging class I've method
public static JFrame getFrame(Interp interp, TclObject tobj)
If user want to getFrame from shell I want to create command. I think I
must add some code to  LogingCmd, but I don't know what. I've tried
this:
        if ("getFrame".startsWith(argv[1].toString())) {
            JFrame f = Loging.getFrame(interp, argv[0]);
            interp.setResult(f);
        }
but compiler writes me: Incompatible type .. can't convert JFrame to
boolean.
Why? I don't need any boolean!

Can anybody help me?
Thanks
    Lubos Vrba
    [EMAIL PROTECTED]

Here is all important sources:
/** Loging.java */
.
.
public class Loging extends InternalRep{
    private JFrame frame;
    private Container cont;
    private Label name_l;
    private Label pass_l;
    private JTextField name_f;
    private JPasswordField pass_f;

    private Loging () {
        frame = new JFrame("Loging");
        cont = frame.getContentPane();
        cont.setLayout(new GridLayout(1,4));
        name_l = new Label("Your name:");
        pass_l = new Label("Your password:");
        name_f = new JTextField(10);
        pass_f = new JPasswordField(15);
        cont.add(name_l);
        cont.add(name_f);
        cont.add(pass_l);
        cont.add(pass_f);
    }

    private Loging (Interp interp) throws TclException {
        frame =  new JFrame("Loging");
        cont = frame.getContentPane();
        cont.setLayout(new GridLayout(1,4));
        name_l = new Label("Your name:");
        pass_l = new Label("Your password:");
        name_f = new JTextField(10);
        pass_f = new JPasswordField(15);
        cont.add(name_l);
        cont.add(name_f);
        cont.add(pass_l);
        cont.add(pass_f);
    }
  public static TclObject newInstance() {
        return new TclObject(new Loging());
    }

   public static JFrame getFrame(Interp interp, TclObject tobj) throws
TclException {
        InternalRep rep = tobj.getInternalRep();
        Loging loging;
        if (rep instanceof Loging) {
            loging = (Loging) rep;
        } else {
            setLogingFromAny(interp, tobj);
            loging = (Loging) (tobj.getInternalRep());
        }
        return loging.frame;
    }
.
.
}

/*LogingCmd.java*/
public class LogingCmd implements Command {
    public void cmdProc(Interp interp, TclObject argv[]) throws
TclException {
        if (argv.length != 2) {
            throw new TclNumArgsException(interp, 1,argv,"method
argument");
        }
        if ("create".startsWith(argv[1].toString())) {
            if (argv.length != 2) {
                throw new TclNumArgsException(interp, 1, argv,
                                              argv[1] + " no arguments
needed!");
            }

            interp.setResult(Loging.newInstance());
        }

        if ("getFrame".startsWith(argv[1].toString())) {
            JFrame f = Loging.getFrame(interp, argv[0]);
            interp.setResult(f);
        }
    }
}

/*LogingExtension.java*/
public class LogingExtension extends Extension {

    /*
     * Create all the commands in the Loging package
     */

    public void init(Interp interp) {
        interp.createCommand("loging", new LogingCmd());
    }
}



----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to