javafx image button
2024-08-27 19:46:18
public class EffectTest extends Application {
public static void main(String[] args) {
launch(args);
} @Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
stage.setTitle("Button Sample");
stage.setWidth();
stage.setHeight(); VBox vbox = new VBox();
vbox.setLayoutX();
vbox.setLayoutY(); Image image = new Image(getClass().getResourceAsStream("/effecttest/img/1156909.png"));
Button button1 = new Button("Accept");
button1.setGraphic(new ImageView(image));
button1.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
System.out.println("Accepted");
}
}); vbox.getChildren().add(button1);
vbox.setSpacing();
((Group)scene.getRoot()).getChildren().add(vbox); stage.setScene(scene);
stage.show();
}
}
最新文章
- 光驱SSD安装Win7+ubuntu系统双系统
- mvc action controller area
- exec、source以及bash的区别(zz)
- sql2008 附加数据库出错解决方法
- 2016年QS亚洲大学排行榜
- twisted(3)--再谈twisted
- angular 指令梳理 —— checkBox
- Memcached帮助类
- MySQL &#183; 引擎特性 &#183; InnoDB IO子系统
- nginx浏览目录
- DirectX11--深入理解与使用缓冲区资源
- Selenium自动化 Xpath-元素定位
- $(function() {....}) ,(function($){...})(jQuery)
- Linux内存管理6---伙伴算法与slab
- Springboot实现filter拦截token验证和跨域
- wordpress:搭建个人博客
- nginx编译安装on mac
- 静态代码检查findbugs/阿里巴巴开发规范
- StackGAN 阅读笔记
- 错误 error C2678: 二进制“<;”: 没有找到接受“const card”类型的左操作数的运算符(或没有可接受的转换)
热门文章
- [Recompose] Refactor React Render Props to Streaming Props with RxJS and Recompose
- github关联域名,创建个人站点教程终结篇
- 绿色便携版Lazarus的制作教程
- Windows cannot find ";. Make sure you typed the name correctly, and then try again
- js中arguments对象和this对象
- linux大于2T的磁盘使用GPT分区的方法分享
- 团队作业——团队项目Alpha版本发布
- ADO.NET数据读取封装
- HOJ——T 2275 Number sequence
- ThinkPHP数据分页Page.class.php