Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Display of value in Tabel cell
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Suresh
Display of value in Tabel cell
0 Answer(s)      3 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);

}

}


Advertisement
View Answers

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
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
Advertisements
JFreeChart- Display coordinate value .
JFreeChart- Display coordinate value .  How to Mark Coordinte value on top of the bar
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> <
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
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"%> <
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
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 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
change content of cell javascript
change content of cell javascript  change content of cell javascript
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
Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView
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
editing cell in a table - JDBC
editing cell in a table  how can i edit a cell in a table and save the change to a database  Hi Friend, Try the following code: 1)updateDatabase.jsp RollNo Name Class "> "> ">
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     
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
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
css table cell margin
css table cell margin  How can i put margin between two columns(cell margin)?   In your CSS you can set the desired margin between two cells as given below.. padding-right:10px;   now you need to call
Height for cell in table view - UITableView
Height for cell in table view - UITableView  UITableview height for cell What is the height for cell in table view iPhone mobile application
Setting Cell Values in JTable
in the specified location in terms of cell address in the JTable. We have set the value... 'Math' value. Another cell address is 4 row and 1 column. The cell value of ... and set the cell value by applying  setValueAt() method on  the specified
Advertisements
 

 

 

DMCA.com