How to align data in list view? JavaFX - java

I have problem with ListView. My application read and parse data from .csv file, then I convert data to array and show in ListView. I need align data like this:
But my solution is this:
Can you help me?

To align your data into columns, i would suggest to use a TableView. You can find an example here:
https://docs.oracle.com/javafx/2/ui_controls/table-view.htm
You can change the look and feel of a TableView to match your needs.

If you like to use a list and not a table you could create a custom list cell. Here is a nice post Custom ListCell with source code which you could easily transfer to your needs.

Related

How update a jlist swing java

I had a problem. I am code a simple dictionary by using java swing
I want first to show all word and then whẹn i type a word or first of a word , it wI'll display this sublist . I try much but not successful, may someone help me
Instead of using a JList you could use a single column JTable. A JTable supports the ability to filter the rows of data in the table.
Read the section from the Swing tutorial on Sorting and Filtering for a working example to get you started.
You can even make the JTable look more like a JList by following these suggestions: How to create a JTable which appears as JList?

How can I add a List to the JLabel?

I'm writing Java game right now, I have a problem that I have a List which type is Ranking, with the fields name and score, and I would like to add that fields to the JLabel. Method setText() unfortunately doesn't fix. What should I do?
with the fields name and score
A JLabel is not designed to display multiple lines of text.
You can format the text using HTML.
Or I would suggest a better approach is to use a JTable, which is designed to display data in a row/column format.
Read the section from the Swing tutorial on How to Use Tables for more information and working examples.
I have a List which type is Ranking
You may also want to check out Row Table Model for an example of a custom TableModel show how you can display your Ranking object in a table.

Best way to do a timetable in Android?

I'm trying to decide on the best way to display a timetable to the user.
Ideally I wanted the data to be displayed in a table layout but I quickly realized that each table row required like 18 text views for the relevant data.
I've checked a calendar component, no use. A table layout does seem the best way to go but what's the best way to implement it so that it's easy to get data from my DB and read it into the table?
You can use GridView with its adapter:
https://developer.android.com/guide/topics/ui/layout/gridview.html

how to use more element in listview?

i m new to android .
i m doing my final yr project in android.
Is the any way to use more elements in list view control....
for example: fetch more data frm database and add it at runtime.
the formate may be
text text
text text
text text
text text
etc.....
refer this page for model https://play.google.com/store/apps/details?id=app.diaryfree&feature=search_result#?t=W251bGwsMSwxLDEsImFwcC5kaWFyeWZyZWUiXQ..
(in this page sample image for that application wil be given, like that report i need to display my data.)
is any other control there for that??? how to add runtime more assign more than one element value???
like this
and how to find which row is clicked?
thankz in advance
you can create custom list views to format the listview the way you asked for. And cursors are a good way to fetch data from a database and pass it to a listview. you can use adapters for that.
a sample code for custom list view can be seen here
to find out which item is clicked you need to use onListItemClickListener like given here Android: onListItemClick in Activity

Java Thumbnail View

Hey i want to create a thumbnail viewer, for my app, i want something similar to this.
I was wondering if there is a pre-existing component that can display thumbnails (FREE), or i was considering to use a JTable, with a custom cell renderer.
What do you think, what would be the best way.
It will be used to display images, keep in mind that i must be able to select individual and multiple files to perform actions on them.
thx in advance.
A JList would probably be better than a JTable. You can use a "horizontal wrap" style. You can always create a custom renderer for the list as well.

Categories