Saturday, 9 January 2016

Tutorial On Toggle Button In JavaFx

In this article we are going to show how to create a toggle button in java-fx with source code.Previously we have also created toggle button in java swing.
See Related Tutorials:
 how to create toggle button in javaswing.
How To Create HelloWord Application In JavaFx Using Netbeans.
Combo box in java-fx
Cosmetic Planet

CODE:

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.media.AudioClip;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

public class mybej extends Application
{

@Override
public void start(Stage primaryStage) {
Group g = new Group();
primaryStage.setTitle("Toggle Button In JavaFx");

final ToggleGroup group = new ToggleGroup();
final ToggleButton tb1 = new ToggleButton("ON");
tb1.setToggleGroup(group);
tb1.setSelected(false);
final Rectangle rect = new Rectangle(145, 50);
rect.setFill(Color.RED);
rect.setLayoutX(40);
rect.setLayoutY(40);
g.getChildren().addAll(tb1,rect);
group.selectedToggleProperty().addListener(new ChangeListener<Toggle>(){
public void changed(ObservableValue<? extends Toggle> ov,
Toggle toggle, Toggle new_toggle) {
if (new_toggle == null)
{
rect.setFill(Color.RED);
tb1.setText("ON");
}
else
{
rect.setFill(Color.BLUE);
tb1.setText("OFF");
}
}
});

Scene sc = new Scene(g,400,300);
primaryStage.setScene(sc);
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}

}

OUTPUT:

Minesweeper Game In Java-Fx For Free Download

We are back with a exciting game called minesweeper this game needs no introduction as it is the most oldest game.The only reason for sharing this game with you to provide a basic solutions of gaming in java-fx.So enjoy a free download of this game and feel free to share your opinion.

SCREENSHOT:





Friday, 1 January 2016

,

Tic Tac Toe Game In Java-Fx For Download

Tic tac toe is one of the most basic games in world of gaming.The reason of sharing this game code is to provide a opportunity to new game developers to learn basics of gaming in java-fx.This game is to free to download so grab it and don't forget share your reviews about it.

SNAP SHOT:








Sunday, 6 December 2015

How To Create Calculator In Web Page Using JQuery


How To Create Calculator In Web Page Using JQuery
In this article we  show you how to create simple calculator using jquery.This calculator is created with basic code such as if-else ladder and switches to show you how to perform basic operation in a webpages.Thank you enjoy the post and give your feed back.

CODE: 


Live Demo

Friday, 27 November 2015

How To Create Animated Back To Top PlugIn Using JQuery


Reading long article its very irritating to scroll up whole page using scroll bar I recommend you to add simple back to top plugin in you website adding below code.

How To Scroll Up Webpage On A Click Using Jquery:

As we know that jquery has various animations properties by using one of them we can do our task.Here is a syntax of method whic we are going to used in our example.

$('selector').animate({scrollTop : position},time in millisec)

CODE:



Live Demo

Thursday, 26 November 2015

How To Automatically Change Background Colour Of Website Using JQuery

How To Automatically Change  Background Colour Of  Website Using JQuery

In this post we are going to show you how to give new look to your website each time when new visitor visits your website this can be done using simple jquery ,javascripting and css code.

How To Automatically Generate New Background Color:

This can be done using simple logic we have to generate three random numbers between 0 to 256 to create and colour in RGB format we can generate random number by following code.
 var r =  Math.floor((Math.random() * 255) + 1);
Then by using below code we can change the background colour of any component in our website.
$("body").css("background",'rgb('+r+','+g+','+b+')');
On every new visit or refresh it will change background colour of website.Thats it enjoy the code and must give your feedback.

How To Automatically Changed Fixed Background Colour:

By using below code we can generate random colours of our own choice so when ever visitor refresh your website he gets new look.
var col = ["#ff8080","#80ff80","#8080ff","#ff80df"];
var r =  Math.floor((Math.random() * 3) + 1);
$("body").css("background",col[r]);
Thats it thankyou enjoy the code and must give your feedback.  

Wednesday, 25 November 2015

How To Validate HTML5 Forms Using Jquery

Validation is a process to check whether the user is filling right information or wrong in form by using this method we can stop user filling wrong or empty information in form.This process can be done using jquery and javascripting in this example we have shown how to validate empty field,how to validate email address and how to validate password strength.You can also use html required attribute to validate your form.

OUTPUT:

how to validate form using jquery and javascripting




CODE:


Live Demo