异常堆栈是
java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:327)
at java.nio.ByteBuffer.put(ByteBuffer.java:813)
mappedByteBuffer.put(bytes);
Run Code Online (Sandbox Code Playgroud)
代码:
randomAccessFile = new RandomAccessFile(file, "rw");
fileChannel = randomAccessFile.getChannel();
mappedByteBuffer = fileChannel.map(MapMode.READ_WRITE, 0, file.length());
Run Code Online (Sandbox Code Playgroud)
并打电话 mappedByteBuffer.put(bytes);
是什么原因 mappedByteBuffer.put(bytes)抛出BufferOverflowException
如何查找原因?
我试图将我的TextField"colorBox0"的背景颜色更改为"value0",但它摆脱了边框.
这是我的代码的简化版本:
static Paint value0 = Paint.valueOf("FFFFFF");
TextField colorBox0;
colorBox0.setBackground(new Background(new BackgroundFill(value0, CornerRadii.EMPTY, Insets.EMPTY)));
Run Code Online (Sandbox Code Playgroud)
非常感谢任何帮助
谢谢
我知道你可以在fxml中添加Anchor Pane包含:'AnchorPane.bottomAnchor ="0.0"'但是你可以在java代码中设置AnchorPane约束吗?
我知道你可以通过执行node.requestFocus()来关注javafx中的节点.但有没有办法从javafx中的节点中取走焦点或防止对焦于对象?
我知道你可以通过设置节点的样式来设置整个textArea/Field的颜色,-fx-text-fill: red;但是有没有办法设置一行而不是所有行的颜色,同时仍然保持textArea/Field可编辑?