JavaFX Java GUI Tutorial - 18 - Simple TableView

  Рет қаралды 193,915

thenewboston

thenewboston

Күн бұрын

Пікірлер: 106
@hyperpug2898
@hyperpug2898 3 жыл бұрын
Needed to learn javafx in one night for school. This playlist is a life saver. Thank you so much for this videos!
@HWilliamson
@HWilliamson 9 жыл бұрын
Could you show us how to connect to a database and use values from a table in javafx??
@adekorir
@adekorir 9 жыл бұрын
I've implemented this in Connecting yo a database and I have to say JavaFX is the best thing t ever happen to Java... and lambdas!
@Meegoue
@Meegoue 9 жыл бұрын
Wow, JavaFX tables are WAY easier to use than Swing tables. I remember my first time messing with them. I spent like 4 hours trying to make it all work.
@Joreleme
@Joreleme 7 жыл бұрын
Searched google for an hour....Didn't get the concept. After your tutorial I checked the concept behind data model and TableView and I could implement one table on my own. THANKS! :)
@kristenjacobsen831
@kristenjacobsen831 9 жыл бұрын
All of these tutorials helped so much, easy to follow, informative and you are a good teacher! plus i get a pretty good laugh when you go off track talking about things haha thank you so much man!
@vuongtiennguyen3268
@vuongtiennguyen3268 4 жыл бұрын
you can also adding object to ObservableList simply by doing this: ObservableList student = FXCollections.observableArrayList(data.showDb());
@MrCrayfishMinecraft
@MrCrayfishMinecraft 9 жыл бұрын
Curse them fruit cups!
@Ele20002
@Ele20002 7 жыл бұрын
I didn't expect to see you here... ...but your presence has made my day
@dbznappa
@dbznappa 6 жыл бұрын
Literally the only KZbinr I disable adblocker for.
@christianlisangola9383
@christianlisangola9383 8 жыл бұрын
In the Production class,the type of the quantity is an int,but why in the instruction: TableColumn QuantityColumn=new TableColumn("Quantity"); the type you've used isn't Intégrer?
@Imrankhan-nn5kp
@Imrankhan-nn5kp 7 жыл бұрын
Yu can pass Integer too,, TableColumn quantityColumn=new TableColumn("Quantity");
@RohitAwate
@RohitAwate 7 жыл бұрын
Generic classes in Java do not accept primitive data types in their type arguments. Hence, the int in Product class will automatically be promoted to Integer.
@Billywong
@Billywong 6 жыл бұрын
@theChris yea I have spotted the same problem
@Billywong
@Billywong 6 жыл бұрын
@Rohit Awate. "Generic classes in Java do not accept primitive data types in their type arguments. Hence, the int in Product class will automatically be promoted to Integer." do you mean since int is an primitive type argument, it cannot be passed into a function? then why "Integer" will be accepted? aren't int and Integer the same thing?
@FUUUUU1111
@FUUUUU1111 6 жыл бұрын
They aren't, you should read about unboxing and autoboxing in java.
@davibergamin5943
@davibergamin5943 3 жыл бұрын
bro, THANK YOU for existing
@robogenus
@robogenus 7 жыл бұрын
Awesome tutorials, thanks so much! Concise, clear, and funny. Subd
@dbaccello
@dbaccello 2 жыл бұрын
mi fai morire dalle risate ogni volta
@peterhernandez3717
@peterhernandez3717 5 жыл бұрын
(4:21) "corns and toilets boys, come and getem!" 😂
@maartentbm
@maartentbm 9 жыл бұрын
How come the quantity column sorts like an integer column (11:02) while the data type of the column is actually (accidentally) set to String? I would expect the sorted order to be like "12", "198", "20", "74", "856". (Now I also wonder how a column would sort if the data type is not Comparable)
@hossamnasser9717
@hossamnasser9717 4 жыл бұрын
Hi, did u find out ?
@ModelbaanTBM
@ModelbaanTBM 4 жыл бұрын
@@hossamnasser9717 I don't think I did 😅
@ArnabJoardar
@ArnabJoardar 4 жыл бұрын
@@ModelbaanTBM A user @Tobias Vidal Diaz already answered that, 2 years ago. I can't seem to link the comment. It's here, though.
@Billywong
@Billywong 6 жыл бұрын
I tried to follow the tutorial and the source-code on Buckys website but I cannot compile. I have the following error:" Main18.java:62: error: cannot find symbol ObservableList products = FXCollecions.observableArrayList(); " but I am sure I have already imported FXCollections at the top. why is this? at the top of my Main.java: "import javafx.collections.FXCollections;"
@Zeargi
@Zeargi 3 жыл бұрын
Hi, I'm doing these, and I get to the " nameColumn.setCellFactory(new PropertyValueFactory("name"));" part, but I'm using SDK 15 and I get an error in the part of the code.
@kyosiris
@kyosiris 8 жыл бұрын
Go to Settings > Editor > General > Auto Import and add "javax.swing" to get ride of swing in auto-completion. ^^
@GuNsDaW
@GuNsDaW Жыл бұрын
Thank you! Very useful
@Mafranny
@Mafranny 7 жыл бұрын
Man... you saved my day. Thank you very much for your help.
@GgoldspiderS
@GgoldspiderS 4 жыл бұрын
I wonder how you get the private properties of the Product class in the table by using the "name" of the property without invoking the getters ?
@ImmunityG
@ImmunityG 3 жыл бұрын
Actually it is dependent on the getter. it gotta be (get + attribute with capitalized first letter). Otherwise you would get an Exception
@chaabounimohamed7065
@chaabounimohamed7065 8 жыл бұрын
Thanks a lot ! Bro ! :D you're the best i was stacked in displaying my data for 3 days
@master0612
@master0612 8 жыл бұрын
@edit now i get it.. get function must be like getPytanie not like i had getpytanie.. ^^ one small letter big difference ehh meh i tried this and it shows me right colums but values are empty.. ObservableList lista_danych = FXCollections.observableArrayList(lista_pytan); lista_pytan is my ArrayList with Szablon_bazy objects.. i ve 30 objects there and when i show TableView its even show 30 rows but all are empty.. ObservableList has this elements, i just tried to print them with foreach. I ve no idea why table wont show me them..
@ДиогенСинопский-т4с
@ДиогенСинопский-т4с 3 жыл бұрын
Hey ya, you are the best. Thanks for guides.
@ben8140
@ben8140 4 жыл бұрын
Bruh you save my life for a school project!
@zulucharlie5244
@zulucharlie5244 7 жыл бұрын
Really great tutorial video - thanks for posting.
@MsFerid567
@MsFerid567 4 жыл бұрын
your an actual legend, thanks man
@mr.RAND5584
@mr.RAND5584 4 жыл бұрын
How about sir more than one table query to display on tableview? Do i have to create tablecolumn and class model? Such as a query of one patient has lots of visits query.
@ikarosouza9505
@ikarosouza9505 6 жыл бұрын
in my Product class, i've placed a Supplier object as one of the product's properties. in the table i want to show the supplier's name, how would i do that without changing the getSupplier method?
@jaiylonbabb7548
@jaiylonbabb7548 3 жыл бұрын
How do I do this with user input into an ArrayList e.g. Enter name, enter account number and enter balance. Like how would I get the data to show in the TableView?
@gabob6992
@gabob6992 2 жыл бұрын
grüße gehen an fabian satybaldy-ulu
@todoros676
@todoros676 7 жыл бұрын
Great job Bucky, thank you!! I got one question, how can I print that TableView with a printer?
@cgme9535
@cgme9535 6 жыл бұрын
Might be late, but you'd need to use a printer API for that. I don't think JavaFX has built in functionality for printing out to a printer. I'd look up "Java printer API" and see what you get.
@danielmontes6882
@danielmontes6882 4 жыл бұрын
Hey! What if I have an Array or an ArrayList of float data in the product class? How can I fill a cell of the column with a number that is contained in an Array?
@sumedhakarunarathna426
@sumedhakarunarathna426 3 жыл бұрын
This was really helpful.. Thank you very much
@dxintelligence
@dxintelligence 7 жыл бұрын
Why is the key Product showing error? am I using the wrong kind of class, I used java class as there is no javafx class without a main class?
@cRsregeLt
@cRsregeLt 4 жыл бұрын
Is there a way to dynamically change the width of a column to wrap the biggest content of a cell of this column?
@nshusa99
@nshusa99 9 жыл бұрын
Love your videos I've learned a lot. Keep it up.
@AlejandroRodriguez-jo9kg
@AlejandroRodriguez-jo9kg 9 жыл бұрын
For some reason my code it's not showing the quantity(in my case inventory) in the table. //Main.java public class Main extends Application{ Stage window; Scene scene1,scene2; VBox panel; TableView table; public static void main(String[] args){ launch(args); } @Override public void start(Stage stage) throws Exception { window = stage; window.setTitle("Aplicacion de Prueba - Alejandro Rodriguez"); TableColumn name_c = new TableColumn("Resource Name"); name_c.setMinWidth(200); name_c.setCellValueFactory( new PropertyValueFactory("Name")); TableColumn price_c = new TableColumn("Resource Price"); price_c.setMinWidth(125); price_c.setCellValueFactory( new PropertyValueFactory("Price")); TableColumn inventory_c = new TableColumn("Resource Inventory"); inventory_c.setMinWidth(125); inventory_c.setCellValueFactory( new PropertyValueFactory("Inventory")); table = new TableView(); table.getColumns().addAll(name_c, price_c, inventory_c); table.setItems(getResources()); panel = new VBox(); panel.getChildren().add(table); // Scene Scene scene = new Scene(panel,500,250); window.setScene(scene); window.show(); } public ObservableList getResources(){ ObservableList res = FXCollections.observableArrayList(); res.add( new Resources("Wood", 9.99, 100)); res.add( new Resources("Iron", 12.85, 70)); res.add( new Resources("Cotton", 3.16, 200)); res.add( new Resources("Marble", 20.75, 50)); res.add( new Resources("Glass", 5.99, 175)); return res; } //Resources.java public class Resources { private String name; private double price; private int inventory; public Resources(){ this.name = ""; this.price = 0; this.inventory = 0; } public Resources(String n,double p,int i){ this.name = n; this.price = p; this.inventory = i; } public String getName() { return name; } public void setName(String nm) { this.name = nm; } public double getPrice() { return price; } public void setPrice(double pr) { this.price = pr; } public int getInvetory() { System.out.println(inventory); return inventory; } public void setInvetory(int inv) { this.inventory = inv; } }
@MatthewDHayworth
@MatthewDHayworth 7 жыл бұрын
Can someone explain to me why "Double" in the Price column begins with an uppercase "d"?
@hurlok
@hurlok 7 жыл бұрын
This may be too late for you but in case someone else is wondering: Lists and such can't have primitive types (so no List, , , etc! google primitive types if you don't understand), because the List methods are defined to receive Objects. To work around this, there's this thing called "wrappers", which are classes dedicated to each of the 8 primitive data types. These wrappers basically transform the primitive variable/value into an object so it can be passed around as one. The wrapper for doubles is Double, so you write "List". Hope it helps someone, for a more detailed explanation, google "Java wrappers".
@MatthewDHayworth
@MatthewDHayworth 7 жыл бұрын
Thank you :)
@Aegs4631
@Aegs4631 4 жыл бұрын
SIR! HOW TO MAKE A SAME PROGRAM WITH ADD BUTTON WHERE YOU CAN ADD DATA YOU WANT AND THE TABLE COLUMN IS AUTO GENERATED (SO IT MEANS THAT IF THERE IS NO DATA THERE'S ALSO NO TABLE COLUMN) THANKS HOPE YOU NOTICE I REALLY NEED ANSWER
@claytonlawrencebeato1774
@claytonlawrencebeato1774 5 жыл бұрын
Hey guys i've copy pasted the code from the gitHub since my orignal written code didnt run, but the codes from gitHub also didnt run. Both had no error whatsoever. Any idea why?
@CheyziEdits
@CheyziEdits 4 жыл бұрын
how could i display the keys and values of a hashmap in a tableview?
@xephecoh
@xephecoh 5 жыл бұрын
how to populate table with arraylist of primitive type of data? what should be inside of >>> Tablenumber.cellValueFactoryProperty(new PropertyValueFactory();
@AstonMargolis-Dias
@AstonMargolis-Dias 6 ай бұрын
DIID YOU EVER KNOW THAT YOURE MY HEERROOO 🎶🎶
@jeremymcclellan474
@jeremymcclellan474 7 жыл бұрын
You rule Bucky!
@ericfricke4512
@ericfricke4512 4 жыл бұрын
Fruit cups have tons of added sugar.
@jtl2914
@jtl2914 5 жыл бұрын
I'm so sorry, I laughed out loud in front of my co workers when watching your deleting the code at 9:13
@goldiemusic8394
@goldiemusic8394 4 жыл бұрын
you must be really smart, you fuck.
@Protocycle
@Protocycle 7 жыл бұрын
How does PropertyValueFactory() know how to get the specified values? I don't see how just putting "name" helps the compiler know where to get the info D: or could it be that it all happens at table.setItems(getProduct()); and the ObservableList organizes the data in a manner such that the variable (field) 'name' in the Product class is passed as a "string" or a property name somewhat similar to how JSON works and at the end uses something like a JSON.parse() to convert and get the values?
@vladbuhoci6512
@vladbuhoci6512 7 жыл бұрын
Read about the Reflection API and you will understand. :)
@Protocycle
@Protocycle 7 жыл бұрын
I'll check that out then, thanks :D
@vladbuhoci6512
@vladbuhoci6512 7 жыл бұрын
Anytime :)
@msv900
@msv900 7 жыл бұрын
im geting this error type argument Box is not within bounds of type-variable S where S is a type-variable:
@PRONOOBSPAK
@PRONOOBSPAK 5 жыл бұрын
what if i want to multiply table column with quantity string
@erickcabral
@erickcabral 6 жыл бұрын
Fuck Yeah! Great Video Man!
@chimichangas7621
@chimichangas7621 4 жыл бұрын
how would you get the total price of all the items in the price column?
@AstonMargolis-Dias
@AstonMargolis-Dias 6 ай бұрын
ty so god damn much
@anubis9139
@anubis9139 6 жыл бұрын
The < and > are called chevrons. Yes, like the gas station. If you look at their logo, it even has 2 chevrons in it. A chevron is also the black and yellow signs with multiple repeating arrows pointing to the direction of the flow of traffic (see example here ). Lastly, it is the shape of the back legs of goats and dear.
@jsmarks01
@jsmarks01 8 жыл бұрын
Why was a string used for the Quantity?
@michaelpicker9862
@michaelpicker9862 8 жыл бұрын
use Integer instead -its a copy-pasting oversight
@jorgee5693
@jorgee5693 4 жыл бұрын
THANK YOU
@paninapo813
@paninapo813 Жыл бұрын
Thank youu!!!
@RonSpwan11
@RonSpwan11 5 жыл бұрын
AWESOME!
@absoluz7
@absoluz7 8 жыл бұрын
How can I put data from Arrays or HashMaps inside the ObservableList?
@kolslaw94
@kolslaw94 8 жыл бұрын
The FXCollections class has static methods where you can pass in a Collection object to create an Observable with that Collection's data. I don't remember seeing one where you could pass in an array, but you can convert an array into a Collection pretty simply as well.
@spy64bit
@spy64bit 3 жыл бұрын
how to prevent insert duplicate number like Item_ID
@MyAvi92
@MyAvi92 8 жыл бұрын
thnks for your video it helped me a lot. I want know how to display data from an excel sheet in the tableView. plz help me! I can retrieve the data and display it on the console but can't display it on the GUI.
@mr.RAND5584
@mr.RAND5584 5 жыл бұрын
How to have auto resize column? Thanks in advance
@srikarmadhavapeddy8683
@srikarmadhavapeddy8683 6 жыл бұрын
Can we save the output in a file (Excel file)?
@pro-user255
@pro-user255 7 жыл бұрын
my doesn't show any table elements but column name only, why?
@nurlanungarbaev1410
@nurlanungarbaev1410 5 жыл бұрын
Hello I also have another result please help name.setCellValueFactory how to write a correct code so that the result is correct please write the text of the code correct
@DaEmperah
@DaEmperah 7 жыл бұрын
any idea why my tableView is blank not even showing the cells?
@elfenblut
@elfenblut 7 жыл бұрын
make your getter and setter "public"
@AlexisSniffer
@AlexisSniffer 8 жыл бұрын
Gracias
@اماديرأمان
@اماديرأمان 6 жыл бұрын
Thanks lot
@bm510
@bm510 4 жыл бұрын
Awesome tutorial Man, I cringe at these so called "real languages" when it comes to desktop apps and GUIs. App development must take decades lol. I'll use VBA, build a fully functional UI, connect to a database, and jam the data into the UI in about 20 lines of code lol
@csandreas1
@csandreas1 9 жыл бұрын
is this similar to c++?
@OpenGL4ever
@OpenGL4ever 9 жыл бұрын
csandreas1 The syntax is similar, but both programming languages are different enough to have their own room. For Example: Java does use a GarbageCollector. C++ does not. C++ classes mostly do need a destructor method, because there is no GarbageCollector. Java code is compiled into Java ByteCode, this code does run everywhere, where a Java Virtual Machine does run. C++ code is compiled natively, its compiled binary does run directly on the systems CPU architecture and must be recompiled for other CPU architectures. You can't use the same compiled binarys on all CPU architectures. That's one of the reasons why C++ is known as a system programming language. You wouldn't use Java as a system programming language. Java has a great standard library. The standard library from C++ is much smaller, which means, that you normally use 3rd party librarys in the C++ world or write everything on your own, which results in extra work. But all in all, they differ so much, that you won't use only one of those languages. If you take programming seriously, you will learn both of them. The choice for the one or the other language really depends on what software you are planing to write. The workload is also not the same. To programme an application where both languages are suitable for, programming it in Java, means that Java will often require you to invest less time into the programming to get the application done. C++ on the other side is much more expressive. The same task can be done very differently and with C++ you will more likely shoot yourself in the foot, but if performance is very important, C++ is in most times the way to go. But this does not mean, that Java would be slow. Its performance is good enough for most of the appilcations you might want to write.
@giulio7288
@giulio7288 Жыл бұрын
Mac M1, Java19, i got the table but empty and following error: ""javafx.scene.control.cell.PropertyValueFactory getCellDataReflectively WARNING: Can not retrieve property 'Name' in PropertyValueFactory: javafx.scene.control.cell.PropertyValueFactory@384a9e7a with provided class type: class application.Product....."... suggestions?
@ayoutubecommenter2674
@ayoutubecommenter2674 7 жыл бұрын
How did he call the product class? Or is it called in the getProduct() method?
@maxfactor4209
@maxfactor4209 3 жыл бұрын
why no FXML? this is messy
@granim32
@granim32 6 жыл бұрын
would love to see this down with an cvs file instead.
@TurskoVideos
@TurskoVideos 6 жыл бұрын
Just parse your information from the file into ArrayLists inside of an Object
@theb1524
@theb1524 4 жыл бұрын
is this still up to date ?
@hossamnasser9717
@hossamnasser9717 4 жыл бұрын
Lol Suure
@Allstarrp23
@Allstarrp23 3 жыл бұрын
This isn’t working in javaFX
@purple_gemini
@purple_gemini Жыл бұрын
7:02 please ignore... personal comment
@nurlanungarbaev1410
@nurlanungarbaev1410 5 жыл бұрын
I found a mistake thanks
@alexandersage7035
@alexandersage7035 5 жыл бұрын
cheese burgers, toilets and computers are the first thing you thought of for products to sell. I hope that doesn't represent your life.
JavaFX Java GUI Tutorial - 19 - Editable Tables
7:53
thenewboston
Рет қаралды 98 М.
Create TableView | JavaFX GUI Tutorial for Beginners
13:32
Java Code Junkie
Рет қаралды 21 М.
Mom had to stand up for the whole family!❤️😍😁
00:39
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
How to whistle ?? 😱😱
00:31
Tibo InShape
Рет қаралды 17 МЛН
Event Driven GUI   JavaFX Application Thread and EventQueue
29:31
JavaHandsOnTeaching
Рет қаралды 3,5 М.
JavaFX Java GUI Tutorial - 28 - Properties
11:17
thenewboston
Рет қаралды 89 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
JavaFX - Event Handling in JavaFX
23:29
Darshan University
Рет қаралды 4,7 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
Event Handling | JavaFX GUI Tutorial for Beginners
11:20
Java Code Junkie
Рет қаралды 14 М.
Java Data Structures Tutorial
1:39:50
Amigoscode
Рет қаралды 341 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1,2 МЛН
JavaFX Java GUI Tutorial - 16 - TreeView
14:30
thenewboston
Рет қаралды 100 М.
Mom had to stand up for the whole family!❤️😍😁
00:39