当前位置: 首页 > news >正文

吴江建设局网站打不开上海市单位名称地址大全

吴江建设局网站打不开,上海市单位名称地址大全,设计制作植物标识牌,做资料网站违法一、功能需要由来和大致效果 今天#xff0c;我们要用javaFx来实现一个鼠标穿透画布的功能#xff0c;该需求来自于在我们的javaFx桌面应用中#xff0c;需要实现一个悬浮的桌面侧边工具栏#xff0c;在工具栏中有画笔绘制#xff0c;批注的功能#xff0c;能够实现在任何…        一、功能需要由来和大致效果 今天我们要用javaFx来实现一个鼠标穿透画布的功能该需求来自于在我们的javaFx桌面应用中需要实现一个悬浮的桌面侧边工具栏在工具栏中有画笔绘制批注的功能能够实现在任何软件之上做笔记绘制同时可以操作工具栏下一层的所有软件。 我把这个功能提出来了写了一个demo。大致效果如下 当程序启动后程序的整个背景是透明的除了程序中的组件如按钮这个时候即可以看到背面的任何软件桌面也能看到程序中的组件。此时可以在整个桌面上进行画笔的绘制。 当我点击鼠标穿透按钮后画布上的笔记正常显示同时我的鼠标可以操作背面的任何软件 通过上图中的圆圈圈起来的鼠标光标可以得知此时我是可以操作背面的程序的。 二、程序实现 要实现以上效果其实最关键的几点是 1需要把javaFx中的Scene和stage的背景设置为透明 scene.setFill(Color.TRANSPARENT);stage.initStyle(StageStyle.TRANSPARENT); 2)一开始要能够看到当前javafx程序背面的东西需要设置背景为透明但不是完全透明此时才可以在画布上绘制 pane.setStyle(-fx-background-color: rgba(255,255,255,0.1);); 3要实现鼠标穿透当前画布进而可以操作画布背面的其它软件则需要将画布的背景设置为完全透明透明度为0 pane.setStyle(-fx-background-color: rgba(255,255,255,0);); 4当不需要操作背面的软件希望回到画布的绘制时再把背景的透明度设置为0.1即可。 是不是很简单呢好的。以下是实现的全部代码。 package test;import java.io.IOException;import javafx.application.Application; import javafx.application.Platform; import javafx.event.Event; import javafx.event.EventHandler; import javafx.geometry.Point2D; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Polyline; import javafx.scene.shape.StrokeLineCap; import javafx.scene.shape.StrokeLineJoin; import javafx.scene.shape.StrokeType; import javafx.stage.Screen; import javafx.stage.Stage; import javafx.stage.StageStyle;public class Test extends Application {boolean transpant false;Polyline polyline;Button btn ;public void start(Stage stage) throws Exception {// TODO Auto-generated method stubPane pane new Pane();Rectangle2D bounds Screen.getPrimary().getVisualBounds();double screenWidth bounds.getWidth();double screenHeight bounds.getHeight();btn new Button(鼠标穿透);btn.setPrefWidth(100);btn.setPrefHeight(50);btn.setLayoutX(screenWidth/2);btn.setLayoutY(screenHeight/2);pane.getChildren().add(btn);Scene scene new Scene(pane, screenWidth, screenHeight);scene.setFill(Color.TRANSPARENT); // scene.getStylesheets().add(ToolsBarStage.class.getResource(/res/css/default.css).toExternalForm());stage.initStyle(StageStyle.TRANSPARENT);//pane.setStyle(-fx-background-color: rgba(255,255,255,0.1););stage.setScene(scene); // Place the scene in the stagestage.show();stage.setAlwaysOnTop(true); //点击按钮后切换为批注模式或操作模式btn.setOnMouseClicked(new EventHandlerEvent() {Overridepublic void handle(Event event) {// TODO Auto-generated method stubif(!transpant) {//关键点实现鼠标 穿透到可以操作桌面背景pane.setStyle(-fx-background-color: rgba(255,255,255,0););transpant true;}else {pane.setStyle(-fx-background-color: rgba(255,255,255,0.1););transpant false;}}});//根据鼠标的拖动和按压进行绘制pane.setOnMousePressed(e - {//设置线条的样式StrokeType strokeType StrokeType.CENTERED;int strokeMiterLimit 5;StrokeLineJoin strokeLineJoin StrokeLineJoin.BEVEL;StrokeLineCap strokeLineCap StrokeLineCap.ROUND;polyline new Polyline();polyline.setStrokeLineCap(strokeLineCap);polyline.setStrokeLineJoin(strokeLineJoin);polyline.setStrokeMiterLimit(strokeMiterLimit);polyline.setStrokeType(strokeType);polyline.setStrokeWidth(2);polyline.setSmooth(true);pane.getChildren().add(polyline);});//鼠标拖动绘制pane.setOnMouseDragged(e - {polyline.getPoints().add(e.getSceneX());polyline.getPoints().add( e.getSceneY());});}public static void main(String[] args) {Test test new Test();Platform.runLater(() - {try {Stage stage new Stage();test.start(stage);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}});} }
http://www.hkea.cn/news/14581319/

相关文章:

  • 长沙网站seo优化公司站群cms网站系统
  • 建站公司最新报价了解公司的网站
  • 开平做网站常州网站建设哪儿好薇
  • 天津酒店网站制作wordpress auth_key
  • 微信二维码网站制作wordpress+布局插件
  • 网站开发与技术分析成都微信小程序制作价格
  • 做网站机构wordpress 添加目录
  • wordpress整站搬家人力管理系统
  • 简洁企业网站源码广告公司肥西
  • 网站站群建设方案网站推广的基本方法是什么
  • 有那些猎头做单的网站wordpress html5视频插件
  • 怎么做网站可以注册的沈阳网络优化培训
  • 做网站 学什么wordpress模板放在哪里
  • 网站自助制作wordpress手机全部显示
  • 东莞想做网站找什么公司织梦菜谱网站模板免费下载
  • 著名建筑设计网站开发网站需求设计
  • 桐乡住房和建设局网站铁盒 东莞网站建设
  • 政务门户网站建设信息凡科快图 免费
  • 58同城 网站建设自己怎么做商城网站吗
  • 定制网站建设广告网站开发建设账务处理程序
  • 安徽省住房城乡建设厅网站中国菲律宾概念股
  • wordpress 做企业网站做网站怎么接业务
  • 如何服务器ip地址做网站商场网站建设
  • 网站开发最后五个阶段WordPress无法写博客头像
  • 北京网站搭建多少钱国外办公室设计欣赏
  • 台州国强建设网站购物网站建设项目策划书
  • 校园微网站建设方案无人在线观看高清视频8
  • 江门建站模板搭建网站整体形象策划与包装
  • 蚌埠北京网站建设找素材的网站
  • 泉港做网站公司个人网站建设维护