Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » fxGraph and HBox layout(How to setSpacing and setPadding from fxGraph)
fxGraph and HBox layout [message #1171714] Tue, 05 November 2013 12:33 Go to next message
Jackson McCann is currently offline Jackson McCannFriend
Messages: 4
Registered: November 2013
Junior Member
I'm just starting out with JavaFX and fxGraph and I'm having problems changing the layout within my Hbox.

component MYComponentTool controlledby MYComponentToolController 
	styledwith ["application.css"] 
	resourcefile "messages.properties" 
   {
	BorderPane id mainPane {
		prefHeight : 280.0,                 
		prefWidth : 480.0, 
    	top : Label {
    		text : "My Application",
    		styleClass : "title"
    	},
    	
    	bottom : HBox {
			Button id btnStart {text : rstring "btnStart.label"},
			Button id btnExit  {text : rstring "btnExit.label"}
    	}
   }
}


I want to apply setSpacing and setPadding values to the buttons layed out in the HBox but I can't work out the correct syntax. I keep getting Property does not exist errors. I suspect that the solution to this is very obvious but I just can't puzzle it out from the documentaion I've found.

Jackson


Re: fxGraph and HBox layout [message #1171803 is a reply to message #1171714] Tue, 05 November 2013 13:50 Go to previous messageGo to next message
Uwe San is currently offline Uwe SanFriend
Messages: 119
Registered: January 2012
Senior Member
Does the following work for you?

bottom : HBox {
	Button id btnStart {text : rstring "btnStart.label"},
	Button id btnExit  {text : rstring "btnExit.label"},
	padding : Insets { top : 10, right : 5, bottom : 10, left : 5},
	spacing : 5
}


The buttons themselves do not have a padding or a spacing property, but the parent HBox does.

Hope this helps.
Uwe
Re: fxGraph and HBox layout [message #1171827 is a reply to message #1171803] Tue, 05 November 2013 14:09 Go to previous messageGo to next message
Jackson McCann is currently offline Jackson McCannFriend
Messages: 4
Registered: November 2013
Junior Member
Thanks - thats excatly what I was trying to do. I had sort of worked around this by giving the HBox a style in the .css

.buttonBar {
 -fx-padding: 10;
 -fx-spacing: 10;
}


    	bottom : HBox {
    		styleClass : "buttonBar",

however this wasn;t really where I wanted the spacing information.

Is there a reference document for the properties or a rule for converting from the JavaDoc to what is avaialble in fxGraph? Is it as simple as
class Sometype {
   Sometype(int val1, int val2) {...}
   ...
}

setSomething(Sometype t)

will be
something : Sometype {val1 : 1, val2 :2}

Jackson
Re: fxGraph and HBox layout [message #1171849 is a reply to message #1171827] Tue, 05 November 2013 14:27 Go to previous messageGo to next message
Uwe San is currently offline Uwe SanFriend
Messages: 119
Registered: January 2012
Senior Member
I think it's as simple as you described in (almost) all cases.

Uwe
Re: fxGraph and HBox layout [message #1173125 is a reply to message #1171827] Wed, 06 November 2013 09:58 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The general rule to what is available is:
a) single values where there's a setter are available in FXGraph/FXML

b) list values you have a setter are available through static creators
ChoiceBox {
items : FXCollections createdby observableArrayList {
"A",
"B"
}
}

c) list values who are modifyable Button { styleClass : ["a","b"] }

Please also note that the padding-property is only available since Java8
so if your project is bound to JDK7 the editor won't show this autocomplete.

BTW: The css syntax you are using is a short hand for -fx-padding: 10 10
10 10!

Tom

On 05.11.13 15:09, Jackson McCann wrote:
> Thanks - thats excatly what I was trying to do. I had sort of worked
> around this by giving the HBox a style in the .css
>
>
> buttonBar {
> -fx-padding: 10;
> -fx-spacing: 10;
> }
>
>
>
> bottom : HBox {
> styleClass : "buttonBar",
>
> however this wasn;t really where I wanted the spacing information.
> Is there a reference document for the properties or a rule for
> converting from the JavaDoc to what is avaialble in fxGraph? Is it as
> simple as
> class Sometype {
> Sometype(int val1, int val2) {...}
> ...
> }
>
> setSomething(Sometype t)
>
> will be something : Sometype {val1 : 1, val2 :2}
> Jackson
Previous Topic:Can't install eclipse(fx) in 3.8
Next Topic:Dependency Injection in Controller Classes
Goto Forum:
  


Current Time: Fri Apr 26 18:25:00 GMT 2024

Powered by FUDForum. Page generated in 0.03778 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top