Menu

#7 setTitle for JFRame in Swing.scm

closed
None
5
2004-05-26
2002-08-16
Bill Hale
No

First, I am not compiling Swing.scm to java.
I am just loading Swing.scm itself.

I noticed that setTitle for JFrame does not work.

I saw two problems.

1) Since JFrame is a component, the following
case statement will detect JFrame as only
a component, not as a JFrame:

=========================================
(define (processConArgs c as)
(define (processConArg c a)
(class-case (c a)
((java.awt.Component java.lang.String)
(writestring c a))
....
=========================================

2) But, even that would not be so bad
if "writestring c a" would handle
the JFrame component, possibly like:

=========================================
(define (writeOneString Comp Arg)
(class-case (Comp)
((javax.swing.JFrame) (.setTitle Comp (.toString
Arg)))
((javax.swing.JButton) (.setLabel Comp (.toString
Arg)))
....
=========================================

Also, changes for "readOneString" should
handle JFrame also.

If changes like the above are done,
then "processConArgs" would not need the
statement:

=========================================
((javax.swing.JFrame java.lang.String)
(.setTitle c a))
=========================================

-- Bill Hale

Discussion

  • Bill Hale

    Bill Hale - 2002-08-16

    Logged In: YES
    user_id=5634

    As an aside, I think it would be nice to have
    the inner local function "(processConArg c a)"
    in the global function "(processConArgs c as)"
    made global also. Hence, (processConArgs c as)
    would of course be shorten to invoke
    (processConArgs c as).

    I wish this since I sometimes (almost always)
    like to build up my components like the following:

    (define f (window))
    (define b (button "OK"))
    (writestring f "My Main Window")
    (processConArg f b)
    etc.

    I am not 100% sure about this.
    But, I think it might be useful
    to pull out "processConArg".

    -- Bill Hale

     
  • Ken Anderson

    Ken Anderson - 2004-05-20
    • assigned_to: nobody --> timhickey
     
  • Ken Anderson

    Ken Anderson - 2004-05-20

    Logged In: YES
    user_id=18278

    I've assigned this to Tim.

     
  • Timothy John Hickey

    Logged In: YES
    user_id=17797

    Thanks for the fixes. We've made the changes.

    There are a bunch more Swing changes that need to be added, but
    I first have to fix a bug which causes the Scheme->Java compiler
    to improperly handle inner classes....

    I'll look at the issue of pulling processConArg out when I
    add the
    next batch of Swing extensions... for now you can use
    (processConArgs f (list b))

     
  • Timothy John Hickey

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB