正如标题中所述,我真的很难找到这个问题的好答案.我目前正在开发一个只有桌面的应用程序,没有CSS或任何互联网部分.我希望它看起来像Windows 8的地铁外观.我不是在谈论布局而是外观和感觉.我特别喜欢方形而不是圆形的按钮,但所有其他扁平方形的外观和感觉.以下链接与我正在寻找的相反,作为参考.
这个阅读至少更接近于关于原生外观和java的讨论.然而,它实际上没有给出任何具体的方法来获得例如方形平面按钮:
目前我正在使用Eclipse,但我不会坚持使用它,但它最简单.我一直在研究JavaFx,但它似乎没有方形按钮或地铁的感觉,从我读过的东西,但也许我错过了一些东西.任何人都能指出我如何使外观和感觉变得简单吗?
我希望基于某些值更新文本字段中的文本.为了使这个样本更简单,我使我的程序更小.问题似乎是当我把top.setText("这是我的新文本")时;
我看了一下: 如何在java fx 2中更改TextField的文本
但答案似乎没有意义.我不知道为什么要初始化已经实现的文本字段.无论它不起作用.
我还看了一下: NullPointerException(JavaFX Label.setText())
这似乎与我认为的问题最接近,但是当我做了以下操作时,我得到了一个错误.为了清楚起见,这是在JavaFXApplication5类中.
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("FXML.fxml")
);
FXMLLoader.setController(this); // non-static method setController(Object)
// can not be referenced from static context ERROR****
Parent root = (Parent) loader.load();
/*Parent root = FXMLLoader.load(getClass().getResource("FXML.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("java code");
stage.show();
*/
}
Run Code Online (Sandbox Code Playgroud)
从网上阅读我想知道是否有竞争条件:http://gotoanswer.stanford.edu/nullpointerexception_in_javafx_initialize_method-8807679/
所以我尝试过:
Platform.runLater(new Runnable() {
@Override public void run() {
top.setText("This is my new Text");
}
});
Run Code Online (Sandbox Code Playgroud)
但那没用.我知道它可以在Scene Builder中设置,但我需要一种方法来根据另一个类的值动态地更改它.如果我能弄清楚如何设置它,我可以弄清楚如何做这个部分.希望这足以得到一些帮助.
FXMLController Class:
public class FXMLController …Run Code Online (Sandbox Code Playgroud) 我查看了以下资源: NSDictionary到NSArray? https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/Reference/Reference.html https://developer.apple.com/library/mac/documentation/Cocoa/Reference /Foundation/Classes/NSDictionary_Class/Reference/Reference.html
我试图做的是将NSDictionary插入NSMutableArray.
相关代码对我来说似乎是这样的:
@property (strong,nonatomic) NSMutableArray * curveList;
@property (strong,nonatomic) UIBezierPath * curPath;
@property (strong, nonatomic) UIColor * curColor;
// some code to set curPath and curColor
@{@"path":_curPath, @"color":_curColor}
//how to insert this into self.curveList???
Run Code Online (Sandbox Code Playgroud) ios ×1
java ×1
javafx ×1
nsdictionary ×1
objective-c ×1
settext ×1
textfield ×1
windows-8 ×1
xcode ×1