JGoView.setScale and text wrapping

I am having a problem with the JGoView.setScale method. I have nodes containing a JGoArea with two JGoText fields: a title and a main text area.

They are created as follows:

private void createTitleTextbox() {

    //Create the JGoText box for the title
    titleTextbox = new JGoText();
    titleTextbox.setAlignment(TITLE_ALIGN);
    titleTextbox.setFaceName(TITLE_FONT);
    titleTextbox.setFontSize(TITLE_SIZE);
    titleTextbox.setTextColor(TITLE_COLOR);
    titleTextbox.setBold(TITLE_BOLD);
    titleTextbox.setTransparent(true);
    titleTextbox.setAutoResize(true);
    titleTextbox.setEditable(false);
    titleTextbox.setWrapping(false);
    titleTextbox.setMultiline(false);
    titleTextbox.setClipping(false);
    titleTextbox.setSelectable(false);
    titleTextbox.setDraggable(false);
    titleTextbox.setResizable(false);
    
    addObjectAtTail(titleTextbox);
}

private void createMainTextbox() {
    
    //Create the JGoText box for the text
    mainTextbox = new JGoText();
    mainTextbox.setAlignment(MAINTEXT_ALIGN);
    mainTextbox.setFaceName(MAINTEXT_FONT);
    mainTextbox.setFontSize(MAINTEXT_SIZE);
    mainTextbox.setTextColor(MAINTEXT_COLOR);
    mainTextbox.setBold(MAINTEXT_BOLD);
    mainTextbox.setTransparent(true);
    mainTextbox.setAutoResize(false);
    mainTextbox.setEditable(false);
    mainTextbox.setWrapping(true);
    mainTextbox.setMultiline(true);
    mainTextbox.setClipping(true);
    mainTextbox.setSelectable(false);
    mainTextbox.setDraggable(false);
    mainTextbox.setResizable(false);

    addObjectAtTail(mainTextbox);
}

The desired behavior is that the node’s width changes to accomodate
the full text of the title field on one line without wrapping.

At default scale they look as desired.

However, when the scale is at higher or lower than 1.0d the title field has display issues. It looks like it has something to do with the AutoSize being set to true?

At scale = 0.5d:

and at scale = 2.0d:

Any clue how I can make this work?

If you are using JGo for SWT version 5.15, that’s a regression, as a result of fixing a related bug. I suggest you try using 5.21. We sent e-mail about the final beta to supported customers early in January. You can download that beta eval kit at:

http://www.nwoods.com/go/kits/JGoSWT521Eval.zip or
http://www.nwoods.com/go/kits/JGoSWT521Eval.exe
We're about to create the release kits. (Actually, we were going to do that last week, but due to forces beyond my control, it looks like it will be next week.)

Well, that helped to some extent, thanks. The text is now centered nicely at all scales, but at some scales it still wraps the text to a second line despite having setWrapping(false).

Interestingly it isn’t consistent. For example: scale = 1.0d is correct.

Here’s scale = 1.5: (incorrect behavior)

and here is 1.6d: (correct behavior)

You’re right. Well, maybe it’s good that we extended the beta period.