Yes. The point is to recursively traverse whatever hierarchy of
components you have, starting from the top-most one and going down
through all the containers (using the appropriate children) and then
setting the style (be it color, font, etc.) on the "leaf" or individual
components.
A dialog box wouldn't be a child of anything else, so you would have to
start with that separately. But, it is just a subclass of Window/Frame
so you can start with it and navigate down through its children.
This code was just an example -- your mileage may vary....
HTH,
~Roger
On 8/27/13 6:23 PM, Ajay Bhat wrote:
Can this be done for dialog boxes and buttons as well?
On Tue, Aug 27, 2013 at 11:11 PM, Roger L. Whitcomb
<[email protected] <mailto:[email protected]>> wrote:
No problem. But, you would have to write a little loop (possibly
a recursive method) to navigate through all the children of the
TabPane and set the style. Here is some sample code I wrote for
doing a similar thing (only with a new font):
/**
* Recursively set the font on all necessary subcomponents
* of the given component (which initially should be the
* {@link #resultsPane}. Traverse the hierarchy appropriately.
*/
private void setOutputFont(Component component) {
if (component instanceof TabPane) {
TabPane tabPane = (TabPane)component;
for (Component tab : tabPane.getTabs()) {
setOutputFont(tab);
}
}
else if (component instanceof ScrollPane) {
ScrollPane scrollPane = (ScrollPane)component;
setOutputFont(scrollPane.getView());
if (scrollPane.getColumnHeader() != null)
setOutputFont(scrollPane.getColumnHeader());
}
else if (component instanceof Border) {
setOutputFont(((Border)component).getContent());
}
else if (component instanceof Container) {
for (Component child : (Container)component) {
setOutputFont(child);
}
}
else if (component instanceof TableView ||
component instanceof TableViewHeader ||
component instanceof ListView) {
component.getStyles().put("font", outputFont);
}
}
~Roger
*From:*Ajay Bhat [mailto:[email protected]
<mailto:[email protected]>]
*Sent:* Tuesday, August 27, 2013 10:21 AM
*To:* [email protected] <mailto:[email protected]>
*Subject:* Coloring similar UI components
Hi,
Suppose I have a set of different panes (like Table Pane, Label
etc) in different tabs. Would it be possible to color all the
panes of same type across the different tabs using the method as
shown in Pivot tutorial [1]
function onColorChange() {
var color = colorChooser.selectedColor;
sampleBorder.styles.put("backgroundColor", color);
}
[1] http://pivot.apache.org/tutorials/color-choosers.html
--
Thanks and regards,
Ajay Bhat
--
Thanks and regards,
Ajay Bhat