TableView column headers do not line up with rows

Right now I have a tableview with column headers that are wider than the cells in the rows of the table.
Anyone know what property or css style I need to adjust to give the cells a little more padding? I have not had any luck searching the web or these forums.
Edited by: astep on Feb 26, 2013 6:59 AM

Sorry it took me a little bit to strip things down and create the project. I used NetBeans to reproduce the effect and I tried to follow the same pattern in case it had a side effect. Sorry there is so much code here for such a simple demo. I'm going to play around with it some to see if removing some of the css eliminates the effect.
Sample.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="ConstraintsAnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="460.0" prefWidth="480.0" style="-fx-background-color:black" xmlns:fx="http://javafx.com/fxml" fx:controller="testtableview.SampleController">
  <children>
    <TitledPane fx:id="ConstraintsTitlePane" alignment="CENTER" animated="false" collapsible="false" contentDisplay="CENTER" opacity="0.75" text="Constraints by Stream Class">
      <content>
        <TableView fx:id="constraintsTableView" prefHeight="445.0" prefWidth="480.0" />
      </content>
    </TitledPane>
  </children>
</AnchorPane>stylesheet.css
.root {
-fx-base: rgb(50, 50, 50);
-fx-background: rgb(50, 50, 50);
-fx-control-inner-background:  rgb(50, 50, 50);
.table-view {
-fx-table-cell-border-color:derive(-fx-base,+10%);
-fx-table-header-border-color:derive(-fx-base,+20%);
.text-field{
     -fx-prompt-text-fill: White;
.table-cell {
     -fx-border-color: black;
.table-cell:hover {
     -fx-background: DimGray;
     -fx-background-color: DimGray;
.table-cell:selected {
     -fx-background: DimGray;
     -fx-background-color: DimGray;
.table-row-cell {
     -fx-border-color: black;
     -fx-control-inner-background: black;
.table-row-cell:hover {
     -fx-background: DimGray;
     -fx-background-color: DimGray;
.table-row-cell:selected {
     -fx-background: DimGray;
     -fx-background-color: DimGray;
}TestTableView.java
package testtableview;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class TestTableView extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
        Scene scene = new Scene(root);
        stage.setScene(scene);
        scene.getStylesheets().add(TestTableView.class.getResource("stylesheet.css").toExternalForm());
        stage.show();
    public static void main(String[] args) {
        launch(args);
}Model.java
package testtableview;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
public class Model {
     private static Constraint temp = new Constraint();
     private static Model instance = null;
     private Model() {
     public static Model getInstance() {
          if (instance == null) {
               instance = new Model();
               constraintsList.add(temp);
          return instance;
     private static ObservableList<Constraint> constraintsList = FXCollections
               .observableArrayList();
     public ObservableList<Constraint> getConstraintsList() {
          return constraintsList;
     public static class Constraint {
          private SimpleStringProperty ColumnOne = null;
          private SimpleStringProperty ColumnTwo = null;
          private SimpleStringProperty ColumnThree = null;
          private SimpleStringProperty ColumnFour = null;
          private SimpleStringProperty ColumnFive = null;
          private SimpleStringProperty ColumnSix = null;
          private SimpleStringProperty ColumnSeven = null;
          public String getColumnOne() {
               return ColumnOne.get();
          public void setColumnOne(String input) {
               ColumnOne.set(input);
          public String getColumnTwo() {
               return ColumnTwo.get();
          public void setColumnTwo(String input) {
               ColumnTwo.set(input);
          public String getColumnThree() {
               return ColumnThree.get();
          public void setColumnThree(String input) {
               ColumnThree.set(input);
          public String getColumnFour() {
               return ColumnFour.get();
          public void setColumnFour(String input) {
               ColumnFour.set(input);
          public String getColumnFive() {
               return ColumnFive.get();
          public void setColumnFive(String input) {
               ColumnFive.set(input);
          public String getColumnSix() {
               return ColumnSix.get();
          public void setColumnSix(String input) {
               ColumnSix.set(input);
          public String getColumnSeven() {
               return ColumnSeven.get();
          public void setColumnSeven(String input) {
               ColumnSeven.set(input);
          public Constraint() {
               this.ColumnOne = new SimpleStringProperty("");
               this.ColumnTwo = new SimpleStringProperty("");
               this.ColumnThree = new SimpleStringProperty("");
               this.ColumnFour = new SimpleStringProperty("");
               this.ColumnFive = new SimpleStringProperty("");
               this.ColumnSix = new SimpleStringProperty("");
               this.ColumnSeven = new SimpleStringProperty("");
}ConstraintsTableViewModel.java
package testtableview;
import testtableview.Model.Constraint;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
public class ConstraintsTableViewModel {
     private static TableView<Constraint> table = new TableView<Constraint>();
     private static ObservableList<TableColumn<Constraint, String>> columnList = FXCollections
               .observableArrayList();
     public static TableView<Constraint> setupView() {
          TableColumn<Constraint, String> ColumnOneCol = new TableColumn<Constraint, String>("Example Exam1");
          ColumnOneCol.setMinWidth(95.0);
          ColumnOneCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnOne"));
          columnList.add(ColumnOneCol);
          TableColumn<Constraint, String> ColumnTwoCol = new TableColumn<Constraint, String>("Example 2");
          ColumnTwoCol.setMinWidth(55.0);
          ColumnTwoCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnTwo"));
          columnList.add(ColumnTwoCol);
          TableColumn<Constraint, String> ColumnThreeCol = new TableColumn<Constraint, String>("Example3");
          ColumnThreeCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnThree"));
          ColumnThreeCol.setMinWidth(70);
          columnList.add(ColumnThreeCol);
          TableColumn<Constraint, String> ColumnFourCol = new TableColumn<Constraint, String>("Example4");
          ColumnFourCol.setMinWidth(60.0);
          ColumnFourCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnFour"));
          columnList.add(ColumnFourCol);
          TableColumn<Constraint, String> ColumnFiveCol = new TableColumn<Constraint, String>("Example5");
          ColumnFiveCol.setMinWidth(60.0);
          ColumnFiveCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnFive"));
          columnList.add(ColumnFiveCol);
          TableColumn<Constraint, String> ColumnSixCol = new TableColumn<Constraint, String>("Example6");
          ColumnSixCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnSix"));
          ColumnSixCol.setMinWidth(55);
          columnList.add(ColumnSixCol);
          TableColumn<Constraint, String> ColumnSevenCol = new TableColumn<Constraint, String>("Exam7");
          ColumnSevenCol.setCellValueFactory(new PropertyValueFactory<Constraint, String>("ColumnSeven"));
          ColumnSevenCol.setMinWidth(55);
          columnList.add(ColumnSevenCol);
          table.getColumns().addAll(columnList);
          return table;
}SampleController.java
package testtableview;
import testtableview.Model.Constraint;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableView;
public class SampleController implements Initializable {
    @FXML
     private TableView<Constraint> constraintsTableView;
     private Model cm = null;
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        cm = Model.getInstance();
     constraintsTableView.setItems(cm.getConstraintsList());
     constraintsTableView.getColumns().addAll(ConstraintsTableViewModel.setupView().getColumns());
}

Similar Messages

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • TableView columns headers customization using CSS

    Hi,
    I'm trying to customize the TableView columns headers using CSS, but up until now, I was not able to find the CSS class name for the previously mentioned elements.
    Can anyone point me to a document or link where I can find all the available CSS classes for TableView and, why not for all the JAVA FX 2.0 widgets.
    Thanks,
    Alin

    Here's the Oracle CSS Reference guide for JavaFX:
    http://docs.oracle.com/javafx/2.0/api/javafx/scene/doc-files/cssref.html#tableview
    You can also look at caspian.css inside the javafx runtime as it is the default CSS sheet for JavaFX applications and is a good place to see a lot of the style classes in use. The particular class you want is .table-view .column-header{} for individual columns or .table-view .column-header-background{} for the whole table header in general. Hope that helps.

  • Showing Grid without column headers and Grid lines

    Hi all
    does anyone knows how can set a grid object to display without grid lines and without column headers?
    appreciate the help
    Yoav

    Hi Yechiel,
    When you work with the grid you just have to drag it into your srf and bind it with some table by specifying the table name in its properties.
    When the form launches the columns of the grid  will be created automatically as per the number of columns in the table.The caption of the column in the grid will be the same as that of the name of the column in the table.The only condition for this is that the table should contain some records, if the table is empty no grid lines and the column header will be displayed .
    I hope this meet your requirements.
    Below I am sending you the code segments with the help of which you can control the grid progamatically...
    //Declaring the grid object
    Grid oGrid;
    //Initializing the grid object
    oGrid=(SAPbouiCOM.Grid)oForm.Items.Item("MBS_Grid").Specific;
    //Adding a new data table to the form
    oSboApplication.Forms.ActiveForm.DataSources.DataTables.Add("MBS_DataTable");
    //Assigning the data table to the grid
    oGrid.DataTable = oSboApplication.Forms.ActiveForm.DataSources.DataTables.Item( "MBS_DataTable" );
    // This statement will clear the grid
    oGrid.DataTable.Rows.Clear();
    // In this way you can set the column properties
    oGrid.Columns.Item(0).Editable=false;
    oGrid.Columns.Item(1).Editable=false;
    oGrid.Columns.Item(2).Editable=false;
    oGrid.Columns.Item(3).Editable=false;
    oGrid.Columns.Item(4).Editable=false;
    oGrid.Columns.Item(5).Editable=false;
    // In this way you can set the column width
    oGrid.Columns.Item( 0 ).Width = 50;
    oGrid.Columns.Item( 1 ).Width = 60;
    oGrid.Columns.Item( 2 ).Width = 130;
    //This is the way you can set a user defined caption on the column header.
    query="select U_CTX_MOVCODE as 'Movie Code',U_CTX_MOVNAME as 'Movie Name',U_CTX_SHELF as 'Shelf Number',U_CTX_SPACE as 'Space Number',U_CTX_CARDCODE as 'Customer Code',U_CTX_RENTED as 'Rent Status' from [@CTX_VSTORE] order by Code";
    Regards,
    Prashant

  • Word label template does not line up with avery 5160 8160 paper, Mac Maverick

    Word label template does not line up using avery 5150 or 8160 paper

    These forums are for Apple products and the best place to ask about problems with MS stuff is in there newsgroups:
    http://www.microsoft.com/mac/community/community.aspx?pid=newsgroups
    When you don't see Post New Topic, it means you are not in a Forum but a Category page listing one or more Forums. You need then to enter a Forum by clicking on one. Then you will see the Post New Topic item at the top left.

  • Clips do not line up with playhead

    Not only do all of a sudden none of my clips line up with the playhead, the last 3 seconds of a large majority have become still images. Most of this damage occured immediately after emptying the trash. Please help its due tomorrow!

    I don't know how to correct your problem, but I know what caused it. It's a bug in iMovie's code for emptying trash, so you may lose your entire project. So, don't EVER empty iMovie's trash again.

  • Flash Will Not Line Up With Surrounding Graphics In Dreamweaver

    Hello All:
    I have been trying to get my Flash .swf file to line up with
    the surrounding graphics in my page. I used the same sliced image
    in the page and it lines up and for some reason when I put that
    same slice into Flash, it becomes slightly skewed by a few pixels.
    Here is what the page/problem looks like:
    http://www.shannawise.com/images/FlashProb.jpg
    Any suggestions?
    NOTE: I'm using Dreamweaver MX

    Tyring to get pixel perfect mixing Flash & others always
    causes headaches. A
    better approach may be to place you flash reference in a
    layer that sits
    over a background graphic
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "swnova22" <[email protected]> wrote in
    message
    news:eiqhaj$qcr$[email protected]..
    > Hello All:
    >
    > I have been trying to get my Flash .swf file to line up
    with the
    > surrounding
    > graphics in my page. I used the same sliced image in the
    page and it
    > lines up
    > and for some reason when I put that same slice into
    Flash, it becomes
    > slightly
    > skewed by a few pixels.
    >
    > Here is what the page/problem looks like:
    >
    http://www.shannawise.com/images/FlashProb.jpg
    >
    > Any suggestions?
    > NOTE: I'm using Dreamweaver MX
    >

  • Is it possible for the labels of new fields to not line up with already existing fields?

    I am attempting to create a form where some of the labels are longer than others. Unfortunately, it appears that all labels have to match up exactly with each other. So, when I create a new field and extend the length of the label, it extends the length of the labels on all other fields as well. Please tell me there's a way to fix this. It seems elementary that users would need lables of varying lengths at times.

    All fields on the first column share the same column width.
    If you have a field to the right of another first (making it not the first element on the row) then it can have it own label width.
    Gen

  • How do I input column headers in an Excel report with variable width columns?

    Hi:
    I have read this question before but I can´t open the link, when I try to download the solution I get the following : HTTP Status 404 The requested resource is not available.
    Can anyone help me with the solution ? I just want to put a header for each column (thermocouple 1, thermocouple 2, anemometer , etc).
    In advance, thanks for all your help !
    Solved!
    Go to Solution.

    Perhaps you need to take some tutorials.
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours
    Attachments:
    Example_VI_BD.png ‏11 KB

  • Pixel grid does not line up with rulers

    AICS 5.5 - I'm working in a doc with measurement set to pixels, showing the grid set to increments of 1 pixel. I reset the rulers by double-clicking on the origin. The grid does not align to the ruler pixels. It's about halfway between on the y axis and about 3/5 of the way off on the x axis. When I create objects with the origin and width/height set to even pixels (which makes them fall between the pixel grid lines) and save for web, the edges are antialiased.
    How do I make the rulers and pixel grid register with each other? It seems odd this wouldn't be the default.

    Aha - it turns out the artboards were not placed precisely on the pixel grid. Their origins were set between whole pixel values. The rulers went with the artboards, so their pixels didn't match the grid pixels.
    Should be possible to just move the artboard and get everything lined up again.
    Still - I would  think the grid would readjust to the origin of whatever artboard you are currently working on, just as the rulers do. It not doing so is unexpected behavior.

  • Freshly recorded tracks do not line up with existing music

    When I go to play back freshly recorded track(s) from any type of audio source, they play about a half second earlier than the rest of the existing tracks. I have to manually line them up. I used Logic flawlessly for about six months and then out of nowhere this started happening. Everything in my system has remained untouched since the day I set it up and I have not changed any relevant settings that I know of. Anyone else have this problem?

    It happened to me too. And I found out that somehow in the preferences my recording delay was set to minus 1000.
    You might check that
    Oz

  • When i print a check from quick books wireless, the print does not line up with the preprinted check

    HP Officejet6500A Plus 
    I have printed check from Quick Brook Pro successfully using a USB cable.  When I print checks
    wireless the print is a half inch too low on the check.  I loaded checks three time all with the same result

    Hi MartinR
    Thank you for your reply, i have tried what you suggest, and it did not work, the i DVD opening title changed but not the embedded movie.
    Perhaps it is a setting in Final Cut Express?
    After capturing my footage, i open a new project then i convert all clips to anamorphic, to give me the letterbox effect, i have tried now with and without anamorphic.
    In my canvas screen, the footage does not fill the square, even if i have not selected anamorphic, and fall well within the TV safe areas, but the only way to ill the canvas up is to crop it bigger, but still when i export it does not give me the full screen view.
    Any ideas?

  • APD - Column Headers are not displaying properly when downloaded

    Hi All,
    I am trying to download a simple query as a comma delimited file on my desktop using APD.
    When I execute the APD, the all the data getting properly downloaded as required but I am facing the following problems.
    1) The column heading are coming as  garbage characters particularly for keyfigures
    2) The keyfigures are getting displayed first and then characters, I expect them similarly the query display
    3) I don't want to display the UNITS of the keyfigures to be displayed.
    Please let me know if anybody has idea on this.
    Regards,.
    Tapan

    Hi Tapan,
    Try using "Hide or Rename Columns(projection)".
    This allows you to rearrange the order of columns in file and also to rename the descriptions as needed.
    Regards,
    Vidya Sagar

  • How to set column names when not using object of row data in  constructer

    hello i am using JTable constructer as
    public JTable(int numRows,
    int numColumns)
    can i set column names for the columns .How?

    hi,
    sure you can: Create a subclass of DefaultTableModel and overwrite the method public String getColumnName(int) which returns the column name of a specific column. Then use this subclass as the data model for the table.
    best regards, Michael

  • Column headers and data are mismatched in Data tab of views after move col.

    Hi,
    Currently, I am using Windows XP, SQL Developer Version 1.2.1 Build Main 32.13.
    Java platform 1.5.0_06
    Oracle IDE 1.2.1.3213
    I'm having trouble with display of data from views in the "Data" tab of SQL Developer. If I move a column left or right of its original place, the data no longer line up with the proper column heading. The data are in the correct order, but the column headers are out of whack. Also, in the Single Record View, the data and column headers are mismatched.
    Refreshing the view, closing the view, closing and reopening SQL Developer do not "reset" the view so that the data and proper column headers are lined up. Even dropping and recreating the view does not force SQL Developer to use the proper data-column header match.
    Just to be clear, the data within the view is fine. It is the display of the data-column headers in the "Data" tab of SQL Developer (and the single record view) that is wrong. The mismatch seems to occur after a column is moved in the view.
    Is this a bug? I like the ability to move columns around within the display of the view. However, much more important that the column headers and data line up correctly.
    Thanks,
    Morgan

    Thanks much. I found the correct file, deleted it, and the column headers and data match up again.
    I found the correct file by searching the directory for one of the column names that occurs in the view (though I had to find both instances of "COLUMN_NAME" and "COLUMN NAME" (without the underscore)). Not sure why there were files with both versions.
    Do you know if there is any way to prevent those XXXXXXXXXTableSettings.xml files from writing all together (oracle.javatools.controls.nicetable.NiceTablePersistentSettings)? I looked through the SQL Developer preferences but nothing jumped out as being the setting to switch off.
    Should I be doing anything in particular to bring more attention to this potential bug so it might get fixed in a future release?
    Thanks again,
    Morgan

Maybe you are looking for

  • Track users activity on on the switch

    HI team ,  Thanks in advance....   Is there any show commands available for find which user execute which command in cisco switch.in the show logg I can see only which user logged in to the switch at what time but cant able to find what thy done afte

  • HP LaserJet CP1518 only printing black and white!

    Here is a weird issue. Today, my HP color LaserJet will only print Pages documents in B&W! The document in question printed in color yesterday. I tried a new document, and that one printed B&W! I 'printed' to a PDF and in Preview it was color, but pr

  • Crystal Reports license problem

    Hi, My customer's server has Crystal Reports Professional 9 installed. We have application installed on this server also. This application is deployed as a Windows service. This Windows service is calling multiple reports using threads (3 maximum con

  • Master detail form issue

    Hello, I am unsure if this is a bug or how I'm doing things. I'm using version 4.1. I am creating a master/detail report (on the same page) using the wizard to create the page. I have no problem creating the page and it works. The only changes I make

  • Imac 27 with ps3

    i have imac intel 27" 2012 version. can i connect my play station 3 to imac ??help me