Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8863397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:58:05+00:00 2026-06-14T15:58:05+00:00

As you can see on the picture the text alignment for each colum is

  • 0

enter image description here

As you can see on the picture the text alignment for each colum is set to left alignment. Is there any way to change this? So far I’ve tried within my CSS file:

#Cols{
    text-align: right;
}

I have also tried:

#Cols{
    -fx-text-alignment: right;
}

Does anyone know how I can change the alignment to right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:58:07+00:00Added an answer on June 14, 2026 at 3:58 pm

    Alignment of all table columns:

    Starting from JavaFX-8, you can use newly defined CSS selector table-column,

    #my-table .table-column {
      -fx-alignment: CENTER-RIGHT;
    }
    

    For JavaFX-2,
    To achieve this define a CSS selector:

    #my-table .table-cell {
        -fx-alignment: CENTER-RIGHT;
         /* The rest is from caspian.css */
    
        -fx-skin: "com.sun.javafx.scene.control.skin.TableCellSkin";
        -fx-padding: 0.166667em; /* 2px, plus border adds 1px */
    
        -fx-background-color: transparent;
        -fx-border-color: transparent -fx-table-cell-border-color transparent transparent;
        -fx-border-width: 0.083333em; /* 1 */
        -fx-cell-size: 2.0em; /* 24 */
        -fx-text-fill: -fx-text-inner-color;
    }
    

    and set the id of the tableview.

    tableView.setId("my-table");
    

    Alignment of single table column:

    Starting from JavaFX-8, you can apply the styling directly to TableColumn,

    firstTextCol.setStyle( "-fx-alignment: CENTER-RIGHT;");
    

    or with css,

    firstTextCol.getStyleClass().add( "custom-align");
    

    where

    .custom-align { 
      -fx-alignment: center-right; 
    } 
    

    For JavaFX-2,
    To apply different alignments to different columns you need to set cell factory for that column. For instance assume that the 1st column in your table should be aligned to the left while other columns use the table’s default alignment (CENTER-RIGHT in your case).

    firstTextCol.setCellFactory(new Callback<TableColumn, TableCell>() {
                public TableCell call(TableColumn p) {
                    TableCell cell = new TableCell<Person, String>() {
                        @Override
                        public void updateItem(String item, boolean empty) {
                            super.updateItem(item, empty);
                            setText(empty ? null : getString());
                            setGraphic(null);
                        }
    
                        private String getString() {
                            return getItem() == null ? "" : getItem().toString();
                        }
                    };
    
                    cell.setStyle("-fx-alignment: CENTER-LEFT;");
                    return cell;
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of, please check this picture: As you can see, left from Today and
As you can see the picture below that when there is no item in
As you can see on the example picture, there is some type of white
I you can see on the picture, the text is not aligned vertically in
alt text http://barbarosalp.com/questions/list.png Hi, As you can see on the picture above i have
I have a problem with webView. As you can see on the picture there
Please take a look at this picture: You can see a QTableView with some
In a solution I have three projects,you can see on picture.Want to access project-1
Imagine that HTML page is a game surface (see picture). User can have n
A picture says more than a thousand words. As you can see, my fill

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.