我正在用 GUI 做数独项目。我有一个二维数组来保存 9x9 网格中的数字。我想更改保存非 0 数组值的文本字段的背景颜色。这是我操作文本字段和 GUI 图片的代码的一部分。例如在第一个 3x3 网格中,5,4 和 1 位数字背景为灰色,但 9 不是。问题是什么?请帮忙。谢谢你。
public class Controller {
private Board board;
private TextField[] tfs;
@FXML GridPane gridPane;
@FXML Button startButton;
@FXML Button stopButton;
@FXML Label timeLabel;
private final IntegerProperty timeSeconds = new SimpleIntegerProperty(0);
private Timeline timeline;
public void initialize() throws IOException {
board = new Board();
tfs = new TextField[81];
int c = 0;
for (int i = 0; i < 9; i++) {
for (int j = …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我想通过按数字顺序添加数字来显示表视图中有多少个单元格.例如,我希望表视图中的第一个单元格旁边有一个1,而第二个单元格旁边有一个2.
谢谢!
我想知道如何检测文本字段中的更改.我知道我们可以使用Do End On Exit但这仅在用户完成在文本字段上键入并按其他地方返回或单击时才有效.我想知道如何检测每个输入或删除文本字段中的字母/数字,即如果文本字段中的初始文本是徽章.一旦用户按下删除按钮使文本"badg"我想运行一个方法,一旦用户再次按下删除使其"坏"我想运行一个方法等.
谢谢:)
如何在文本字段中显示单引号和双引号?数据从数据库中恢复.例如:
//PHP code
$sor = mysqli_fetch_assoc($eredmeny);
$string = $sor['this_is_a_string_with_qoutes'];
//HTML with PHP
<input type="text" name="1" id="1" value="<?php echo $string?>">
Run Code Online (Sandbox Code Playgroud)
但是如果字符串有双qoutes,整个字符串将不会显示在文本字段内,只是第一个引用的部分.我的意思是如果我的字符串是BANANA"RAMA它只会显示BANANA
不知道怎么解决这个问题?