I am able to set the properties of a label in JavaFX 8 as such:
label.setTextFill(Color.RED);
However, I am trying to locate a label node by ID in a FlowPane and then set the TextFill but I am only able to set properties of the node such as visibility, for example the following will change the visibility of the label:
FPane.getChildren().get(1).setVisible(false);
But the thing that stumps me is how to drill down further into the label node in order to set properties such as TextFill.
Related
I have grouped 3 shapes (simple square boxes) together. In each of those shapes, I would like to add a field that will display the value of a custom property defined in the "parent" shape (ie: the group).
I know that if the property was directly bounded to the shape I was adding the field to, the formula for that field would simply be: "=prop.MyProperty".
I've looked for something like: "=parent.prop.MyProperty" with luck. Any clue?
Although there nothing like "parent", you can use shape id directly. You need to find the ID (NNN) of the parent shape (i.e. of the group shape), and then use it in the child shape using the syntax like this:
=Sheet.NNN!Prop.MyProperty
The ID of the shape can be found using drawing explorer window (it displays shapes with ids), or "Shape Name" button on the "Developer" tab, ID() shape sheet function on the group (parent) shape, or shape.ID property VBA code.
If you are using VBA there is a Parent property.
IF VSOShp1 contains VSOShp2 and VSOShp2
Debug.Print VSOShp2.Parent
will show the name of the parent VSOShp1.
Debug.Print VSOShp2.Parent.ID
will show the sheet id of VSOShp1.
John...
When I place JavaFX object inside a container, for example some checkboxes inside an hbox:
The scenebuilder controls for each checkbox show the container object in the menu (and different settings are shown here depending on the actual container):
But changing the "margin" value here, for example, clearly affects the individual checkbox and not the HBox. For example, setting only the middle checkbox to have a left margin of 20 yields a change to only the middle checkbox:
So why is that menu area labeled with the container name? I fear I am missing some fundamental design aspect by not understanding this.
They are properties of the control that are specifically available when its parent is an HBox. They correspond to the static methods HBox.setXXX(node, value), e.g. HBox.setHgrow(...).
If you put the check box in an AnchorPane instead, for example, you would see "Anchor Pane Constraints" instead of "HBox Constraints" and you would have options including "TopAnchor", "LeftAnchor" etc., corresponding to the static AnchorPane.setXXX(node, value) methods.
I understood how to create a ListStore model, a GtkTreeView and how to link them together with Glade.
Now I'd like to set the property "xalign" of one GtkCellRender. It seems I can link the attribute "xalign" to the model (I can set the relevant column in the model that stores the value of "xalign" property for that row).
However I'd like to set "xalign" property to 0.5 value for all the rows.
I was able to have this effect through code:
self.cellName.set_property("xalign", 0.5)
I'm finding a way to set the property directly in Glade, so I can avoid to write code for that.
Right click on the TreeView > Edit > Hiearchy > Select Cell Renderer > Common Properties and Attributes > Horizontal Alightment.
I'm developing an application based on the netbeans platform.
The problem I'm having is this; I have a TopComponent that contains two panels, A and B, each with a ExplorerManager. I have two BeanTreeViews in each panel with different sets of nodes. When I change selection in the A panel, the nodes in the B panel will be created. Now, I'd like to be able to select a node in the B panel and see it's properties in the default property view. But I still have a selected node in the A panel, and therefore the property view only says 'Multiple objects.' Is there any way to keep the selection in the A panel from spreading to the PropertyView?
I'd like to be able to use NodeActions on both sets of nodes, and therefore I've added
associateLookup(new ProxyLookup(
ExplorerUtils.createLookup(PanelA.getExlporerManager(), map),
ExplorerUtils.createLookup(PanelB.getExplorerManager(), map)
));
to the TopComponent if i only associate PanelA's ExplorerManager then this isn't a problem.
Ok some after testing around I found a solution that works for me. Perhaps I was a bit quick to post this question. Anyway;
In the TopComponent I did
associateLookup(new ProxyLookup(
ExplorerUtils.createLookup(PanelA.getExlporerManager(), map)
));
Then only the Nodes in PanelA will be spread to the PropertyView. And then to get the NodeActions to work in PanelB, I made it implement Lookup.Provider, and created it's Lookup with
lookup = ExplorerUtils.createLookup(explorerManager, map);
I have a combo box on a view that will have a default of "Active" when the form is loaded. Whose job is it to set the combobox to "Active", the code behind in the loaded method or the View Model?
Bill
I'd say it's the ViewModel's job. There are at least 2 approaches to do it:
bind the SelectedItem of the combo to a property of the ViewModel, and set this property to the value you want
obtain the default view for the collection (CollectionViewSource.GetDefaultView) and set the current item with the MoveCurrentTo method (don't forget to set IsSynchronizedWithCurrentItem to true on the ComboBox)