Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JTable One of the Column Cells have JDateChooserCellEditor() how to format it

  1. #1
    Junior Member
    Join Date
    Mar 2016
    Location
    INdia
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JTable One of the Column Cells have JDateChooserCellEditor() how to format it

    Hello guys

    I have a JTable 6 columns,Column 1 and Column 2 Cells have JDateChooserCellEditor(), i am getting following values like this 11 Mar, 2016,12 Mar, 2016.But I want to format JDateChooserCellEditor() to show something like this 11 Mar, 2016 HH:mm and 12 Mar, 2016 HH:mm.And my third cell have to give result of difference in time.24 hrs.my JTable is looking like this

    column 1
    Date 1
    11 Mar, 2016 12:00

    column 2
    date 2
    12 Mar, 2016 12:00

    column 3
    Time(diffrence in date1-date2 columns)
    24

    i am getting date editor in jable by following code and pls help me to format and give result in third column
    // column 1----( 11 Mar, 2016 HH:mm)
    TableColumn col1=DailyTbl.getColumnModel().getColumn(1);
    col1.setPreferredWidth(150);
    DailyTbl.setDefaultEditor(java.util.Date.class, new JDateChooserCellEditor());

    // Column 2------(12 Mar, 2016 HH:mm)

    TableColumn col1=DailyTbl.getColumnModel().getColumn(1);
    col1.setPreferredWidth(150);
    DailyTbl.setDefaultEditor(java.util.Date.class, new JDateChooserCellEditor());


  2. #2
    Member
    Join Date
    Feb 2016
    Location
    New Zealand
    Posts
    331
    Thanks
    0
    Thanked 24 Times in 23 Posts

    Default Re: JTable One of the Column Cells have JDateChooserCellEditor() how to format it

    i would assume there is a way to format the JDateChooserCellEditor
    you will have to create it as a local var, , set the format then assign it to the table

Similar Threads

  1. Jspinner(Time) in JTable one of the Column Cells
    By akathir79 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 10th, 2016, 23:26
  2. Insert Text in Column Cells
    By theperfectpunk in forum JavaFX
    Replies: 2
    Last Post: April 22nd, 2015, 12:18
  3. JTable Column Sizing
    By Jeff.Steinkamp in forum AWT / Java Swing
    Replies: 1
    Last Post: January 20th, 2013, 20:23
  4. Merge Cells in JTable
    By Stx in forum AWT / Java Swing
    Replies: 0
    Last Post: July 16th, 2012, 04:21
  5. JTable - multiple lines in a cell AND cells not editable?
    By friday in forum AWT / Java Swing
    Replies: 3
    Last Post: January 10th, 2011, 07:44