Skip to content

Commit

Permalink
JavaFx
Browse files Browse the repository at this point in the history
  • Loading branch information
khalidt committed Feb 22, 2016
1 parent 5d1537b commit 7221f63
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Fxtemp/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions Fxtemp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
23 changes: 23 additions & 0 deletions Fxtemp/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Fxtemp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions Fxtemp/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
8 changes: 8 additions & 0 deletions Fxtemp/build.fxbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="Fxtemp"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>
71 changes: 71 additions & 0 deletions Fxtemp/src/application/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package application;
/*
* First FX
* By Khalid
*/
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.*;
import javafx.stage.Stage;


public class Main extends Application {
// Text dec
Text title = new Text(1,40,"Welcome to JavaFX");
Text txt1 = new Text(50,100,"Khalid");
Text txt2 = new Text(50,150,"FX is easy...");
// Font pro
Font f1 = Font.font("Arial",FontWeight.BOLD,FontPosture.REGULAR,24);
Font f2 = Font.font ("Courier", FontWeight.NORMAL, FontPosture.ITALIC, 20);
Font f3 = Font.font("Atial",40);
// Color pro
Color c1= new Color (0,0,1,1);
Color black = new Color (0,0,0,1);
Color c2= new Color (.7,0,.7,1);
// Circle dec & pro
Circle cir= new Circle(200,100,30,Color.BLACK);
//Line shape
Line l1 = new Line(0,0, 400, 400);
//Polugone
Polygon pol = new Polygon(200,140,40,20,.10,.40);
//Rectangle
Rectangle r1= new Rectangle(80,200,50,80);
//Pane
Pane pan = new Pane();
//@Override
public void start(Stage primaryStage) {
title.setFont(f1);// set font f1 to text title
title.setFill(c1);// set color c1 to text title
txt1.setFont(f2);
txt1.setFill(c2);
r1.setFill(Color.AQUAMARINE);

// use fun setpro to set Font and Color to text txt2.
setpro(txt2,f2,black);

cir.setStroke(Color.RED);// Line around the Circle ÇØÇÑ

pan.getChildren().addAll(title,txt1,txt2,cir,l1,pol,r1);// put the texts in Pane

Scene sc = new Scene(pan,400,400);// put Pane in Scene
primaryStage.setScene(sc); // put Scene in a Stage(primaryStage)
primaryStage.setTitle("Java FX new Java ^_^");
primaryStage.show(); // show the Stage

}
public static void main(String[] args) {
launch(args);
}
// function to put Font and Color for a Text
Text setpro(Text t, Font f, Color c){
t.setFont(f);
t.setFill(c);
return t ;
}
}
1 change: 1 addition & 0 deletions Fxtemp/src/application/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

0 comments on commit 7221f63

Please sign in to comment.