JavaFX ListView - Scroll with button press - java

I have a listView that contains my data, but instead of scrolling using the scroll bar, i need to be able to press a button to scroll up (if the listview can scroll up) and a button to scroll down (if the listview can scroll down)
Anyone know how i would go about this? I have checked the listView, and there seems to be no function to scroll up or down.
Ideally i would like to know if there are properties against a listView that tell me the
Maximum Y position that the listView can go to
Current Y postition that the listView is scrolled to
Using these values i can code the rest.

In the end, i removed the listView, and used a ScrollPane with a VBox. Then i added my items to the VBox instead. I had to make changes to the items i was adding to the listView originally, but this seems to work nicely.
I can now use the get/set property VMin, VMax and Vvalue on the scrollPane.

There is Flowless which acts as a simplified(*) (and more efficient) ListView. It has scrollX(dx) and scrollY(dy) methods that you can use to scroll the content.
(*) It does not support selection and inline editing out of the box, but can be implemented on top of it.

Related

Android Studio: ListView OnClick animation doesn't work if you set background color of items

In my project I've setted the background color of my items (composed of several elements inserted in a ConstraintLayout) inside a ListView but the default animation of click and long click disappears if the background color is not at least a little transparent. In fact, as transparency decreases, the effect of clicking on the elements is less and less evident. In a few words, color goes to hide the animation if isn't transparent. How to solve this problem and then bring selection animation to the foreground?
Same problem, still unresolved: ListView items not showing tap animation
RESOLVED!
You have to simply add android:drawSelectorOnTop="true" in your ListView XML tag. In this way you can modify and customize the list item background and at the same time bring back the "selector" on top of the "z axis" of GUI. Yuhu!
If you are giving a background coloraturas to the list items then you might be hiding the system press animations. in this case you can use the methods like OnItemLongClickListener() and itemClickListener () and add your custom animations to the view.

Up and Down buttons for ListView instead of scrollpanel

I'm new to javaFX. and I have a question about navigation in ListView, instead of using scrolling bar in the listview for moving up and down, I want to have separated Up and Down buttons for it. But I don't know how to do it, I see somethings with ScaleX and ScaleY but honestly they are not very clear to me.
Can someone help me? What parameters of the listview should be changed when the up or down button is click ?
Thank you very much. I'm using javaFX 8.
There are different options.
You can use the scrollTo-Method of the listView. There you could use the index and just call the Method with an incremented or decremented one.
You can get the scrollbar like this
ScrollBar bar = (ScrollBar) yourListView.lookupAll(".scroll-bar");
and call the setValue-Method to move it with the Buttons.

ImageView Onclick Animation

Below is a picture of my app, I am currently using a modified version of this app to show my expandable content. Now my problem is with my ImageView, I currently have 3 layouts, one for the main dialog (with listview), one for the listview title & arrow and one for the item details (item row once expanded). I want to add animation to the ImageView so when you click the image or title textview, the list will expand and animate the change. How can I do this? I cannot get the onClick to work because it doesn't know there are 2 imageviews, it seens only one...
I will assume that your ImageView is this arrow inside your ListView element (because you didn't write it clearly enough).
You probably shouldnt try to attach onClickListener to your ImageView at all (nor to your ListView element title). The good way of implementing what you want you achieve would be to use ListView's onItemClickListener to detect clicks performed on specific items inside your listview, and then expanding appropriate expandable content.

how to remove the content of grid cell in swt?

In my wizard page I am using gridlayout with 3 colums. The 3 column will have remove button. I am using add button for the composite. when i push add button it will add new row to the grid layout.
Now I am trying to add listener to remove button. When I push the remove button it should remove the row in which the remove button is pushed from the gridlayout and should resize the composite.
How to achieve this. And how to get the row index of the gridlayout?
To remove the controls completely you need to call dispose() on each control and then call layout() on the parent composite.
GridLayout does not make any information about the positions of the controls available so you can't really get a row index. It does sound like you might be better using a TableViewer to show a proper table.

How to handle scroll in a ListView? Listview autoload

I'm trying to handle the showing of the beginning and end of the list.
I cant to use a scroll event, but I want handle the next event. (try to scroll list view without more elements). How to handle showing of a footer/header?
I saw the field "private EdgeEffect mEdgeGlowTop" in the class "AbsListView". thats fine! but it is private field and I can't to set listener or override this field...
Your question doesn't seem to be that clear. But as I understood you want to add Header/Footer while scrolling the ListView. Here is an example for adding footer using Never Ending ListView

Categories

Resources