I'm working on a kind of swing explorer (spy++ for java)
Container container = (Container) jScrollBar1; //previously created
for (int i = 0; i < container.getComponentCount(); i++)
The previous code show two childs for a JScrollBar... the children are com.sun.java.swing.plaf.*.*ScrollBarButton (the two buttons of the scrollbar)
My goal is to detect skin component when doing Getcomponent in order to ignore them.
Maybe you can answer to one of these questions :
1- Is there any what to tell that this Specific component (ex: container.getComponent(1)) is a **SKIN** component?
2- Is there any equivalent to javafx GetSkin() to return all the skinning part of a "control" ???
3- Is there any relation between JScrollBar1.GetUI() and the skin components returned as children of the scrollbar ?
4- Is ther any alternative to GetComponent()....a kind of GetComponentWithoutInternalSkin() who return only the highlevel control without all the skin ?
The real term in swing is more Look and feel component.
By skin I mean any child components ONLY used for skinning and available with Container.GetComponent(). There are "skin components" for all possible components (e.g: JScrollBar, JScrollPane, JComboBox,JSlider, ...)
theses skin can be one of the standards look and feel (metal, Nimbus, ..) or any 1000 other possibles look and feel downloaded from the internet.
How can I distinguish a ScrollBarButton from a JButton since the scrollBarButton inherits from JButton
A scroll bar button isn't a proper component of itself. The current one just happens to be a JButton because the ScrollBarUI implementation determines it is a JButton. If you want it to be something else, create your own ScrollBarUI implementation that uses a different way of displaying the buttons.