Is there another FXML element that acts like TableView? - java

I'm trying to make a shopping cart Program using Javafx, however when using a database to display things such as name, price, picture, etc, I get stuck because there is certainly a very easy way to do this using TableView.
But in a real world application, items are displayed in a sort of Block that has a thumbnail, price, and other information about the product.
What can I use to take data from a database, and be able to add/display that information?
I know I can simply take make an anchor pane, with an imageView, a label that will take information queried from a DB, and I can do it that way, but with a tableView it's a simple ObservableList that can iterate through every item in a DB and display it, how can I do that with something other than TableView?

Related

How to create a list with data tables as items that can be sorted

What I want to create
I want to create a list where each item in that list is an data table like below: The user needs te be able to sort items in the data table and needs to be able to sort the data tables itself.
Each table is going to represent a client and each item in that table is an order. The user will then collect the orders, if he collected an order the order wil dissapear but the user is also able to bring them back.
What I tried
I tried to put a Recyclerview inside a Recyclerview but this caused unitended side effects and bugs, also I read online that it is basically a bad practice. My initial intention was to use a recylcerview with a sortedlist.
I did some searching online and a lot of people recommended using categories between items so that you only need one list. But because I have data tables (CardViews) that can be independent sorted this isn't an option.
If anyone want to give me a nudge in the right direction, I would be really thankful.
What you can do you can use recycler view and in custom row check box with 8 text views and when position is 0 inflate categories like fat, calcium etc and after that position populate data and if you want next button which shows next items in list use fragments or pagination that should do the trick and you can achieve this using single recycler view. You can also use header to show categories.

Android autosized Table with autofilled cells?

I'm currently working on an App which should display a table of data. The data shown depends on the user's choices. I want to implement this table which should be autosized and scrollable, but I can't figure out how I could do that using a loop. Maybe you guys can help me by just giving me an example of how to implement such a table, maybe even with the specified data which the user chose in the first place.
PS: The things the user can choose are e.g. date, subject and teacher, so the table has 3 columns (subject, teacher, date). I have implemented this choice already using the jexcelAPI and an xls document, the only thing I need to do now is to implement the table to show the results.
Thanks in advance :)
you can actually complete your task using listview in andriod.And you will load the list of items displayed using baseadapter.

Swing (Java) Category List

everyone.
I'm currently working on a project which is written in Java. As one of my features I want the application to display List of workout plans that are saved in the databases. Furthermore, I want the user to be able to click on particular instance of the workout Plan so that new JFrame is opened with further details which will be populated from the database.
You can see what I mean in the picture below, this is how I want my list to look like.
For this application I'm using Swing components to model my GUI. Its very important for me that those items within a list will act as a button so that you can open up new JFrame, but at the same time the content must be populated from database. Also when a new Workout Plan is added to the database the list must be updated and the item that will be added to that list has to be of the same format.
My question is whether it's possible to design that kind of list using Swing components, and if it is how would you do it.
Any suggestions or help will be appreciated.
I'm not that familiar with swing but, I think you can set your panel into a grid layout. Then divide the grid layout so that there are, for example, 10 rows and 1 column. Afterwards, fill the grid layout with JButton's. Whenever a button is pressed, it will open up a JFrame.
I feel like there's a better way to do this though.

How Do I Format Text Like In The Linked Photo?

I have a floorplan type program that allows the user to drag and drop items onto the plan (haven't got the drag and drop working yet). Each item has an associated labor cost and price that is stored in the object class for each item.
When the user clicks on the Get Estimate button I have a new window that pops up as in the following image.
I then want to try and format the text as in the image shown. I have the window working with a JScrollPane and the buttons. I assume when I get the items working that I will pass a reference to my array of items so that I can call item.getPrice() to get each item's cost and then display it as in the image.
What I would like to know is, what is the best way to format and display the data as shown with tabbed columns using the dynamic data?
Thanks!
If the string passed to a JLabel starts and ends with <html> and </html>, it will be interpreted as HTML.
So given the rather complex layout and style elements such as header separated with a horizontal line etc., and assuming that the table, once the window has been created, is static, the easiest way might be to use a single JLabel and format the text as an HTML table.

Java selecting an option when clicking specific position within JScrollPane

I have developed a chat room application in Java that allows users to broadcast messages to every online user. I want to develop a new functionality that will allow the user to click on one of the online users in order to have a private chat with him/her. For this purpose I have developed a scroll-able text area that will contain those online users.
I think I could set the coordinates of each position that the name will be located at, in the text area so then when a mouse button is clicked I will compare this position against a position of the name in the string output of array list that was passed from the server (i.e. [Adrian, Buddy, Bob]).
As I have mentioned before, I am using a scroll-able text area for showing the online list, therefore I am not entirely sure if this approach would work out once I scroll down the list and click one of the positions.
Perhaps you could recommend me another approach I could adapt, or clarify if this one would work.
Here is the image of my chat client:
As I have mentioned before, I am using a scroll-able text area for
showing the online list, therefore I am not entirely sure if this
approach would work out once I scroll down the list and click one of
the positions.
Working with Scrollable TextArea for selecting items and responding with it the way you described: it will just be a hazard. Use JList with ListSelectionListener instead.
Tutorial Resource:
How to use List
How to Write a List Selection Listener

Categories

Resources