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.
Related
Does anyone know how to create a react component with responsive grid and options so that we can drag and add other additional components?
The goal for us is to create a popup component and within this popup component we are going to name the component within the options menu. In the meantime also has the ability to drag and add other react components we have created. The purpose of the Popup Name is to be able to pass the data into react and link it with other AEM React component so that it can be triggered with an event.
For example
Add a button component
within the button component, there a option we can indicate which popup should it open if a user clicks on it
options menu for any other react components
once the user clicks on the button, it then looks for the popup component with the same name and the popup should be revealed.
options menu for the popup component
within the popup we can add whatever the component we want, for example, video component or image component.
the popup component, and within it, ability to add other component
Problem:
we tried several ways of doing it, adding responsive grid from #adobe/aem-react-editable-components into the functional popup component we created, it didnt work.
we also tried creating a class based popup component which extents from the responsive grid, this works however when we try to add the options menu in by creating the java file and the .content.xml, we weren't able to add any of the components in(even though the options are there, but its not responding). However, the name of the popup component is being passed into React correctly.
class based popup component that extents from responsive grid
when we console.log props, we do see the name of the component is being passed into react correctly along with other data
console.logged props
below are the xml files created
_cq_dialog is there for the option menu to work.
_cq_template, new, and _cq_editConfig is there for the responsive grid of adding additional components to work
it works all fine, until we add the java files which handles the functionality of passing the data from the options menu into react
Note: I also see other people trying to achieve the same thing as us, but the solutions they get points them to the SPA documentation which did not mention any complex use case.
I am a beginner and I am trying to make a text editor and I want to create a pop up window for text format when I press a menu button where I can put all things like font face, font size , font style etc. Can you tell me how I can make this new window? Thanks for your patience!
For example Notepad:
I think what you're after is a dialog of some kind.
Take a look at How to Make Dialogs for more details.
What I would do is design the basic UI onto a JPanel. I would then add this JPanel to an instance of a JDialog (possibly even using a JOptionPane) and show this dialog, making sure to make it modal, so you can easily retrieve the values set by the user.
This means that you can decide how best to show the user interface or even show it in a number of different ways as it's not constrained to a single top level container
You can simply create a brand spanking new JFrame and it will still be counted as the same application.
Tip: Use Eclipse Window Builder
I am working on a swing application, and i want to add a functionality and i don't know how to do it.
A part of my main frame contains a panel, which contains buttons to access other frames, and i want to add some enhancements to it, this is the picture of the panel:
And the functionality that i want to add is, when i click on the Appel d'offre button, i want it to list a list of the other buttons, in other words i want to group all the buttons in one.
i looked for an example to make it clear, here is a photo of Sage software:
So how am i suppose to do it, what is the components that i have to add to make it work?
i hope that i clarified my question.
These controls called ExpandBar or Collapsible panel.
Swing does not provide this type of control, but you can create your own.
Also the swingx library provide one for example.
Guess google could help you to find more with these terms.
I have an open-source java swing application like this:
http://i47.tinypic.com/dff4f7.jpg
You can see in the screenshot, there is a JPanel divided into two area, left and right area. The left area has many text links. When I click the SLA Criteria link, it will pop-up the SLA Criteria window. The pop-up window is JFrame object.
Now, I'm trying to put the pop-up window into right area of the JPanel, so that means no pop-up window anymore, i.e. when I click the SLA Criteria link, its contents will be displayed at the right area of the JPanel. The existing content of the right area of JPanel will not be used anymore. The concept is just same like in the java api documentation page: http://docs.oracle.com/javase/6/docs/api. You click the link in the left frame, you'll get the content displayed at the right frame.
The example illustration is like this:
(note: it's made and edited using image editor, this is not a real screenshot of working application)
http://i48.tinypic.com/5vrxaa.jpg
So, I would like to know is there a way to put JFrame into JPanel?
I'm thinking of using JInternalFrame, is it possible? Or is there another way?
UPDATE:
Source code:
http://pastebin.com/tiqRbWP8 (VTreePanel.java, this is the panel with left & right area divisions)
http://pastebin.com/330z3yuT (CPanel.java, this is the superclass of VTreePanel and also subclass from JPanel)
http://pastebin.com/MkNsbtjh (AWindow.java, this is the pop-up window)
http://pastebin.com/2rsppQeE (CFrame.java, this is the superclass of AWindow and also subclass from JFrame)
Instead of trying to embed the frame, you want to embed the frame's content.
There is (at least) one issue I can see with this.
The menu bar is controlled by the frame's RootPane.
Create you're self a new JPanel. Set it's layout to BorderLayout.
Get the menu bar from the frame (using JFrame#getJMenuBar) and added to the north position of you new panel.
Get the frames ContentPane and add it to the center position of the panel.
There is undoubtedly countless other, application specific issues you will run into trying to do this...
No, you don't want to "put a JFrame into a JPanel" and your illustration above doesn't demonstrate this either. Instead it's showing a subordinate window on top of (not inside of) another window. If you absolutely need to display a new subordinate window, I'd recommend that you create and display a JDialog. The tutorials will explain how to do this, or if you get stuck post your code attempt and we'll help you work with this.
Edit 1
You state:
I need to convert from the pop-up window style into the jpanel content style. It's just like the java api documentation page style: docs.oracle.com/javase/6/docs/api When you click the text in left frame, it doesn't show any pop-up, right? The content is displayed at right frame directly. So that's basicly my goal. The source code is quite big. I will try to paste the source code if possible.
What you are looking for is to simply implement a MouseListener in a JList or JTable, and when responding to the click get the content based on the selection made. This has nothing to do with placing a JFrame in a JPanel and all to do with writing the correct program logic. Again, display it in a modal JDialog -- but that's all secondary to your writing the correct non-GUI logic. You're really barking up the wrong tree here. Forget about JFrames, forget about JPanels for the moment and instead concentrate on how you're going to extract the SLA Criteria data when it is clicked on.
Edit 2
I think I see what you're trying to do -- instead of JFrames and JDialogs, use JPanels and swap them using a CardLayout which would allow you to swap views.
I had skimming the source codes, I saw that the AWindow.java has internal panel (APanel.java) to hold the window's content, and it also has a public method to return the content panel object (getAPanel()). With this, I can use it for fetching the window's contents into other container.
Finally, I decided to use JTabbedPane in the right area of VTreePanel for displaying the pop-up window's contents.
You cannot put a Jframe into a JPanel. Instead you should try to create a separate panel that has functionalities like your JFrame and embed that into your JPanel.
Since you can put a JPanel into another JPanel but not a JFrame into another JPanel
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.