- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我选择表格中的一行时,它会打印出字符串中的所选项目,如图所示。如何删除字符串两侧的方括号。
下面是我用数据填充 TextFields 的代码。您可以看到它已成功填充,但带有 []。
表格和输出
tableView.getSelectionModel().selectedItemProperty().addListener((v, oldValue, newValue) -> {
String input = newValue.toString();
String[] str_array = input.split(", ");
String code = str_array[0];
String name = str_array[1];
String lecturer = str_array[2];
String year = str_array[3];
String semester = str_array[4];
codeInput.setText(code);
nameInput.setText(name);
lectureInput.setText(lecturer);
yearInput.setText(year);
semesterInput.setText(semester);
System.out.println(input);
});
最佳答案
您的newValue
应该是一个对象
。假设它是一个 SchoolInfo
对象,其变量为 String code
、String name
、String Lecturer
、整年
和整学期
。您的对象
应该有Getters
和Setter
。你应该做类似的事情。
警告:其他一些答案可能可以完成工作,但都是非常糟糕的主意。您尝试处理这些数据的方式是一个坏主意。
tableView.getSelectionModel().selectedItemProperty().addListener((v, oldValue, newValue) -> {
SchoolInfo tempSchoolInfo = (SchoolInfo)newValue;
String code = tempSchoolInfo.getCode();
String name = tempSchoolInfo .getName();
String lecturer = tempSchoolInfo.getLecturer;
int year = tempSchoolInfo.getYear();
int semester = tempSchoolInfo.getSemester();
codeInput.setText(code);
nameInput.setText(name);
lectureInput.setText(lecturer);
yearInput.setText(Integer.toString(year));
semesterInput.setText(Integer.toString(semester));
System.out.println(input);
});
关于java - 如何删除字符串值两侧的方括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49174299/
我设法检查一个整数是否是从右到左排序的,但我如何检查从左到右的顺序?也许我应该做 2 个功能,一个从左到右检查,另一个从右到左检查?例如,我将 return 0; 替换为第二个函数,该函数检查它是否从
我想在两侧“剪切”我的页面,如下所示: http://i.stack.imgur.com/ngZrp.jpg 演示:https://jsfiddle.net/r2g0eyxf/3/ #left {
我很难在页面的两边都获得背景: 风格 .left { background: url(wax.png); width: 15%; position: absolute; lef
我需要逐步证明:7 + O(n) = O(n) 当两边都有大O的时候,我不知道该怎么做。 我想我理解大 O 符号的概念,但为什么两边都有大 O? 最佳答案 这种表示法的使用不符合大 O 表示法的正式定
我的目标是使 slider 宽度为 1280 像素并位于页面中央。我希望内容的边缘在两侧都有隐藏的溢出。例如,我希望内容的中心始终位于页面的中心,随着浏览器的大小调整,每一边都被切断,并且没有出现水平
我在做什么:在悬停按钮时,我添加了一个 5px 的底部边框。 JS fiddle : http://jsfiddle.net/mUCNB/ 问题: 问题是边框底部在左侧和右侧都延伸了 1px。 问题:
我是一名优秀的程序员,十分优秀!