Expanding Accordion Panel in PrimeFaces with a RadioButton click - java

Below is the snapshot of the layout I'm trying to achieve.
I have two questions/problems here:
Right now,the page loads with all the accordian panels open. I want it initially to be in the closed state (like in option 1).
On click of the Radio button near the tab, the tab should expand. If I click on another radio button, the new tab associated with the radio button should expand, and the other one should close.
How do we accomplish this ?
I don't see any toggle function or anything associated with PrimeFaces accordian. There is only widgetVar.show() function, but it's not helping me.

To begin with your accordion panel tabs closed try setting activeIndex to -1 (or any value that does not correspond to an existing panel). I have not tested this with multiple tabs in an accordion panel, but it should work:
<p:accordionPanel activeIndex="-1">

Related

JComboBox on Java 11 does not show popup menu on the first mouse click if the parent window is not in the focus

After a switch of JRE from J8 to J11 JComboBox instances in two different JPanels respectively (both in a JDesktopPane) don't display the popup menu when a respective containing JPanel is not in the focus when a click is happening.
The first click brings focus into the respective JPanel. After that a single click on JComboBox causes the menu to pop up.
This changed when I switched the JRE from 8 to 11.
From the end user perspective it looks like a mess, because most components on the panel don't act like this and correctly do mouse click stuff regardless of the parent panel focus status.
It was this commit for this ticket: JInternalFrame generates UngrabEvent when unselected, which causes JComboBox popup to hide.

I can't set a border to Jpanel in java

according to the picture above, when I click on border property, it dosesn't show me border and title border to select the border and show this picture above.
before it did work correctly and show border to select
I don't know what is the problem with that.
If you are using netbeans, you can click on Design tab, click on the JPanel either in the frame/Design area or from the Navigator and look for Border attribute in the Pallete window. Click the ellipsis button here. You get your desired window. Hope this helps.
it was my fault
instead of I click on properties tab, I clicked on the binding tab and I looked forward it.
what the stupid man I am.

make tab keyboard button jump from right to left

CASE:
create jpanel
add a few textbox horizontally
set panel to setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)
PROBLEM:
when running, focus on one textbox and press tab button , the focus will jump from left to right , how do i make it jump from right to left?
FOLLOW UP:
say I want one component to be skipped, I can catch the on focus event for this component, but can i issue an automated additional tab click to jump to the next component ?
Thanks a lot for any help.
Check out FocusTraversalPolicy.
Here's an example.

How to get JFrame's button sizes?

I created a JFrame and in the top right corner I have 3 buttons (minimize, maximize, close). How do I get the size of these buttons? I want to place a new button just to the left of the minimize button in the title bar but I need to know how much space these existing buttons take up so that I don't place my button on top of them. ie If you open a recent version of the Chrome browser you'll see a button beside the minimize button in the browser window. I want to do the same sort of thing in my Java application.
What your describing is very advanced.
An alternative route would be to use:
setUndecorated(true);
Then create your own window decorations. This way everything matches and you can add all of the button that you want.

Creating <rich:modalPanel> dynamically

How to create a rich:modalPanel dynamically? I need to click one button and generate a floating panel. The catch is, if I click the button, there should be created a second panel, and the first one should remain on its place. I've tried using ui:repeat and reRender, but this overwrites the first panel when I generate a second one.
If you have a modal panel opened, you won't be able to click any buttons (unless the button is on the modal panel). RichFaces 4 has a pop-up panel which can be modal or non-modal. Using the non-modal version, you can open multiple pop-ups.
try using
<c:forEach />
For an explanation on why you should use the 'c' tag instead of 'ui' read here.
Alternatively, bind the parent component and create the modal panel programmatically using java. See an example here.

Categories