I need to show a small, right-pointing, custom-color filled triangle, beside a radio-button's LHS (which would belong to a button-group) which has just gained focus in the group (by key-board arrow-key navigation). [i.e. the triangle would point towards the circle of the radio-button component]. Several alternatives are rushing through my mind w.r.t. a possible implementation. But, before I design it fresh from the grass-root level, I wanted to see if some one has a pointer to some concept-implementation/solution, in the interest of saving some time.
Some alternatives that I'm considering:
1. Custom UI delegate creation and then setUI on the Radio-Button.
2. Packing a parallel, thin, vertical JPanel on the LHS of the circles of the radio-buttons (of the associated radio-group) and then computing the Y-co-ordinate of the center of the circle, of the just-focus-gained radio-button, in its focusGained() event-handler, to compute the offset of the Box (of the vertical BoxLayout) in the LHS-JPanel and then rendering a Path2D-based triangle, which will then be custom-color-filled and then making that box visible (in the LHS JPanel vertical-stack - it will have at most one box visible at a time - the one associated with the focusGained() radio-button) and then, vertical-aligning the LHS-JPanel and the button-group with the Spring Layout (so that they move-together over the main-panel-resizing operation, if undertaken by the user).
3. Customizing a radio-button, by putting it in a JPanel with horizontal BoxLayout, (whose first box will hold the Java2D-rendered triangle) and making all such JPanel-embedded radio-buttons members of the covering group.
Please comment on the above and/or please provide some example pointers of similar attempts. Thanks a lot.
