Click here to Skip to main content
16,005,241 members
Home / Discussions / Java
   

Java

 
AnswerRe: ECG Analysis Pin
Richard MacCutchan10-Feb-17 10:30
mveRichard MacCutchan10-Feb-17 10:30 
QuestionJava Coding Guidelines Pin
Jonathan Hicks3-Feb-17 6:34
Jonathan Hicks3-Feb-17 6:34 
QuestionRe: Java Coding Guidelines Pin
Richard MacCutchan3-Feb-17 6:44
mveRichard MacCutchan3-Feb-17 6:44 
AnswerRe: Java Coding Guidelines Pin
Jonathan Hicks3-Feb-17 6:47
Jonathan Hicks3-Feb-17 6:47 
GeneralRe: Java Coding Guidelines Pin
Richard MacCutchan3-Feb-17 6:56
mveRichard MacCutchan3-Feb-17 6:56 
AnswerRe: Java Coding Guidelines Pin
Peter_in_27803-Feb-17 10:24
professionalPeter_in_27803-Feb-17 10:24 
Questionbookstore java project Pin
Amit Kumar Patni31-Jan-17 15:19
Amit Kumar Patni31-Jan-17 15:19 
AnswerRe: bookstore java project Pin
Richard MacCutchan31-Jan-17 20:37
mveRichard MacCutchan31-Jan-17 20:37 
Questionhow write in file (.xls) without delete the older data Pin
iheb1131-Jan-17 9:47
iheb1131-Jan-17 9:47 
AnswerRe: how write in file (.xls) without delete the older data Pin
Richard MacCutchan31-Jan-17 20:39
mveRichard MacCutchan31-Jan-17 20:39 
QuestionJava Networking Class Pin
Mohammad Umer Qureshi30-Jan-17 1:37
Mohammad Umer Qureshi30-Jan-17 1:37 
AnswerRe: Java Networking Class Pin
Richard Deeming30-Jan-17 2:12
mveRichard Deeming30-Jan-17 2:12 
AnswerRe: Java Networking Class Pin
Jochen Arndt30-Jan-17 2:13
professionalJochen Arndt30-Jan-17 2:13 
Questionbookstore java project Pin
Amit Kumar Patni29-Jan-17 3:17
Amit Kumar Patni29-Jan-17 3:17 
AnswerRe: bookstore java project Pin
Richard MacCutchan29-Jan-17 3:38
mveRichard MacCutchan29-Jan-17 3:38 
Questionget cell to excel file Pin
iheb1127-Jan-17 4:45
iheb1127-Jan-17 4:45 
AnswerRe: get cell to excel file Pin
Richard MacCutchan27-Jan-17 5:02
mveRichard MacCutchan27-Jan-17 5:02 
GeneralRe: get cell to excel file Pin
iheb1127-Jan-17 5:39
iheb1127-Jan-17 5:39 
GeneralRe: get cell to excel file Pin
Richard Deeming27-Jan-17 6:05
mveRichard Deeming27-Jan-17 6:05 
GeneralRe: get cell to excel file Pin
Richard MacCutchan27-Jan-17 6:18
mveRichard MacCutchan27-Jan-17 6:18 
GeneralRe: get cell to excel file Pin
iheb1127-Jan-17 10:06
iheb1127-Jan-17 10:06 
Questionjava_excel Pin
iheb1126-Jan-17 13:07
iheb1126-Jan-17 13:07 
i need to get data from a file excel in java and to display the data on a jTable please help me to resolve this problem tnx
i was try this code but i think is incorrect



<
public Object getCellValue(Sheet sheet, int rowNum, int colNum) {
 
    Row row = sheet.getRow(rowNum);
    if ( row==null ) {
         return null;
    }
    else {
         Cell cell = row.getCell(colNum);
         if ( cell==null ) {
            return null;
         }
         else {
             return getCellValue(cell);
         }
    }
 
}
public Object getCellValue(Cell cell) {
switch (cell.getCellTypeEnum()) {
case CellType.STRING:
    return cell.getRichStringCellValue().getString();
case CellType.NUMERIC:
    if (DateUtil.isCellDateFormatted(cell)) {
        return cell.getDateCellValue();
    } else {
        return cell.getNumericCellValue();
    }
case CellType.BOOLEAN:
    return cell.getBooleanCellValue();
case CellType.FORMULA:
    return evalCell(cell); 
case CellType.BLANK:
return null;
default:
throw new IllegalStateException("Unknown cell type");
}
 
private Object evalCell(Cell cell) {
 
FormulaEvaluator evaluator = cell.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
 
CellValue cellValue = evaluator.evaluate(cell);
 
switch (cellValue.getCellType()) {
    case Cell.CELL_TYPE_BOOLEAN:
        return cellValue.getBooleanValue();
    case Cell.CELL_TYPE_NUMERIC:
        return cellValue.getNumberValue();
    case Cell.CELL_TYPE_STRING:
        return cellValue.getStringValue();
    case Cell.CELL_TYPE_BLANK:
        return null;
    case Cell.CELL_TYPE_ERROR:
        throw new RuntimeException("Excel formula error");
    default:
    throw new IllegalStateException("Unknown cell type");
}				
 
 
}

SuggestionRe: java_excel Pin
Richard MacCutchan26-Jan-17 21:54
mveRichard MacCutchan26-Jan-17 21:54 
AnswerRe: java_excel Pin
Patrice T10-Feb-17 11:42
mvePatrice T10-Feb-17 11:42 
Questionhow to write a simple program combining Encapsulation, inheritance, polymorphism and abstraction Pin
Jake Ryder17-Jan-17 3:13
Jake Ryder17-Jan-17 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.