Okay So today I sat down to make a options panel that would allow you to scroll down through the list of options and for some reason I drew a blank... Anyone got an example at where I could get started for some reason I can't seem to see in my mind how to do it though It seems really simple.
You should use ScrollPane() as the container of your list. and you can use List and List.ListStyle to set your options list if you to use text for it.You should set the style of List.ListStyle and ScrollPane.ScrollPaneStyle linked to a json file and therefore your Skin. And then add a table to the stage containing the ScrollPane Actor.
here is a video tutorial: http://youtu.be/CNjkPPveqG8 talking about this.
PEACE!
Related
I'm developing new module in our application using vaadin14 components (eg https://vaadin.com/components/vaadin-date-picker). Everything worked pretty well, but after adding few components (text fields, grids, buttons, labels, notifications etc..) vaadin decided to not listen to me anymore... ;(
Everything started when I've tried to add some addon - slider (because for some reason it was removed from vaadin14). Even I tried a bounch of different addons none of them seem to work, it always lead to not displaying component(it was visible in html code when I was checking html elements on website, but size of that elements always was 0x0 - even setting its size in style didn't seem to work, because - yes it took some place on gui, but was invisible).
I thought that it might be some issue with my vaadin version or some deprecated addons and I've returned to work with default vaadin components. But this time it not seem to work as well. Currently the same issue is with IntegerField, NumberField, DatePicker, ProgressBar and I think that there is much more. There are no errors in console, no errors from server side, html elements are visible in generated html but its size is always 0x0 or not visible(eg vaadin-data-picker 0x0 data-picer 0x0).
Eg.:
html egxample
Like you can see there are no styles visible or whatsoever..
Code that should generete them looks like that(it is taken straight from vaadin example):
IntegerField integerField = new IntegerField("Age");
integerField.setSizeFull();
integerField.setVisible(true);
add(integerField);
NumberField numberField = new NumberField("Years of expertise");
numberField.setSizeFull();
numberField.setVisible(true);
add(numberField);
DatePicker labelDatePicker = new DatePicker();
labelDatePicker.setLabel("Label");
DatePicker placeholderDatePicker = new DatePicker();
placeholderDatePicker.setPlaceholder("Placeholder");
I've tried everything - using .setSizeFull(), setVisible(true), rebuilding project with mvn clean install (production and dev mode), deleting node_modules, targer, webpack.generated.js, package-lock.json(both on main directory and module directory) to let vaadin recreate them. But nothing seem to help. On different machine we was able to display NumberField after few rebuilts, but after few more it disapears again...
Thank you in advance!
EDIT:
Check the difference between working and not woring element:
Working element
Not working elements
Like you can see above in working element is bunch of stuff like shadow-root, styles, div etc. I assume that other elements also should consist such.
Try with setSizeUndefined() or use fixed sizes instead, or make absolutely sure all the parent layers also have full size.
When you use setSizeFull() you are telling the component to spread out to use all the available space, but if there is any container parent in there that has undefined size, that one will only use as much space as the contents demand -- which is nothing, if the contents are all set to full size. All the available space of nothing is nothing.
My target is to display an abbreviation list with two entries per line: the abbreviation and the corresponding long version. For a nice layout I used a GridPane because of the vertical alignment over all entries - it's nice to read.
But I also want to scroll to the clicked abbreviation and set the focus on it like in a ListView version of it.
For example the # on page links in good old HTML. Is there another javafx layout element I miss to achieve this?
I don't believe there is a provided control that will work for the specific scenario you are describing. However, I think one of these options might work for you...
Use the TableView control and add two columns for the information you want to show (one for the abbreviation and another for the long version). TableViews also have the scrollTo and setFocus functionality you're looking for. Here is a good resource to get you started with the Tableview control. You can also style the Tableview with CSS to look less like a table and more like a list if thats what your intention is.
The second option is to set a custom cell factory on your ListView that builds custom cells using HBoxes, VBoxes, Labels, etc. to achieve your desired look. You would also want to use the cell factory to populate each ListView cell with an object that contains both the abbreviated text and long version text. A couple good resources, 1, 2
Although I think both option will work fine, I would suggest option 1 since in option 2 you are sort of building a table type structure anyway. I hope this is helpful!
I am trying to make an image Viewer like the one shown in the figure below:-
Before i can start i have following questions in mind :-
How would i check for the number of images in the target folder so that i can iterate and include all the images in my app.
Secondly,i am thiking to scale the images down to 75x75 .But what i can't think is that how will i slide the images as scrollbar is moved
To be specific,what is the appropriate container for those 75x75 images queue and how that queue is shifted to left or right?(I already know how to get current scrollbar value and add event listeners on it to respond)
To check the number of images in the target folder you can use the File class.
As for the container you might need to create the animation your self. There is no a container ready for doing so.
This site ( and book ) has some ideas about it. I don't know how out-dated it might be though
http://filthyrichclients.org/
Unless I am misunderstanding, making a scrolling list of images is quite simple.
First, create a JList with a datamodel that allows images.
A great example is shown here:
Java drag and drop images in a list
Second, add the JList to a JScrollPane.
The scaling aspect can be easily performed using Scalr:
http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/
So. The ideas have been a few.. no good ones.. So here is the problem i have incountered and can not figure out a solution for.
I need to have a txt file containing a hierarchical list of things to do, looking something like this:
Ask a question
Before question asked, check similar questions
Formulate the question so that the problem is clearly shown.
Post the question
Hold your thumbs that this might save your day.
The txt file should in the program fill a list shown in a JPanel and after each step have a checkbox to comfirm "I have been a good boy and done this".
The list can change over time and grow and shrink, so the solution needs a scrollbar.
The list should also contaion a capability to show more the one row.
The solution im working on is done in Jave compiler 1.6 and im using Swing for my layout.
Ideas i have had so far are:
Modified JTable... and the other solutions i am asshamed of..
And thats about it.. ..
JTree with custom renderer. The renderer should be a panle with checkbox and text area.
have look at JTree
have to override JTree Renderer and Editor (comcept is similair for JTable and JTree)
all data are stored in the DefaultTreeModel
examples about Tree Model,Tree Renderer Editor, Tree and here
Also consider org.netbeans.swing.outline.Outline, discussed here and illustrated below. It's not apparent in the screenshot, but the the Outline instance has been added to a JScrollPane.
I would say JTreeTable is a right choice. It will provide a lot of power and flexibility. Please see some very basic examples:
http://www.ibm.com/developerworks/java/library/j-5things14/index.html
http://www.java2s.com/Code/Java/Swing-Components/JTreeTablecomponent.htm
For any serious purpose please use a mature implementation provided, for example, by a SwingLab project:
http://swingx.java.net/
http://java.net/projects/swinglabs
Please also see the following answer:
Java Swing table tree
Hey,.. i wanna show pictures with names onit in a jList, i know it get's also in a JPanel but i'm now using a jList, doesn't matter..
My question is why does the jlist don't fit the images only in 2 horizontal 'cells' and then go one row down?
sry my english is bad and i don't know how to describe it better, but look on the picture, why does the jlist dont set the e.g. 3rd picture right next to the 2nd?
JList.HORIZONTAL_WRAP works correctly in the ListDialog JWS demo, as described in Initializing a List. I suspect a layout problem, but you might compare your code to the examples found there.
If you use HORIZONTAL_WRAP you can adjust the number of columns with setVisibleRowCount. If you want them automatically fitted to the width of the list, use 0 or something negative.