Presentation is loading. Please wait.

Presentation is loading. Please wait.

Javafx UI.

Similar presentations


Presentation on theme: "Javafx UI."— Presentation transcript:

1 Javafx UI

2 프로젝트 만들기 File->New Project
javaFX application 카테고리 선텍 -> JavaFX Application - >next 프로젝트 이름 작성 -> Finish 기본 프로젝트 생성->필요없는 부분 삭제 후 새로 작성

3 Grid Pane Form 설정

4 GridPane with Gap and Padding 설정
GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene);

5 Label //비어있는 레이블 생성 Label label1 = new Label(); //레이블 생성 및 속성값 설정
Label label2 = new Label("Search"); //그래픽 지정 레이블 설정 Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label3 = new Label("Search", new ImageView(image));

6 Label 아이콘 및 글자색지정 //글자 크기 및 폰트지정
Label label1 = new Label("Search"); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); label1.setGraphic(new ImageView(image)); label1.setTextFill(Color.web("#0076a3")); //글자 크기 및 폰트지정 label1.setFont(new Font("Arial", 30)); //글카 크기 및 폰트지정 2 label2.setFont(Font.font("Cambria", 32));

7 Button //비어있는 버튼 생성 Button button1 = new Button(); //글자속성을 갖는 버튼 생성.
Button button2 = new Button("Accept"); //이미지 아이콘을 갖는 버튼 생성 Image imageOk = new Image(getClass().getResourceAsStream("ok.png")); Button button3 = new Button("Accept", new ImageView(imageOk));

8 Radio Button //비어있는 라디오버튼 생성 RadioButton rb1 = new RadioButton();
//라디오 버튼 텍스트 설정 rb1.setText("Home"); //라디오 버튼 과 텍스트 설정 RadioButton rb2 = new RadioButton("Calendar"); //이미지 라디오 버튼 Image image = new Image(getClass().getResourceAsStream("ok.jpg")); RadioButton rb = new RadioButton("Agree"); rb.setGraphic(new ImageView(image));

9 Radio Buttons to Groups
final ToggleGroup group = new ToggleGroup(); RadioButton rb1 = new RadioButton("Home"); rb1.setToggleGroup(group); rb1.setSelected(true); RadioButton rb2 = new RadioButton("Calendar"); rb2.setToggleGroup(group); RadioButton rb3 = new RadioButton("Contacts"); rb3.setToggleGroup(group);

10 Toggle Button //토글버튼 기본 생성 ToggleButton tb1 = new ToggleButton();
//텍스트 설정 토글버튼 생성 ToggleButton tb2 = new ToggleButton("Press me"); //토글버튼과 이미지 아이콘 생성 Image image = new Image(getClass().getResourceAsStream("icon.png")); ToggleButton tb3 = new ToggleButton ("Press me", new ImageView(image));

11 ToggleGroup 설정 final ToggleGroup group = new ToggleGroup();
ToggleButton tb1 = new ToggleButton("Minor"); tb1.setToggleGroup(group); tb1.setSelected(true); ToggleButton tb2 = new ToggleButton("Major"); tb2.setToggleGroup(group); ToggleButton tb3 = new ToggleButton("Critical"); tb3.setToggleGroup(group);

12 CheckBox //체크박스 기본 생성 CheckBox cb1 = new CheckBox(); //텍스트 설정 체크박스 생성
CheckBox cb2 = new CheckBox("Second"); cb1.setText("First"); cb1.setSelected(true);

13 체크박스 설정

14 Choice Box ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList( "First", "Second", "Third"));

15 Text Field //레이블과 함께 선언하기 Label label1 = new Label("Name:");
TextField textField = new TextField (); HBox hb = new HBox(); hb.getChildren().addAll(label1, textField); hb.setSpacing(10);

16 Text Field //텍스트필드안에 메시지 넣기 final TextField name = new TextField();
name.setPromptText("Enter your first name."); GridPane.setConstraints(name, 0, 0); grid.getChildren().add(name);

17 Password Field PasswordField passwordField = new PasswordField();
passwordField.setPromptText("Your password");

18 Scroll Bar ScrollBar sc = new ScrollBar(); sc.setMin(0);
sc.setMax(100); sc.setValue(50);

19 Scroll Pane Image roses = new Image(getClass().getResourceAsStream("roses.jpg")); ScrollPane sp = new ScrollPane(); sp.setContent(new ImageView(roses)); sp.setHbarPolicy(ScrollBarPolicy.NEVER); sp.setVbarPolicy(ScrollBarPolicy.ALWAYS);

20 List View ListView<String> list = new ListView<>();
ObservableList<String> items =FXCollections.observableArrayList ( "Single", "Double", "Suite", "Family App"); list.setItems(items); list.setPrefWidth(100); list.setPrefHeight(70);

21 Table View private final TableView table = new TableView();
TableColumn firstNameCol = new TableColumn("First Name"); TableColumn lastNameCol = new TableColumn("Last Name"); TableColumn Col = new TableColumn(" "); table.getColumns().addAll(firstNameCol, lastNameCol, Col);

22 Combo Box ObservableList<String> options =
FXCollections.observableArrayList("Option 1", "Option 2", "Option 3" ); final ComboBox comboBox = new ComboBox(options); comboBox.getItems().addAll( "Option 4", "Option 5", "Option 6"

23 Separator //Horizontal separator
Separator separator1 = new Separator(); //Vertical separator Separator separator2 = new Separator(); separator2.setOrientation(Orientation.VERTICAL);

24 Slider Slider slider = new Slider(); slider.setMin(0);
slider.setMax(100); slider.setValue(40); slider.setShowTickLabels(true); slider.setShowTickMarks(true); slider.setMajorTickUnit(50); slider.setMinorTickCount(5); slider.setBlockIncrement(10);

25 Progress Bar and Progress Indicator
ProgressBar pb = new ProgressBar(0.6); ProgressIndicator pi = new ProgressIndicator(0.6);

26 Menu MenuBar ■ MenuItem – Menu – CheckMenuItem – RadioMenuItem
– CustomMenuItem * SeparatorMenuItem

27 Menu 생성 MenuBar menuBar = new MenuBar(); // --- Menu File
Menu menuFile = new Menu("File"); // --- Menu Edit Menu menuEdit = new Menu("Edit"); // --- Menu View Menu menuView = new Menu("View"); menuBar.getMenus().addAll(menuFile, menuEdit, menuView);

28 Color Picker //비어있는 Picker와 기본색 흰색 설정
ColorPicker colorPicker1 = new ColorPicker(); //컬러 세트와 기본색 설정 ColorPicker colorPicker2 = new ColorPicker(Color.BLUE); //웹컬러 설정 ColorPicker colorPicker3 = new ColorPicker(Color.web("#ffcce6"));

29 Date Picker private Stage stage; private DatePicker checkInDatePicker;
public static void main(String[] args) { Locale.setDefault(Locale.US); launch(args); } @Override public void start(Stage stage) { this.stage = stage; stage.setTitle("DatePickerSample "); initUI(); stage.show();

30 한학기 동안 수고 하셨습니다.


Download ppt "Javafx UI."

Similar presentations


Ads by Google