Sunday, September 6, 2015

Mastering NetBeans

Master building complex applications with NetBeans to become more proficient programmers


About This Book
  • Customize NetBeans to fit your unique needs
  • Excel in NetBeans IDE, learning the shortcuts and hidden features to become more productive
  • A comprehensive guide to become more productive at application development using NetBeans IDE
Who This Book Is For
If you are a competent developer who wants to fast-track your application development with NetBeans IDE, then this book is for you. Reasonable knowledge and an understanding of Java programming and NetBeans IDE is assumed.

What You Will Learn
  • Install NetBeans either from a distribution package or from source code
  • Test, debug, and run production code using the NetBeans IDE
  • Use external services such as PaaS environments and web services
  • Create desktop applications using Swing tools
  • Manage and configure relational databases
  • Build a Java business model and web tiers using Java EE and Spring technologies
  • Explore web services both with XML and RESTful approaches
  • Handle external services such as databases , Maven repositories, and cloud providers
  • Extend NetBeans for those situations where you require more from your IDE
In Detail
With the increasing complexity of software development and the abundance of tools available, learning your IDE in-depth will instantly increase your developer productivity. NetBeans is the only IDE that can be downloaded with Java itself and provides you with many cutting edge features not readily available with many IDEs. The IDE also provides a great set of tools for PHP and C/C++ developers. It is free and open source and has a large community of users and developers around the world.

This book will teach you to ace NetBeans IDE and make use of it in creating Java business and web services. It will help you to become a proficient developer and use NetBeans for software development. You will learn effective third-party interaction and enable yourself for productive database development.

Moving on, you will see how to create EJB projects and write effective and efficient web applications. Then you will learn how to use Swing and manage and configure a relational database. By the end of the book, you will be able to handle external services such as databases, Maven repositories, and cloud providers, and extend your NetBeans when you require more from your IDE.

Style and approach
An easy-to-follow yet comprehensive guide to help you master the exhaustive range of NetBeans features in order to become more efficient at Java programing. More advanced topics are covered in each chapter, with subjects grouped according to their complexity as well as their utility.

Friday, September 4, 2015

JavaFX example - set ViewPort of ImageView


Example to change ViewPort of ImageView, and rotate ImageView.

package javafx_imageview_viewport;

import javafx.application.Application;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.control.Slider;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

/**
 * @web http://java-buddy.blogspot.com/
 */
public class JavaFX_ImageView_Viewport extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        
        ImageView imageView1 = new ImageView(new Image("http://goo.gl/kYEQl"));
        
        //Example to rotate ImageView
        Image image2 = new Image("http://goo.gl/kYEQl");
        Rectangle2D viewportRect2 = new Rectangle2D(
                image2.getWidth()/4, 
                image2.getHeight()/4, 
                image2.getWidth()*3/4, 
                image2.getHeight()*3/4);
        ImageView imageView2 = new ImageView(image2);
        imageView2.setViewport(viewportRect2);
        
        Slider sliderRotate = new Slider();
        sliderRotate.setMin(0);
        sliderRotate.setMax(360);
        sliderRotate.setValue(0);
        sliderRotate.valueProperty().addListener(
                (ObservableValue<? extends Number> observable, 
                        Number oldValue, Number newValue) -> {
            imageView2.setRotate((double)newValue);
        });
        
        //Example to change ViewPort
        Image image3 = new Image("http://goo.gl/kYEQl");
        Rectangle2D viewportRect3 = new Rectangle2D(
                0, 
                0, 
                image3.getWidth(), 
                image3.getHeight());
        ImageView imageView3 = new ImageView(image3);
        imageView3.setViewport(viewportRect3);
        
        Slider sliderViewPort = new Slider();
        sliderViewPort.setMin(0);
        sliderViewPort.setMax(1.0);
        sliderViewPort.setValue(1.0);
        sliderViewPort.valueProperty().addListener(
                (ObservableValue<? extends Number> observable, 
                        Number oldValue, Number newValue) -> {
            Rectangle2D newViewportRect3 = new Rectangle2D(
                    0,
                    0,
                    (double)newValue*image3.getWidth(),
                    (double)newValue*image3.getHeight());
            imageView3.setViewport(newViewportRect3);
        });
        

        VBox vBox = new VBox();
        vBox.getChildren().addAll(imageView1, 
                imageView2, sliderRotate,
                imageView3, sliderViewPort);
        
        StackPane root = new StackPane();
        root.getChildren().add(vBox);
        
        Scene scene = new Scene(root, 300, 350);
        
        primaryStage.setTitle("java-buddy: ImageVIew ViewPort");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
    
}



Wednesday, September 2, 2015

JavaFX example: Label with image

JavaFX example to create Label with ImageView.


package javafx_imagelabel;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
 * @web http://java-buddy.blogspot.com/
 */
public class JavaFX_ImageLabel extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        
        /*
        //Create Label with ImageView
        Label imageLabel = new Label(
                "java-buddy.blogspot.com", 
                new ImageView(new Image("http://goo.gl/kYEQl")));
        */

        //Create Label, then add graphic to it
        Label imageLabel = new Label("java-buddy.blogspot.com");
        imageLabel.setGraphic(new ImageView(new Image("http://goo.gl/kYEQl")));

        
        StackPane root = new StackPane();
        root.getChildren().add(imageLabel);
        
        Scene scene = new Scene(root, 300, 250);
        
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

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