Collapsible divider for split pane - javafx-2

in JavaFX 2.2 I want to use a split pane (or better: any component with two dividers) where the dividers can be collapsed / expanded again. Is there any Component which does this already for me (and I just don't get it) or do I have to implement this myself? Would you recommend to use Swing here?
Thanks in advance :)
Edit:
Maybe for a better imagination of my problem, the following information is neccessary: I want to split my contents vertically.
content | content | content
(where '|' are the dividers).

JavaFX has a SplitPane to do this.
The pane does not include a button for collapsing and expanding the divider. Either you need to program such a button yourself or the user can just manually drag the pane dividers.
See also: Can we add OneTouchExpansable button on Javafx SplitPane like swing JSplitPane
I would not recommend using Swing for this unless you have other important reasons to use Swing.

Related

PyQt: How to hide everything? (whole application)

Is there a simple way to hide all widgets (essentially hide the whole application)? There are multiple windows and widgets not attached to any window. I'm assuming it's some sort of modifier to the QApplication([]).
EDIT:
Better wording of my question thanks to #eyllanesc:
hide() method that prevents any window (or widget) from showing after using it and you also want the "show" method restore to the previous state.
A possible solution is to iterate over the top level widgets using QApplication::topLevelWidgets() and hide it:
for tl in QtWidgets.QApplication.topLevelWidgets():
tl.hide()
# or
# tl.close()

How to have activity that produce more than one layout when hitting button

Most of us saw the bottom bar in telegram , facebook messenger .. I think .
What i want to know " how is that bar still appear even if we go to another view ?
Thanks in advance .
After reading your comment I understand what you meant. You may want to learn about Fragments, and FragmentActivity. Basically, you would have multiple fragments for each button on the Bottom Navigation, meaning you would have multiple classes and layouts. Your activity's layout should have a container (above the bottom navigation, in a FrameLayout for example) on which you can attach your Fragment. When you hit a button on the bottom navigation, you switch fragments.
I don't really understand the question but I think you want to know how to use Bottom Navigation. You could use the same component in each layout and select a different item based on the layout. If it's in each layout it will appear on each view.

Menu Button that does not dismiss options onclick in JavaFX 2

I am quite new in JavaFX and I have a question about the design. I am creating my main menu in FXML using Scene Builder. I have various menu buttons and each of these have a sub-menu. These sub-menu options will open new windows. Is it possible to declare these submenu choices so they do not dissapear after I click on them? If so, can I declare it in my fxml or I have to do it programatically?
Also, is it possible to detach it from the menu button? I would like to have my menu choices around 1 cm away from the menu button itself.
Thank you
Suggested Alternate Solution
If you want more flexibility in positioning a popup menu after a button click as well as fine control over when the menu shows and hides, try using a Button + a ContextMenu rather than a MenuButton.
The relevant methods are:
contextMenu.show(anchorNode, side, dx, dy)
contextMenu.hide()
There is sample code for triggering a context menu on a button press button in the ContextMenu javadoc.
You might also need to monitor the context menu's showingProperty and in a listener show the menu again if the JavaFX system has decided to try and hide it after some user action and you still want the menu visible.
Answers to additional unrelated comments
OK It sounds logical, yet since Im not really good in JavaFX yet, your Idea is quite challenging.
It's not that hard to implement, but from your subsequent comments it sounds like it's probably not the user interface you want for your users anyway (which makes sense to me because the interface you describe in your question seems a little strange).
I thought If it would be easier to have a static xml that have various menu choices, lets say aligned to the right and then whenever I click one of the choices, a new FXML would be loaded in the middle of the screen holding buttons for a submenu?
That seems logical. Sounds like a JavaFX version of a traditional web page layout with a navigation menu on the side controlling a content pane in the center.
A Java only version of that is: How to have menus in java desktop application. You could adapt that to a FXML based version without too much difficulty.
You might also be interested in Managing Multiple Screens in JavaFX.
Also, any tutorial for beginners would be greatly appreciated. These Oracle ones dont make too much sense for me
If you are beginning JavaFX, I recommend using just the Java API portions of JavaFX until you become familiar with them, and then use FXML only after you are comfortable with the Java API.
Personally, I think the Oracle JavaFX Tutorials are excellent. The difficulty for beginners is that the tutorials are also part reference material, which complicates portions of them (especially the deployment related pieces).
If you prefer a different tutorial style see:
Makery JavaFX tutorial (good for beginners)
zenjava tutorials (more advanced)

Ensure a component takes up all available space within a SplitPane

I've got a (horizontal) split pane, with a tabbed pane as the left component. I want to ensure that the content of each tab takes up all available space when the divider of the split pane is resized, but I'm a bit confused as to what I should be binding to what. Any tips?
Thanks,
Joseph.
did you try anything?
Because you described default behavior for most cases. Put any layout manager other from Pane and Group inside SplitPane and they will try to take all available space for them.

How do I get action buttons with custom layouts to be styled like standard action buttons in Android 3.0+

I'm having a bit of trouble with custom action buttons in the honeycomb+ action bar. I'm adding a menu item that uses a custom layout (using the android:actionLayout attribute). The reason for the custom layout is that I want a button that has two lines of text that can be updated dynamically.
However, I still want this action button to operate like the other standard buttons. By this I mean that the background fades in when the button is selected, and fades out again if it is unselected, all in the style of the platform (the colour seems to differ between different platforms/devices - I've seen both grey and blue versions)
I've tried using the action button style for the custom layout:
style="#android:style/Widget.ActionButton"
and I've tried setting the background for the custom layout to:
android:background="?android:attr/actionBarItemBackground"
but to no avail, and I'm kind of trying things fairly randomly as I can't find any documentation on how to do this (or if indeed it is even possible).
I know I can approximate this behaviour myself by setting the background, but it would be nice if I could just set the item to behave like a normal action button in terms of how it appears when the user interacts with it.
Anyone have any ideas?
Thanks in advance!
Ah, sorry to answer my own question but I have just stumbled upon a way to do this. I was halfway there - you need your custom layout's style to inherit from ActionButton:
#android:style/Widget.ActionButton
but then you also need to make the layout clickable:
android:clickable="true"
for it to work. Using both of these makes the custom action buttons look just like the regular ones when you press them.
Hopefully that'll help someone trying to do this!

Resources