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的相关内容,可以阅读本专题下面的文章。

456

2024.01.03

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

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

6

2025.12.06

length函数用法
length函数用法

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

905

2023.09.19

php源码安装教程大全
php源码安装教程大全

本专题整合了php源码安装教程,阅读专题下面的文章了解更多详细内容。

7

2025.12.31

php网站源码教程大全
php网站源码教程大全

本专题整合了php网站源码相关教程,阅读专题下面的文章了解更多详细内容。

4

2025.12.31

视频文件格式
视频文件格式

本专题整合了视频文件格式相关内容,阅读专题下面的文章了解更多详细内容。

7

2025.12.31

不受国内限制的浏览器大全
不受国内限制的浏览器大全

想找真正自由、无限制的上网体验?本合集精选2025年最开放、隐私强、访问无阻的浏览器App,涵盖Tor、Brave、Via、X浏览器、Mullvad等高自由度工具。支持自定义搜索引擎、广告拦截、隐身模式及全球网站无障碍访问,部分更具备防追踪、去谷歌化、双内核切换等高级功能。无论日常浏览、隐私保护还是突破地域限制,总有一款适合你!

7

2025.12.31

出现404解决方法大全
出现404解决方法大全

本专题整合了404错误解决方法大全,阅读专题下面的文章了解更多详细内容。

41

2025.12.31

html5怎么播放视频
html5怎么播放视频

想让网页流畅播放视频?本合集详解HTML5视频播放核心方法!涵盖<video>标签基础用法、多格式兼容(MP4/WebM/OGV)、自定义播放控件、响应式适配及常见浏览器兼容问题解决方案。无需插件,纯前端实现高清视频嵌入,助你快速打造现代化网页视频体验。

3

2025.12.31

热门下载

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

精品课程

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

共42课时 | 5.7万人学习

Django 教程
Django 教程

共28课时 | 2.6万人学习

React 教程
React 教程

共58课时 | 3.1万人学习

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

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