Syntaxtree width

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Syntaxtree width

Postby Kyrremann » Tue Aug 28, 2012 9:26 pm

I've started working on my ThingML Editor that I've mention in another post. And I'm trying to do some customizing, but I'm having problem setting the width of the syntaxtree area. Any tips?
My RSytaxTextArea master blogg http://thingmlosf.tumblr.com/ and source code https://github.com/Kyrremann/ThingML
Kyrremann
 
Posts: 14
Joined: Wed May 16, 2012 10:07 pm
Location: Oslo, Norway

Re: Syntaxtree width

Postby robert » Thu Aug 30, 2012 3:33 am

What specific problems are you having? What container are you putting the tree in?
User avatar
robert
 
Posts: 760
Joined: Sat May 10, 2008 5:16 pm

Re: Syntaxtree width

Postby Kyrremann » Thu Aug 30, 2012 7:47 am

I'm working on the DemoRootPane.java and the tree is implemented in a JScrollPane (called treeSP in the code), the problem is that when I start the application, the source tree (of the code) is hidden and I have to use the mouse to drag the window bigger. So I'm trying to set the width by code so that the code tree is visible all the time.
My RSytaxTextArea master blogg http://thingmlosf.tumblr.com/ and source code https://github.com/Kyrremann/ThingML
Kyrremann
 
Posts: 14
Joined: Wed May 16, 2012 10:07 pm
Location: Oslo, Norway

Re: Syntaxtree width

Postby robert » Fri Aug 31, 2012 1:18 pm

I see. I just updated the DemoRootPane in RSTALanguageSupport to handle this better. Try this:

java code:

final JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
treeSP, scrollPane);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
sp.setDividerLocation(0.25);
}
});


You unfortunately have to wrap it in a SwingUtilities.invokeLater() since the parent container must be realized for the JSplitPane to be able to figure out the relative sizes of its children. Alternatively, you can pass an int instead of a float to give an absolute size in pixels rather than a relative size.
User avatar
robert
 
Posts: 760
Joined: Sat May 10, 2008 5:16 pm

Re: Syntaxtree width

Postby Kyrremann » Sat Sep 01, 2012 7:49 am

Thanks that worked like a charm.

PS: I've also started using github to store my code, so take a look if you'd like.
https://github.com/Kyrremann/ThingML-Editor
My RSytaxTextArea master blogg http://thingmlosf.tumblr.com/ and source code https://github.com/Kyrremann/ThingML
Kyrremann
 
Posts: 14
Joined: Wed May 16, 2012 10:07 pm
Location: Oslo, Norway


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest