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

要制作自己的网站需要什么惠城网站设计

要制作自己的网站需要什么,惠城网站设计,东方av网站的电影下载应该怎么做,B2C购物网站如何推广在前面的章节中,我们已经了解了如何在 JavaFX 应用程序中的 XY 平面上绘制 2D 形状。除了这些 2D 形状之外,我们还可以使用 JavaFX 绘制其他几个 3D 形状。 通常,3D 形状是可以在 XYZ 平面上绘制的几何图形。它们由两个或多个维度定义&#…

在前面的章节中,我们已经了解了如何在 JavaFX 应用程序中的 XY 平面上绘制 2D 形状。除了这些 2D 形状之外,我们还可以使用 JavaFX 绘制其他几个 3D 形状。

通常,3D 形状是可以在 XYZ 平面上绘制的几何图形。它们由两个或多个维度定义,通常是 length, width and depth。JavaFX 支持的 3D 形状包括 Cylinder、Sphere 和 Box。

上面提到的每个 3D 形状都由一个类表示,所有这些类都属于 javafx.scene.shape 包。名为 Shape3D 的类是 JavaFX 中所有 3 维形状的基类。

创建 3D 形状

要创建 3-Dimensional 形状,需要

实例化相应的类

要创建一个 3-Dimensional 形状,首先你需要实例化它各自的类。例如,如果要创建一个 3D 框,则需要实例化名为 Box 的类,如下所示

Box box = new Box();

设置形状的属性

实例化类后,需要使用 setter 方法设置形状的属性。

例如,要绘制 3D 框,需要传递其 Width、Height、Depth。您可以使用各自的 setter 方法指定这些值,如下所示

//Setting the properties of the Box 
box.setWidth(200.0); 
box.setHeight(400.0);   
box.setDepth(200.0);

将 Shape 对象添加到组中

最后,需要通过将形状的对象作为构造函数的参数传递来将其添加到组中,如下所示。 

//Creating a Group object  
Group root = new Group(box);
S.No

形状和描述

1

Box

长方体是具有length (depth), width, and a height.
长方体是具有 length (depth) 、 width 和 height 的三维形状。

在 JavaFX 中,三维框由名为 Box 的类表示。此类属于 javafx.scene.shape 包。

通过实例化此类,可以在 JavaFX 中创建一个 Box 节点。

此类具有 double 数据类型的 3 个属性

width − 框的宽度

height − 框的高度

depth - 框的深度

2

Cylinder

圆柱体是一种封闭的实体,具有两个平行(大部分为圆形)的底面,由曲面连接。

它由两个参数描述,即其圆形底面的半径和圆柱体的高度。

在 JavaFX 中,圆柱体由名为 Cylinder 的类表示。此类属于 javafx.scene.shape 包。

通过实例化此类,您可以在 JavaFX 中创建一个圆柱体节点。此类具有 double 数据类型的 2 个属性

height − 圆柱体的高度

radius - 圆柱体的半径

3

Sphere

球体定义为与 3D 空间中的给定点的距离相同的点集 r。这个距离 r 是球体的半径,给定的点是球体的中心。

在 JavaFX 中,球体由名为 Sphere 的类表示。此类属于 javafx.scene.shape 包。

通过实例化此类,可以在 JavaFX 中创建一个球体节点。

此类具有名为 radius 的 double 数据类型的属性。它表示 Sphere 的半径。

3D 对象的属性

对于所有 3 维对象,可以在 JavaFX 中设置各种属性。它们在下面列出 

 

JavaFX - 创建一个 Box

长方体是三维立体形状。长方体由 6 个矩形组成,这些矩形以直角放置。使用方形面的长方体是立方体,如果面是矩形,而不是立方体,则它看起来像一个鞋盒。

长方体是具有 length (depth)、width 和 height 的三维形状。在 JavaFX 中,这种类型的三维形状被寻址为 Box;因为它可以是长方体或立方体,具体取决于形状的测量值。

在 JavaFX 中,三维框由名为 Box 的类表示。此类属于 javafx.scene.shape 包。通过实例化此类,可以在 JavaFX 中创建一个 Box 节点。 

绘制 3D 框的步骤

第 1 步:创建 Box

可以通过实例化名为 BOX 的类在 JavaFX 中创建 Box,该类属于包 javafx.scene.shape 。您可以在 Application 类的 start() 方法中实例化此类,如下所示

public class ClassName extends Application {  @Override     public void start(Stage primaryStage) throws Exception {//Creating an object of the class Box Box box = new Box();   }    
}

第 2 步:将属性设置为框

使用 3D 框各自的 setter 方法设置 3D 框的属性 Width、Height 和 Depth ,如以下代码块所示

//Setting the properties of the Box 
box.setWidth(200.0); 
box.setHeight(400.0);   
box.setDepth(200.0);

第 3 步:创建 Group 对象 

在 start() 方法中,通过实例化名为 Group 的类来创建 group 对象,该类属于包 javafx.scene 。将上一步中创建的 Box(节点)对象作为参数传递给 Group 类的构造函数。为了将其添加到组中,应执行此作,如下所示

Group root = new Group(box);

第 4 步:启动应用程序

例1

下面是一个使用 JavaFX 生成 3D 框的程序。将此代码保存在名为 BoxExample.java 的文件中。

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.shape.Box; 
import javafx.stage.Stage; public class BoxExample extends Application { @Override public void start(Stage stage) { //Drawing a Box Box box = new Box();  //Setting the properties of the Box box.setWidth(200.0); box.setHeight(400.0);   box.setDepth(200.0); //Creating a Group object  Group root = new Group(box); //Creating a scene object Scene scene = new Scene(root, 600, 300);   //Setting title to the Stage stage.setTitle("Drawing a Box"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); }public static void main(String args[]){ launch(args); } 
}

例2 

在前面的示例中,我们没有指定要从中绘制框的开始和结束坐标。但是,使用 animation 类的 translateX 和 translateY 属性,我们可以在 JavaFX 应用程序上重新定位该框。让我们看一下下面的示例,并将其保存在名为 TranslateBoxExample.java 的文件中。

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.shape.Box;
import javafx.scene.paint.Color;
import javafx.scene.transform.Translate;
import javafx.stage.Stage; public class TranslateBoxExample extends Application { @Override public void start(Stage stage) { //Drawing a Box Box box = new Box();  //Setting the properties of the Box box.setWidth(200.0); box.setHeight(200.0);  box.setDepth(200.0);Translate translate = new Translate();       translate.setX(200); translate.setY(150); translate.setZ(25); box.getTransforms().addAll(translate);//Creating a Group object  Group root = new Group(box); //Creating a scene object Scene scene = new Scene(root, 400, 300);scene.setFill(Color.web("#81c483"));	  //Setting title to the Stage stage.setTitle("Translate a Box"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); }public static void main(String args[]){ launch(args); } 
}

JavaFX - 创建圆柱体

圆柱体是一种封闭的实体,具有两个平行(大部分为圆形)的底面,由曲面连接。为了可视化,您可以将 3D 圆柱体视为一堆杂乱的 2D 圆圈,这些圆圈彼此堆叠到一定高度;因此,即使它由两个参数描述,也使其成为三维形状。

绘制 3D 圆柱体的步骤

第 1 步:创建类

通过实例化名为 Cylinder 的类,在 JavaFX 中创建一个 Cylinder 对象,该类属于包 javafx.scene.shape 。您=可以在 start() 方法中实例化此类,如下所示  

public class ClassName extends Application {  @Override     public void start(Stage primaryStage) throws Exception {//Creating an object of the Cylinder class       Cylinder cylinder = new Cylinder();   }    
}

第 2 步:为 Cylinder 设置属性

//Setting the properties of the Cylinder 
cylinder.setHeight(300.0f); 
cylinder.setRadius(100.0f); 

 第 3 步:创建 Group 对象 

Group root = new Group(cylinder);

 第 4 步:启动应用程序

例1

下面的程序演示如何使用 JavaFX 生成 Cylinder。将此代码保存在名为 CylinderExample.java 的文件中。

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.shape.CullFace; 
import javafx.scene.shape.Cylinder; 
import javafx.stage.Stage;public class CylinderExample extends Application { @Override public void start(Stage stage) { //Drawing a Cylinder Cylinder cylinder = new Cylinder(); //Setting the properties of the Cylinder cylinder.setHeight(300.0f); cylinder.setRadius(100.0f); //Creating a Group object  Group root = new Group(cylinder); //Creating a scene object Scene scene = new Scene(root, 600, 300);  //Setting title to the Stage stage.setTitle("Drawing a cylinder"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); } public static void main(String args[]){ launch(args); } 
}

 例2

还可以对 3D 形状应用转换。在此示例中,我们尝试在 3D 圆柱体上应用平移转换,并在应用程序上重新定位它。将此代码保存在名为 TranslateCylinderExample.java 的文件中。

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.shape.CullFace;
import javafx.scene.shape.Cylinder;
import javafx.scene.paint.Color;
import javafx.scene.transform.Translate;
import javafx.stage.Stage;public class TranslateCylinderExample extends Application { @Override public void start(Stage stage) { //Drawing a Cylinder Cylinder cylinder = new Cylinder(); //Setting the properties of the Cylinder cylinder.setHeight(150.0f); cylinder.setRadius(100.0f);Translate translate = new Translate();       translate.setX(200); translate.setY(150); translate.setZ(25); cylinder.getTransforms().addAll(translate);	  //Creating a Group object  Group root = new Group(cylinder); //Creating a scene object Scene scene = new Scene(root, 400, 300); scene.setFill(Color.web("#81c483"));//Setting title to the Stage stage.setTitle("Drawing a cylinder"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); } public static void main(String args[]){ launch(args); } 
}

JavaFX - 创建球体

绘制 3D 球体的步骤

步骤 1:创建球体

public class ClassName extends Application { @Override     public void start(Stage primaryStage) throws Exception {//Creating an object of the class Sphere Sphere sphere = new Sphere();   }
}

第 2 步:为球体设置属性

//Setting the radius of the Sphere 
sphere.setRadius(300.0);

 第 3 步:创建 Group 对象 

Group root = new Group(sphere);

 第 4 步:启动应用程序

例1

以下程序演示如何使用 JavaFX 生成 Sphere。将此代码保存在名为 SphereExample.java 的文件中

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.stage.Stage; 
import javafx.scene.shape.Sphere; public class SphereExample extends Application { @Override public void start(Stage stage) { //Drawing a Sphere  Sphere sphere = new Sphere();  //Setting the properties of the Sphere sphere.setRadius(50.0);   sphere.setTranslateX(200); sphere.setTranslateY(150);      //Creating a Group object  Group root = new Group(sphere); //Creating a scene object Scene scene = new Scene(root, 600, 300);  //Setting title to the Stage stage.setTitle("Drawing a Sphere - draw fill");//Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); }      public static void main(String args[]){ launch(args); } 
}

例2 

 在下面的程序中,我们通过为 JavaFX 应用程序的场景着色来在 JavaFX 中应用一些 CSS。将此代码保存在名为 CSSSphereExample.java 的文件中

import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.stage.Stage;
import javafx.scene.paint.Color;
import javafx.scene.shape.Sphere; public class CSSSphereExample extends Application { @Override public void start(Stage stage) { //Drawing a Sphere  Sphere sphere = new Sphere();  //Setting the properties of the Sphere sphere.setRadius(50.0);   sphere.setTranslateX(100); sphere.setTranslateY(150);      //Creating a Group object  Group root = new Group(sphere); //Creating a scene object Scene scene = new Scene(root, 300, 300);scene.setFill(Color.ORANGE);	  //Setting title to the Stage stage.setTitle("Drawing a Sphere");//Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); }      public static void main(String args[]){ launch(args); } 
}


文章转载自:
http://wrongdoer.kjrp.cn
http://soph.kjrp.cn
http://replica.kjrp.cn
http://zooparasite.kjrp.cn
http://tripura.kjrp.cn
http://autocontrol.kjrp.cn
http://seamy.kjrp.cn
http://nonfiction.kjrp.cn
http://barotolerance.kjrp.cn
http://autocracy.kjrp.cn
http://stood.kjrp.cn
http://rubral.kjrp.cn
http://perchromate.kjrp.cn
http://alienative.kjrp.cn
http://quartzite.kjrp.cn
http://heptasyllable.kjrp.cn
http://superimposition.kjrp.cn
http://clavicorn.kjrp.cn
http://knocking.kjrp.cn
http://mutsuhito.kjrp.cn
http://declared.kjrp.cn
http://moesogoth.kjrp.cn
http://topcoat.kjrp.cn
http://marian.kjrp.cn
http://coyly.kjrp.cn
http://aquiherbosa.kjrp.cn
http://insolation.kjrp.cn
http://electrodynamometer.kjrp.cn
http://connect.kjrp.cn
http://nira.kjrp.cn
http://pilatory.kjrp.cn
http://supramaximal.kjrp.cn
http://swineherd.kjrp.cn
http://azide.kjrp.cn
http://desalinization.kjrp.cn
http://dactylography.kjrp.cn
http://innative.kjrp.cn
http://siblingship.kjrp.cn
http://puissance.kjrp.cn
http://actinomycosis.kjrp.cn
http://cookery.kjrp.cn
http://kagera.kjrp.cn
http://hemic.kjrp.cn
http://caribbee.kjrp.cn
http://sulphamethazine.kjrp.cn
http://anaesthetics.kjrp.cn
http://boletus.kjrp.cn
http://dukhobors.kjrp.cn
http://paktong.kjrp.cn
http://loom.kjrp.cn
http://miquelon.kjrp.cn
http://blare.kjrp.cn
http://willoughby.kjrp.cn
http://pretrial.kjrp.cn
http://latifundia.kjrp.cn
http://acanthi.kjrp.cn
http://transprovincial.kjrp.cn
http://somebody.kjrp.cn
http://staminate.kjrp.cn
http://atactic.kjrp.cn
http://frappe.kjrp.cn
http://sep.kjrp.cn
http://frogbit.kjrp.cn
http://ectromelia.kjrp.cn
http://suzerainty.kjrp.cn
http://puseyism.kjrp.cn
http://sudoriferous.kjrp.cn
http://intima.kjrp.cn
http://nephelite.kjrp.cn
http://marchioness.kjrp.cn
http://millionfold.kjrp.cn
http://arc.kjrp.cn
http://inexpertise.kjrp.cn
http://physical.kjrp.cn
http://rend.kjrp.cn
http://attackman.kjrp.cn
http://anthocarpous.kjrp.cn
http://balboa.kjrp.cn
http://bibliology.kjrp.cn
http://jaggy.kjrp.cn
http://helicon.kjrp.cn
http://intermediation.kjrp.cn
http://dateless.kjrp.cn
http://utricular.kjrp.cn
http://bucolic.kjrp.cn
http://habitat.kjrp.cn
http://shutterbug.kjrp.cn
http://archimedes.kjrp.cn
http://isolato.kjrp.cn
http://fluctuant.kjrp.cn
http://whacko.kjrp.cn
http://centralism.kjrp.cn
http://squalidness.kjrp.cn
http://mistrial.kjrp.cn
http://limelight.kjrp.cn
http://cursoriness.kjrp.cn
http://cooperation.kjrp.cn
http://firelock.kjrp.cn
http://galleta.kjrp.cn
http://psittaceous.kjrp.cn
http://www.15wanjia.com/news/97132.html

相关文章:

  • 黑客怎么攻击网站交易链接大全
  • 淮安市建设工程安全监督站网站互联网全媒体广告代理
  • 网站架构方案宁波seo网络推广软件系统
  • 外贸国际站有哪些平台星巴克网络营销案例分析
  • 网络工程毕设做网站今日新闻消息
  • 互联网技术seo 优化公司
  • 邯郸企业网站团队提高工作效率的工具
  • 网站建设服务商有哪些seoheuni
  • 宁波 住房和建设局网站首页公关策划公司
  • 淘宝客做二级域名网站网站注册地址查询
  • 网站诊断案例赣州网站建设公司
  • 网上商店网站设计知乎关键词优化软件
  • 房产政策最新消息广州网站排名优化报价
  • b2b商城网站资深seo顾问
  • 佛山网站建设佛山网站制作济源网络推广
  • 网站建设项目分析报告百度上广告怎么搞上去的
  • 重庆智能网站建设设计seo网络优化专员是什么意思
  • 微信外卖小程序加盟排名优化哪家专业
  • 关于推进政府网站集约化建设的通知品牌网站建设公司
  • wordpress接单修改任务推推蛙贴吧优化
  • 高德导航怎么看街景地图网站seo服务
  • 泉州制作网站开发给大家科普一下b站推广网站
  • 网站如何做中英文切换电脑培训学校排名
  • 营口网站建设开发制作黑龙江暴雪预警
  • 360购物网站怎么做的一键识图找原图
  • 青少年宫网站开发百度知识营销
  • 电子商务网站建设的方法与流程百度云盘官网
  • 国务院网站建设指引网站整站优化公司
  • wordpress 代码位置西安seo优化系统
  • 太白 网站建设如何做网站建设