Veja abaixo uma imagem do programa em execução:
Veja abaixo o código do programa:
Veja abaixo o código do programa:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class PROJETO extends Application {
static ImageView imageView = new ImageView ( );
static Group root = new Group ( );
static Scene scene = new Scene ( root, 340, 135, Color.BLACK );
final static TextField name = new TextField ( );
static GridPane grid = new GridPane ( );
///////////////////////////////////////////////////////////////////////////
public static int Image_View ( ) throws FileNotFoundException {
Image image = new Image ( new FileInputStream (
"C:\\Users\\Programador\\Desktop\\Foto\\display.PNG" ) );
imageView = new ImageView ( image );
imageView.setX ( -9 );// coluna
imageView.setY ( 0 );// linha
imageView.setFitHeight ( 639 );// Comprimento da
janela
imageView.setFitWidth ( 350 );// largura da janela
imageView.setPreserveRatio ( true );
return 0;
}
////////////////////////////////////////////////////////////////////////////
public static int Text_Field ( ) {
grid.setVgap ( 5 );
grid.setHgap ( 5 );
grid.setMaxSize ( 340, 440 );
name.setPadding ( new Insets ( 69, 20, 5, 35 ) );
name.setTranslateX ( 31 );
name.setTranslateY ( 24 );
name.setAlignment ( Pos.BOTTOM_RIGHT );
name.setStyle ( "-fx-font-family:
Consolas;" + "-fx-font-style: italic;"
+ "-fx-font-size:
15px;" + "-fx-base: #183308;" );
name.setPrefColumnCount ( 28 );
return 0;
}
/////////////////////////////////////////////////////////////////////////////
@Override
public void start ( Stage stage ) throws FileNotFoundException {
stage.setScene ( scene );
stage.setTitle ( "Display -
TextField em javaFx" );
Image_View ( );
Text_Field ( );
root.getChildren ( ).addAll ( imageView, grid, name );
stage.show ( );
}
public static void main ( String [ ] args ) {
launch ( args );
}
}
Nenhum comentário:
Postar um comentário
Observação: somente um membro deste blog pode postar um comentário.