Fix: Horizontal Scroll in Subwindows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fix: Horizontal Scroll in Subwindows

Kyle Smith
Hello,

I had an issue where I could not scroll horizontally within some of my subwindows (e.g.: HardwareSimulatorMain's HDL window). To fix this I added this line to the WideTable constructor.

HackGUIPackageSource/HackGUI/WideTable.java

    public WideTable(TableModel model, int width) {
        super(model);
        this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // <-- Added to scroll
        this.width = width;
    }

If anyone else experiences this problem give this a try.


Thanks,
Kyle
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fix: Horizontal Scroll in Subwindows

Todun
Kyle,
Thanks for this tip. I have incorporated your code into the appropriate WideTable class in the source code for the TECs. However, I am not sure what else to do to bring your code to "life".
Thanks,
Todun.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fix: Horizontal Scroll in Subwindows

Killboy
Apologies for resurrecting an old thread .. just wanted to say thanks Kyle, it works great. I initially tried commenting out:

scrollPane.getHorizontalScrollBar().setUnitIncrement(scrollPane.getHorizontalScrollBar().getBlockIncrement());

.. from HackGUIPackageSource/HackGUI/TextFileComponent.java as I couldn't see why you would set the unit increment the same as the block increment, but no go.

If anyone is a java newb like myself then you can apply Kyles fix as follows:

# download and extract source tarball
cd /path/to/nand2tetris_source
# edit HackGUIPackageSource/HackGUI/WideTable.java with your favourite editor
find . -name "*.java" > sources.list
javac @sources.list
cd HackGUIPackageSource/
jar cf ../InstallDir/bin/lib/HackGUI.jar HackGUI/*.class
cd ..
cp -b InstallDir/bin/lib/HackGUI.jar /path/to/nand2tetris/tools/bin/lib/

cheers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fix: Horizontal Scroll in Subwindows

JosephL
In reply to this post by Kyle Smith
Hi, I am running on OSX (M.Lion) how could I fix this bug?
Loading...