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.
Related
I want to create this element in swing:
As you can see the element is a small grid of buttons which appears when i click on another button. I've tried to use JComboBox to create this element. But as far as i know, JComboBox can just render an image of the some button, but it will not behave itself as a button. Also I couldn't set a GridLayout to JComboBox.
I also tried to create some JDialog, but I suppose that's bad idea.
So the question is: Which swing's component should I use to create mentioned element?
You could use dialog in the best way to achieve this.
JDialog dialog = new JDialog(owner);
dialog.setModalityType(Dialog.ModalityType.MODELESS);
dialog.setUndecorated(true);
You could set Modality type to Modeless to avoid parent frame lock and set undecorated true to make jdialog without close option. But note that you need to close the dialog from program.
I am working with WindowBuilder at the moment but have a problem making it display all panels in the program in the "Components" Window. I have a "StartPanel" for example with a button which when clicked causes the program to switch from "startPanel" to "nextPanel". Everything fine but in this case, "nextPanel" isnt shown in the "components" window, why?
When I however copy all the code which creates the "nextPanel" and write it outside of the "ActionListener" so that I do not have to click a button to create it, it appears in the "components" window. Is there a way to make every panel appear in "Components"? At the moment I have a frame with a getContentPane which has the 2 Panels in it, but only 1 is shown if I add the second one with a button..
I suggest you to create the next panel as a separate component (separate class file) so that you can edit it using window builder any time, and then instantiate it in the action listener.
I am creating a panel showing many different kind of widgets such as button. The panel allows to zoom in and zoom out. It is required to show whole panel in the beginning. However, some users may touch more than one button when the panel is too small.
I want to handler the situation like chrome in Android. When the user touches more than one link, a pop up panel will be showing.
What library or APIs may I use?
Thanks!
You could place your Buttons in a FocusPanel implementing a ClickHandler to open your desired popup- thus when your user clicked between two buttons the click is registered and you can handle it.
Note, you will have to place a FlowPanel in that FocusPanel to place more than one button inside.
If you want to react on hover instead of on click, use HoverHandler instead.
I am writing a Swing Menu based application. In the Menu I have File->New->Add Person
Here Add Person is a form and the new option will have many other forms.
When I click on any of this form it has to be added to the menu display area.
My question is how do I add it to the display area. should the display area already consist of any swing container to which I can add my Forms?
Also, note that each of these Forms that I have created are individual JFrames
Also, note that each of these Forms that I have created are individual JFrames
never to use lots of JFrames, this is road to the hell
My question is how do I add it to the display area. should the display area already consist of any swing container to which I can add my Forms?
if you need popup window then to use JDialog, only one JDialog and re_use that for another action
I am writing a Swing Menu based application. In the Menu I have File->New->Add Person Here Add Person is a form and the new option will have many other forms. When I click on any of this form it has to be added to the menu display area.
use CardLayout for swithing betweens views
You can go with the JInternalFrame option. It helps you to do your requirement, refer the links,
http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html
Also refer this link for examples,
http://www.java2s.com/Code/Java/Swing-JFC/InterestingthingsusingJInternalFramesJDesktopPaneandDesktopManager2.htm
U can Display JFrame Forms on Click of Menu on Top of Parent Window.
U can make it act like a dialog by making the Parent Form disable and when Child Form Exits again we can Enable the parent Form.
I have this form where there are extendable controls like there's a textbox for the user to type and beside it is an add button which the user would use to add another textbox beneath the previous one.
My problem is i don't even know how to make that add button work so that another textarea/textbox would appear just beneath the previous control..im doing it in netbeans ide 7.0 and in design mode...
I have researching for quite a while now and i'm so confused already what to do..at least you could provide me with an idea not really the code.
You should create a Layout.
For your case (Form kinda layout) , it seems that you need GridLayout.
For example, please check this link for all type of layout or directly go to Grid Layout link.
Since you're going to be dynamically adding controls to your form, you'd simply want to put in a panel where you want the textbox and the button. Inside that panel place your textbox and button, you'd probably not want to use netbeans to do this, and use a LayoutManager like GridLayout. Now you'lld want to connect your button to an ActionListener that adds a textfiield to the panel.
See the Nested Layout Example for an example of (amongst other things) adding components to a GUI dynamically.