0

0

如何使用JavaFX创建弧形?

WBOY

WBOY

发布时间:2023-08-19 16:37:05

|

1543人浏览过

|

来源于tutorialspoint

转载

in general, an arc is a small segment of a curve. in javafx it is represented by the javafx.scene.shape.arc class. this class contains six properties they are −

  • centerX − This property represents the x coordinate of the center of the arc. You can set the value to this property using the setCenterX() method.

  • centerY − This property represents the y coordinate of the center of the arc. You can set the value to this property using the setCenterY() method.

  • radiusX − This property represents the width of the full ellipse of which the current arc is a part of. You can set the value to this property using the setRadiusX() method.

  • radiusY − This property represents the height of the full ellipse of which the current arc is a part of. You can set the value to this property using the setRadiusY() method.

    立即学习Java免费学习笔记(深入)”;

  • startAngle − This property represents the starting angle of the arc in degrees. You can set the value to this property using the setStartAngle() method.

  • length − This property represents the angular extent of the arc in degrees. You can set the value to this property using the setLength() method.

    巨蟹星云网上商城
    巨蟹星云网上商城

    一套自助创建网上商店的软件系统,具有界面变幻多彩、功能强大,使用傻瓜化、运行自动化的特点,任何人基本上不用学习,都能快速创建自己的网上商店,用这套系统做一个购物网站,就象做填空题一样容易。采用「巨蟹星云」可以建立诸如:网上花店、网上化妆品店、网上服装店、网上书店、网上点卡店、网上成人用品店、网上玩具店、网上书店、网上手机店、网上数码产品销售店、网上保健品店、网上玩具店、网上车模店、网上音像制品店等

    下载

To create a circle you need to −

  • Instantiate this class.

  • Set the required properties using the setter methods or, bypassing them as arguments to the constructor.

  • Add the created node (shape) to the Group object.

Example

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
public class DrawingArc extends Application {
   public void start(Stage stage) {
      //Drawing a cubic curve
      Arc arc = new Arc();
      //Setting properties to cubic curve
      arc.setCenterX(280);
      arc.setCenterY(230);
      arc.setRadiusX(100);
      arc.setRadiusY(180);
      arc.setStartAngle(45);
      arc.setLength(100);
      arc.setType(ArcType.ROUND);
      //Setting other properties
      arc.setFill(Color.CHOCOLATE);
      arc.setStrokeWidth(8.0);
      arc.setStroke(Color.BROWN);
      //Setting the scene object
      Group root = new Group(arc);
      Scene scene = new Scene(root, 595, 300, Color.BEIGE);
      stage.setTitle("Drawing arc");
      stage.setScene(scene);
      stage.show();
   }
   public static void main(String args[]){
      launch(args);
   }
}

输出

如何使用JavaFX创建弧形?

相关文章

java速学教程(入门到精通)
java速学教程(入门到精通)

java怎么学习?java怎么入门?java在哪学?java怎么学才快?不用担心,这里为大家提供了java速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
class在c语言中的意思
class在c语言中的意思

在C语言中,"class" 是一个关键字,用于定义一个类。想了解更多class的相关内容,可以阅读本专题下面的文章。

465

2024.01.03

python中class的含义
python中class的含义

本专题整合了python中class的相关内容,阅读专题下面的文章了解更多详细内容。

12

2025.12.06

length函数用法
length函数用法

length函数用于返回指定字符串的字符数或字节数。可以用于计算字符串的长度,以便在查询和处理字符串数据时进行操作和判断。 需要注意的是length函数计算的是字符串的字符数,而不是字节数。对于多字节字符集,一个字符可能由多个字节组成。因此,length函数在计算字符串长度时会将多字节字符作为一个字符来计算。更多关于length函数的用法,大家可以阅读本专题下面的文章。

918

2023.09.19

Golang gRPC 服务开发与Protobuf实战
Golang gRPC 服务开发与Protobuf实战

本专题系统讲解 Golang 在 gRPC 服务开发中的完整实践,涵盖 Protobuf 定义与代码生成、gRPC 服务端与客户端实现、流式 RPC(Unary/Server/Client/Bidirectional)、错误处理、拦截器、中间件以及与 HTTP/REST 的对接方案。通过实际案例,帮助学习者掌握 使用 Go 构建高性能、强类型、可扩展的 RPC 服务体系,适用于微服务与内部系统通信场景。

8

2026.01.15

公务员递补名单公布时间 公务员递补要求
公务员递补名单公布时间 公务员递补要求

公务员递补名单公布时间不固定,通常在面试前,由招录单位(如国家知识产权局、海关等)发布,依据是原入围考生放弃资格,会按笔试成绩从高到低递补,递补考生需按公告要求限时确认并提交材料,及时参加面试/体检等后续环节。要求核心是按招录单位公告及时响应、提交材料(确认书、资格复审材料)并准时参加面试。

37

2026.01.15

公务员调剂条件 2026调剂公告时间
公务员调剂条件 2026调剂公告时间

(一)符合拟调剂职位所要求的资格条件。 (二)公共科目笔试成绩同时达到拟调剂职位和原报考职位的合格分数线,且考试类别相同。 拟调剂职位设置了专业科目笔试条件的,专业科目笔试成绩还须同时达到合格分数线,且考试类别相同。 (三)未进入原报考职位面试人员名单。

52

2026.01.15

国考成绩查询入口 国考分数公布时间2026
国考成绩查询入口 国考分数公布时间2026

笔试成绩查询入口已开通,考生可登录国家公务员局中央机关及其直属机构2026年度考试录用公务员专题网站http://bm.scs.gov.cn/pp/gkweb/core/web/ui/business/examResult/written_result.html,查询笔试成绩和合格分数线,点击“笔试成绩查询”按钮,凭借身份证及准考证进行查询。

8

2026.01.15

Java 桌面应用开发(JavaFX 实战)
Java 桌面应用开发(JavaFX 实战)

本专题系统讲解 Java 在桌面应用开发领域的实战应用,重点围绕 JavaFX 框架,涵盖界面布局、控件使用、事件处理、FXML、样式美化(CSS)、多线程与UI响应优化,以及桌面应用的打包与发布。通过完整示例项目,帮助学习者掌握 使用 Java 构建现代化、跨平台桌面应用程序的核心能力。

65

2026.01.14

php与html混编教程大全
php与html混编教程大全

本专题整合了php和html混编相关教程,阅读专题下面的文章了解更多详细内容。

36

2026.01.13

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Vue 教程
Vue 教程

共42课时 | 6.5万人学习

Django 教程
Django 教程

共28课时 | 3.1万人学习

React 教程
React 教程

共58课时 | 3.7万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号