- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我运行gradle“run”任务时,我无法完成Java的编译,因为我收到许多形式的错误:“错误:所有javaFX导入的程序包javafx.XXXXX不存在”。我的测试项目可以很好地导入,尽管它没有使用gradle进行编译。
我正在尝试在Ubuntu VM上运行客户端程序“BilliardViewer”。它是通过许多程序员的手中完成的,其中一些程序员可能没有那么多的编码经验。我不确定这是gradle问题,eclipse问题,库问题还是编码问题。我知道JavaFX库已正确安装,因为我可以运行单独的HelloWorld jfx程序。两者之间构建路径的唯一区别是BilliardViewer程序具有一些外部依赖性,因为它使用C++和Java。我相信MacOS Mojave可以在Mac上运行该程序。
我的HelloWorld程序有效。
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
...
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
StackPane root = new StackPane();
root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
import java.util.Optional;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
...
public ColorPicker(final int x, final int y) {
stage.setX(x);
stage.setY(y);
stage.focusedProperty().addListener((obs, wasFocused, isNowFocused) -> {
if (!isNowFocused) {
stage.hide();
}
});
stage.setScene(new Scene(grid));
stage.setTitle("SO COLORFUL");
grid.setPadding(new Insets(10));
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < COLS; col++) {
final Color currentColor = color[row][col];
final Rectangle rect = new Rectangle(RECT_SIZE, RECT_SIZE, currentColor);
rect.setOnMouseClicked(event -> {
selectedColor = Optional.of(currentColor);
stage.close();
});
Tooltip.install(rect, new Tooltip(Colors.colorMap.get(currentColor).get()));
grid.add(rect, col, row);
}
}
}
apply plugin: 'cpp'
apply plugin: TestingModelBasePlugin
//apply plugin: 'findbugs'
mainClassName = 'billiards.viewer.Main'
repositories {
jcenter()
}
dependencies {
// When getting the version number for a dependency, don't go to Maven Central and
// simply search for the package you want. You will often find many versions of the
// package, most of which are unofficial or out-of-date. Instead, go to the website
// of the package, and they will usually give you the correct Maven information there.
compile 'org.eclipse.collections:eclipse-collections-api:9.2.0' // All the interfaces
compile 'org.eclipse.collections:eclipse-collections:9.2.0' // The actual classes
compile 'com.google.guava:guava:25.1-jre'
compile 'org.apache.commons:commons-math3:3.6.1'
compile 'org.apache.commons:commons-lang3:3.7' // can remove this now I think?
compile 'org.apache.commons:commons-io:1.3.2'
compile 'io.javaslang:javaslang:2.0.5'
compile 'org.xerial:sqlite-jdbc:3.23.1'
compile 'net.java.dev.jna:jna:4.5.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
}
test {
useJUnitPlatform()
}
compileJava {
options.compilerArgs << '-Xlint' << '-Werror'
}
jar {
baseName = 'billiard-viewer'
manifest.attributes 'Main-Class': 'billiards.viewer.Main'
}
sourceSets {
main {
java {
srcDir 'src/java'
}
//resources {
//srcDir 'css'
//}
}
}
applicationDefaultJvmArgs = ['-server', '-Djna.library.path=./build/libs/backend/shared', '-Xss10000m']
sourceCompatibility = 1.8
targetCompatibility = 1.8
model {
components {
backend(NativeLibrarySpec) {
binaries.all {
cppCompiler.define "NDEBUG"
cppCompiler.args '-O3', '-march=native', '-flto', '-ftrapv'
linker.args '-lgmp', '-lmpfr', '-lmpfi', '-lsqlite3', '-ltbb'
if (toolChain in Clang) {
cppCompiler.args '-Weverything', '-Werror',
'-Wno-padded', '-Wno-comma',
'-Wno-exit-time-destructors', '-Wno-global-constructors',
'-Wno-c++98-compat', '-Wno-c++98-compat-pedantic',
'-std=c++14'
}
if (toolChain in Gcc) {
cppCompiler.args '-Wall', '-Wextra', '-Wpedantic', '-Werror',
'-Wno-c++11-compat', '-Wno-c++14-compat',
'-std=c++14'
}
checkedBy $.tasks.testBackend
}
}
test(NativeExecutableSpec) {
sources.cpp {
lib library: 'backend', linkage: 'static'
}
binaries.all {
cppCompiler.define "NDEBUG"
cppCompiler.args '-O3', '-march=native', '-flto', '-ftrapv'
linker.args '-lgmp', '-lmpfr', '-lmpfi', '-lboost_unit_test_framework'
if (toolChain in Clang) {
cppCompiler.args '-Weverything', '-Werror',
'-Wno-padded', '-Wno-comma',
'-Wno-disabled-macro-expansion', '-Wno-global-constructors',
'-Wno-c++98-compat', '-Wno-c++98-compat-pedantic',
'-std=c++14'
}
if (toolChain in Gcc) {
cppCompiler.args '-Wall', '-Wextra', '-Wpedantic', '-Werror',
'-Wno-c++11-compat', '-Wno-c++14-compat',
'-std=c++14'
}
}
}
}
}
task testBackend(type: Exec, dependsOn: 'testExecutable') {
commandLine 'build/exe/test/test'
// save the results here
//standardOutput = new FileOutputStream('build/test-results/test.out')
//errorOutput = new FileOutputStream('build/test-results/test.err')
}
// Make sure the C++ code is up to date when running the Java program
run.dependsOn "backendSharedLibrary"
//run.dependsOn "coverExecutable"
run.doFirst {
// Having this hardcoded isn't the best, put it works for now
//environment 'LD_PRELOAD', '/usr/local/Cellar/jemalloc/5.0.1/lib/libjemalloc.so.2'
//commandLine "./test.fish"
}
最佳答案
我最终通过在我的eclipse项目中添加gradle.properties文件解决了这个问题,据stackoverflow,该文件向gradle显示了在哪里寻找JDK。因此,为了澄清起见,我必须安装一个JDK,并将gradle指向该JDK。
关于eclipse - 我收到 “package javafx.geometry does not exist”错误,使用gradle进行编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57066232/
我不知道这是不是问这种问题的最佳地点, 我看到一些 JavaFX伙计们,重新标记 一些问题通过替换 javafx来自 javafx-2并采用新的 javafx-8 .它被弃用了还是什么? 编辑 : 不
错误本身: Error:java: invalid flag: --add-modules=javafx.fxml,javafx.graphics,javafx.controls,javafx.bas
这个想法是让一个应用程序在每个显示器上显示两个不同的窗口(阶段),该应用程序应该知道计算机有多少个显示器及其分辨率。 javafx有可能吗? 最佳答案 对于当前版本的 JavaFX (2.2),您可以
我正在将我的项目从 javafx 1.3 转换为 javafx 2.1。但我对 javafx.lang 有疑问包裹。 最佳答案 JavaFX 1.3 lang 包内容被拆分并移至下一个位置: 时长变为
当我尝试将标签添加到 gridpane 中时,如第二张图片所示,它不起作用。我已经尝试了很多东西,比如添加 CSS,但它仍然无法正常工作。为什么第 113 和 114 行不起作用? (opcje.se
我有一个JavaFX ContextMenu分配给滚动面板的鼠标右键单击。它会打开,但在滚动 Pane 外部单击时不会关闭。我可以在滚动 Pane 中添加另一个鼠标事件以将其隐藏,但这只能解决1个问题
我有一个tableview,其中附有一个可观察到的自定义类对象的列表(类类型:SalesInvoiceNetSale)。该表中的所有数据都可以正常显示。可观察列表中的最后一项是总计行(类类型:Sale
关闭。这个问题需要更多 focused .它目前不接受答案。 想改进这个问题?更新问题,使其仅关注一个问题 editing this post . 2年前关闭。 Improve this questi
我想知道如何在JavaFX中绘制半圆。我尝试使用Shape和QuadCurve,但无法制作出完美的半圆。 这是我要绘制的图片: 最佳答案 您链接的图片实际上是一个半圆环。您可以通过绘制嵌套的2条圆弧和
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我正在寻找 JavaFX 支持的图像类型(最新)列表,例如PNG、JPEG、TIFF。不同的搜索引擎没有帮助......知道从哪里开始吗? 更特别的是,我对 16 位灰度图像(不同格式)和罕见的受支持
我希望在 javafx 中让标签每 0.1 秒闪烁一次。文本显示在后台运行的 ImageView gif 的顶部。我将如何去做,或者您对最佳方法有什么建议? 谢谢 最佳答案 @fabian 的解决方案
我需要测试所选项目的值以调用不同的方法,因此我编写了添加侦听器的代码,但是该代码生成语法错误 @FXML private JFXComboBox cmbComp; cmbComp.valuePrope
我正在 Javafx 中编写一个非常简单的应用程序,其中舞台上有一个带有文本框的按钮作为一个场景。现在,我想要的行为是,当我单击按钮时,我可以使用另一个按钮加载另一个场景和舞台上的一个文本框,然后删除
编辑:如果用户单击“删除”以删除 ListView 中的项目,我会弹出一个警告框。它有效,但我希望它能超越原来的舞台。它出现在我的第一台显示器上。有什么方法可以设置警报显示时的位置吗? 请注意,“所有
我想使用 JavaFX 编写一个笔画绘图应用程序。我有一个压敏绘图板,如果能够读取笔的压力和倾斜值,那就太好了。 JavaFX 有一个 API 可以处理鼠标、触摸和滑动输入,但似乎没有任何东西可以产生
我在 JavaFX 中使用条形图和折线图。当我使两个图表大小相同并将它们放在同一位置时,它们完美地相互重叠。我如何使折线图显示在条形图的顶部。 目前我已将它们的不透明度设置为 0.7,这样它们“看起来
此问题与 this 相关。现在我想为字段值等于某个值的行着色。 @FXML private TableView tv_mm_view; @FXML private Ta
我有一个程序,可以生成高度图(0-255 的整数的 2D 数组),并使用 Shape3D“Box”对象为每个“像素”构建 3D View ,其高度与其在高度图中的值成比例。这会创建一个看起来很酷的四四
我想为 JavaFX 创建上下文菜单。这是我测试过的代码。但是由于某种原因,当我右键单击树节点时没有上下文菜单。你能帮我找出我的错误吗。 import java.util.Arrays; import
我是一名优秀的程序员,十分优秀!