使用lambda表达式返回TextField输入

时间:2016-10-19 04:04:04

标签: java lambda textfield

已编辑 - 仍然出现相同的错误

我试图创建一个能够获取用户选择的单词的函数,验证它是否为所有字符,然后返回它。但我收到了错误

        Table topTable = pdfReport.LastSection.AddTable();
        topTable.Borders.Visible = true;
        topTable.Borders.Color = Colors.Gray;
        topTable.Format.Font.Name = "Calibri Light";
        topTable.Format.Font.Size = 8;
        topTable.Format.Font.Color = Colors.Black;
        topTable.Format.SpaceAfter = 0;
        topTable.Format.SpaceBefore = 0;
        Column column;
        column = topTable.AddColumn(90);
        column.Format.Font.Bold = true;       //    <-- this
        column = topTable.AddColumn(400);
        Row row;
        row = topTable.AddRow();
        row.Cells[0].AddParagraph("Analysis Run:");
        row.Cells[1].AddParagraph(_report.AnalysisRun.ToString());
        row = topTable.AddRow();
        row.Cells[0].AddParagraph("Case Number:");
        row.Cells[1].AddParagraph(_report.CaseNumber);
        row = topTable.AddRow();
        row.Cells[0].AddParagraph("Sample ID:");
        row.Cells[1].AddParagraph(_report.SampleID);
        row = topTable.AddRow();
        row.Cells[0].AddParagraph("Comments:");
        row.Cells[1].AddParagraph(_report.Comments);

我不明白如何改变它以使其更好地运作。

"incompatible types: bad return type in lambda expression
 unexpected return value
 Unnecessary return statement"

1 个答案:

答案 0 :(得分:0)

将lambda与setOnAction()一起使用时,无法返回值。