Bipin Bhandari
Bipin Bhandari

Reputation: 682

How to remove the empty rows from TableView Of JAVA FX 2.0

I have been trying to remove the empty rows from table view but i am not able to do that with css which i have read in some blog

here the css is which i am applying on that /-------------------------------------------------

.table-row-cell:empty {
    -fx-background-color: white;
}

.table-row-cell:empty .table-cell {
    -fx-border-width: 0px;
}

/-------------------------------------------------

But iam getting the error

/------------------------------------

SEVERE: javafx.scene.control.Control loadSkinClass Failed to load skin 'com.sun.javafx.scene.control.skin.TableRowSkin' for control TableView@125ff34[styleClass=table-view table-row-cell]
java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at javafx.scene.control.Control.loadSkinClass(Unknown Source)
    at javafx.scene.control.Control.impl_cssSet(Unknown Source)
    at javafx.scene.Node.impl_cssSet(Unknown Source)
    at com.sun.javafx.css.StyleHelper.transitionToState(Unknown Source)
    at javafx.scene.Node.impl_processCSS(Unknown Source)
    at javafx.scene.Parent.impl_processCSS(Unknown Source)
    at javafx.scene.control.Control.impl_processCSS(Unknown Source)
    at javafx.scene.Parent.impl_processCSS(Unknown Source)
    at javafx.scene.Parent.impl_processCSS(Unknown Source)
    at javafx.scene.Node.processCSS(Unknown Source)
    at javafx.scene.Node.processCSS(Unknown Source)
    at javafx.scene.Scene.doCSSPass(Unknown Source)
    at javafx.scene.Scene.access$2900(Unknown Source)
    at javafx.scene.Scene$ScenePulseListener.pulse(Unknown Source)
    at com.sun.javafx.tk.Toolkit.firePulse(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit$8.run(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
    at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:722)

SEVERE: javafx.scene.control.Control impl_processCSS The -fx-skin property has not been defined in CSS for TableView@125ff34[styleClass=table-view table-row-cell]

/-------------------------------------------------------------

Does anybody have idea how to resolve it? or any other way to remove the empty rows.

Thanks in advance.

Upvotes: 2

Views: 5582

Answers (2)

Oumalek Mohamed
Oumalek Mohamed

Reputation: 96

this is the solution : inside your css file add this :

.table-row-cell:empty:odd, .table-row-cell:empty:even {
    -fx-background-color: transparent;
}

tested and worked for me

Click to show my tableview

Upvotes: 0

Sergey Grinev
Sergey Grinev

Reputation: 34528

Your css worked for with JavaFX 2.1. Try next:

  • update to JavaFX 2.1
  • remove everything from your css file except these classes

enter image description here

Upvotes: 1

Related Questions