Display of value in Tabel cell

 
 

Share on Google+Share on Google+

Suresh
Display of value in Tabel cell
0 Answer(s)      6 years and 10 months ago
Posted in : Java Beginners

I have added a custom field in the table cell by defining the cell editor.The cell is having a text field and calendar.When i select a date in the calendar the date will be displayed in the cell as formatted by me.The formatter I am using will format the date which was included in the renderer of that table.But when I am selecting the text field, i.e,when it is having focus or cursor,the date which it was displaying is getting changed to another format.

The original format in formatter - dd-MM-yyyy(01-03-2011) The format the cell is showing when its in focus - Mon,dd,yyyy(Mar,01,2011).

I need the format to be same always.3

The code is the editor component

public class DateCustomCellEditor implements TableCellEditor, ChangeListener{ private TableCellEditor editor; private CalendarComboBox customEditorButton = new CalendarComboBox(); protected JTable table; protected int row, column;

public DateCustomCellEditor(TableCellEditor editor){ 
    this.editor = editor; 
    customEditorButton.addChangeListener(this); 
    customEditorButton.setFocusable(false); 

} 
public Component getTableCellEditorComponent(JTable table, Object value
        , boolean isSelected, int row, int column){ 
    JPanel panel = new JPanel(new BorderLayout()); 
    panel.add(editor.getTableCellEditorComponent(table, value, isSelected, row, column)); 
    panel.add(customEditorButton, BorderLayout.EAST); 
    this.table = table; 
    this.row = row; 
    this.column = column; 
    return panel; 
} 
public Object getCellEditorValue(){ 
    return editor.getCellEditorValue(); 
} 
public boolean isCellEditable(EventObject anEvent){ 
    return editor.isCellEditable(anEvent); 
} 
public boolean shouldSelectCell(EventObject anEvent){ 
    return editor.shouldSelectCell(anEvent); 
} 
public boolean stopCellEditing(){ 
    return editor.stopCellEditing(); 
} 
public void cancelCellEditing(){ 
    editor.cancelCellEditing(); 
} 
public void addCellEditorListener(CellEditorListener l){ 
    editor.addCellEditorListener(l); 
} 
public void removeCellEditorListener(CellEditorListener l){ 
    editor.removeCellEditorListener(l); 
} 
public final void stateChanged(ChangeEvent e){ 
    editor.cancelCellEditing(); 
    CalendarComboBox cal = (CalendarComboBox)e.getSource();
    editCell(table, row, column,cal.getCalendar().getTime());
}
protected void editCell(JTable table, int row, int column,Date Value){

    table.setValueAt(Value, row, column);

}

}

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Display of value in Tabel cell
Display of value in Tabel cell  I have added a custom field in the table cell by defining the cell editor.The cell is having a text field and calendar.When i select a date in the calendar the date will be displayed in the cell
JFreeChart- Display coordinate value .
JFreeChart- Display coordinate value .  How to Mark Coordinte value on top of the bar
Advertisements
Data Validation from Spread Sheet Cell's Value
Data Validation from Spread Sheet Cell's Value In this section, you will learn how to validate the value entered in a cell from the values already... the validation on cell A1 from the value contained from B1 to D1. It also show you
To store value in session & display it
To store value in session & display it  Hello..I m trying to run...="add"> <!-- <input type="checkbox" name="book1cat" value="JSP" />JSP <input type="checkbox" name="book1cat" value="C
. Display JavaScript dropdown selected value
you select any value from list, alert will display that. In var.... Display JavaScript dropdown selected value  How to get the selected value from dropdown box? I am using javascript.   <html> <
how to display the value of termcell name in label
how to display the value of termcell name in label  want to display the tercell name in label report of pending apllication of termcellname code...="display"%> <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%> <
Table Empty Cell in HTML
Table Empty Cell in HTML       The Table Empty Cell in HTML define no content inside a cell of table. The code is not able to display border around the empty cell in a table
java script display value - Java Beginners
java script display value  my code is below: my problem is: the value 'firstname' is not showed with getparameter in .jsp file? (when click submit button in form) Main file: Name: file java
how to display textbox value based on selected option value?
how to display textbox value based on selected option value?  Hi,I... on first value I finished above code. ID: xx Name:xx xx is baesd on second and first value. But it is that l can't do that. now, l post my code
how to use dropdown list in JSP and display value in same page
how to use dropdown list in JSP and display value in same page  I... one option the value must get displayed below it in the same page as: Value selected = B Now if choose another option, new message should be printed
how to display each arraylist value on new page in jsp
how to display each arraylist value on new page in jsp  hi!!!! i want to display each arraylist value on new page in jsp????? and also want to access the arraylist values using next button..... any help would be appreciated
I am not able to display the selected value of my combobox
I am not able to display the selected value of my combobox   <?php echo "<select name=\"hello\">\n"; echo "<option value=\"NULL\">...["unitcode"]; $i=$i+1; echo "<option value=''>$strB<
how to display data from database according to entered value in search field
how to display data from database according to entered value in search... BMI value and display the results accordingly. 1)search.jsp: <html> <...;/b></td> <td>: <input type="text" name="bmi_value" id="BMI
How to collect Java input field value display into Jtable?
How to collect Java input field value display into Jtable?  <p>... as the following information. - display the value in the JTable. If in the GUI as per view...;text rate - input interest rate</li> <li>text Result - Display
differences between cell spacing and cell padding
differences between cell spacing and cell padding  What are the differences between cell spacing and cell padding
how to display the nearest palaces for the given latitude and longitude value in google map in android
how to display the nearest palaces for the given latitude and longitude value in google map in android  i m working in android. i need to display the nearest palaces with their image for the given latitude and longitude value
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls
Checking Date Value of Excel Cells
the date value contained in a excel cell using Apache POI. Date can have...;The cell contains a date value: " + cell.getDateCellValue()); } } catch... data type is numeric. The cell contains a date value: Thu Jun 30 00:00:00 IST
change content of cell javascript
change content of cell javascript  change content of cell javascript
Excel Validating Value in Range
Excel Validating Value in Range In this section, you will learn how to validate a cell's value within a defined range using Apache POI. EXAMPLE In this below example, you will learn how to validate a cell's value within
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.   I have the same problem.plz help me. I have MySQL... have to display the Nodename and packageno. i.e.,select nodename,packageno from
base the value of first combo box, how i display the second combox - JSP-Servlet
base the value of first combo box, how i display the second combox    i have a combo box for classes. my requirement is when i select the class, if class is 11 or 12 the second combo box of subject should be appear. please
Re: base the value of first combo box, how i display the second combox - JSP-Servlet
Re: base the value of first combo box, how i display the second combox   Dear Sir, in this program when i click on submit button, the corrosponding value of combo box should be sent. but when i clicked to submit button, it do
Getting Cell Values in a JTable
; at a specified row and column position in JTable. The cell values display...;java GetCellValues Cell value of 3 column and 3 row :Biology Cell... Getting Cell Values in a JTable     
Re: base the value of first combo box, how i display the second combox - JSP-Servlet
Re: base the value of first combo box, how i display the second combox    thanks for your reply. i want to know suppose the second combo box appear only when i select the class 11th or 12th. please review. your answer

Ads

 
Advertisement null

Ads