I am working in the java swings application and in the application we have the front menu that contain the list of the other button and the drop down menus. in the application we have the various events that are associated to one another and leads to the opening of the various frames. i want to get the list of the parents through which the particular page is open as i am right now using parent-of-parent but that will give me reference to the two level above the hierarchy but not the entire list. please help...
Related
In Lazarus, there are 2 different kinds of tab elements (cf. Free Pascal docs):
TPageControl
TPageControl is a multi-page component that provides a container to hold a variety of controls per page.
TTabControl
It is a tabbed container component which looks identical to a TPageControl. However, there is a fundamental difference because the control always shows the same page whichever tab is selected. In fact, it containts only a single page. The idea behind this concept is illustrated best by an editor or viewer for text files: When the TabControl contains a TMemo then the individual tabs refer to the files loaded into the memo; whenever the active tab changes another file is loaded into the (same) memo.
In this sense, JavaFX TabPanes are quite similar to TPageControls, but I rather want to replicate a TTabControl. I know I could in fact programmatically create a new Tab(), but I want to visually design it in SceneBuilder.
Is there maybe a way to load a separate .fxml file into a new Tab() element which is then added to the TabPane? (And how could I then access a tab's children?)
I chose the easiest approach: Implementing a head-less TabPane to detect when the user switches between tabs. The elements that appear to the user as the “tab content” are actually placed outside the TabPane, and their content is dynamically changed whenever the tab is switched.
I have a TabPane with 10 tabs (each with its controller). In one of them I have a table 'categories' where the user can add / edit / delete categories.
The other tabs have the same table 'categories', smaller, in read-only mode, where the user can only select categories.
Then, when the table 'categories' is modified in the categories tab, what I want is for all other tables categories of the other tabs are updated.
What I thought is (not implemented yet), on the top panel to put a listener that detects tab changes and, when the user leaves the categories tab, check if changes have been made.
If so, call all the controllers involved to update their own tables of categories.
The question I have is, if there is a less cumbersome way to do this. Something like sending a message 'table has been changed' and all the 'listeners' tabs of the message update their tables. Similar to a locally JMS, not client-server. Is there something like this messaging service that can be employed within the same application or the solution that I raised above is the most consistent? I think the question is more Java than JavaFX.
Thanks a lot.
The easiest way would be to hold the categories in an ObservableList at some top level (say in your Application sub class) and have all the tables share a reference to that list (table.setItems(yourList)). Whenever a change is made in the categories tab, the other tabs will automatically reflect the change.
OK a complete revision:
I have a JFrame with a tab that has buttons/textfields etc. inside.Buttons have events that does simple things like reading from an SQL server and filling the textfields from the received query.Pretty simple eh? And now ,I need to add more tabs to this Frame and have to have multiple tabs.In each tab I "must" have the same components/events. So what I am asking is this,how can I clone all the components/events/keylisteners etc. (whatever i have inside that tab) to another tab? I could always add the same components with different names from the code,but I need to find a way to clone the whole tab..
Why not keep the components you already have without duplicating them, and figure out a way to store all the data to be displayed in some kind of model. You could create only some buttons to simulate the tabs, and when clicking on one you display the data associated with it.
I need to create a wizard in which the first page allows the user to select the type of the element to create, and the following pages create and set-up the selected type. In several aspects it is similar to the standard New Wizard (File->new...) but I need more control on what's happening.
How can I do that? Does there is any tutorial about that?
I see three options on how to achieve this:
Override the getNextPage(...) function of Wizard
or
Add the remaining pages to the wizard just-in-time. That is, after the user has selected what type of element to create.
or
Make the remaining wizard pages dynamic in such a way that they have different contents depending on what kind of element is being created
I recommend the first option.
I am creating an application that converts files from xml to pptx. The user will drag items from a JTree to a JList to create the slide. I have managed to get everything working but the JList seems to disappear after the drop. I know the drop is received because of print statements, and that it's not null. The JList is still there I believe, because I can print the items in the array. Through testing, I think that something is wrong in the custom DefaultListModel I have created. It is not calling an update/redraw/revalidate after the drop for some reason, or has released its action listeners because I notice that the getSize and getElementAt methods stop getting called after the drop. It does however draw correctly if I add items to the ListModel on app init.
I've been looking through all the documentation on ListModels and TransferHandlers but have not been able to get the List to display after the drop. Is my model missing an Override or not handling listeners in some way?
Full source:
http://code.google.com/p/app4args/
Possible problematic file:
http://code.google.com/p/app4args/source/browse/trunk/src/edu/gatech/app4args/utils/CustomListModel.java
To recreate:
Download latest release/source & example xml file from downloads section of project site
Run app, choose File > Import, browse to example xml file
Create new slide: Slide > New Slide, choose Standard (any works)
Drag JTree item from Library to a List in Slide Content View
List does not update, clicking on it or elsewhere in the app and back on the list will make it disappear
Thanks
Turns out I was overriding methods in CustomListModel that were relevant to the updating of how to draw the content of a list. I removed these and reworked a few things and it is correctly drawing now.