How to get Data in my JComponents?

I want to fill a JTable generated with the GUI Designer with some data. My first try was to get a new instance of JTable and fill the Constructor of it with row-Vector and collumn vector. But i got just NullPointerException by adding it to the generated panel.
My second step was to make a custom create of my Jtable but always my customized code in the bounded class was overridden by intellij.
the 3rd try was to use the Data Binding Wizard.
But with it there's a problem. i can just bind TextFields or Textareas with it. The Jtable is not displayed. And so I have really no idea how to get my Jtable initialized and later also updated. Thx for your help.

3 comments

Hello stefan,

To fill your table with data, you don't need to create a new JTable instance
either in the constructor or via the custom create feature. Just create a
TableModel, fill it with data and assign it to the JTable which gets instantiated
by the UI Designer.

I want to fill a JTable generated with the GUI Designer with some
data. My first try was to get a new instance of JTable and fill the
Constructor of it with row-Vector and collumn vector. But i got just
NullPointerException by adding it to the generated panel.

My second step was to make a custom create of my Jtable but always my
customized code in the bounded class was overridden by intellij.

the 3rd try was to use the Data Binding Wizard.

But with it there's a problem. i can just bind TextFields or Textareas
with it. The Jtable is not displayed. And so I have really no idea how
to get my Jtable initialized and later also updated. Thx for your
help.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5262211#5262211

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

if i do so, i get NullPointerException:

DefaultTableModel dtm = new DefaultTableModel(vectorDataAll, titles);
table1.setModel(dtm);

vectorData is a Vector of Vectors of String Values
vector titles is a vector with string values.

in all vectors doesnt appear any null object while debugging, but the NullPointerException occurs. I really dunno why.

0

Hello stefan,

How do you compile your classes? Do you use bytecode or source code generation
for the UI Designer?

if i do so, i get NullPointerException:

DefaultTableModel dtm = new DefaultTableModel(vectorDataAll, titles);
table1.setModel(dtm);

vectorData is a Vector of Vectors of String Values vector titles is a
vector with string values.

in all vectors doesnt appear any null object while debugging, but the
NullPointerException occurs. I really dunno why.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5262235#5262235

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.