Package javafx.scene.control

Examples of javafx.scene.control.TitledPane


          try {
          ApplicationConfiguration appConfiguration = new DefaultApplicationConfiguration();
          Fxml layout = appConfiguration.getLayout();
          Parent rootPane = (Parent) FXMLLoader.load(layout.getFxmlUrl());
          AnchorPane anchor;
          TitledPane title = null;
          if (rootPane instanceof AnchorPane){
            anchor = (AnchorPane) rootPane;
          } else if (rootPane instanceof TitledPane){
            title = (TitledPane) rootPane;
            anchor = (AnchorPane) title.getContent();
          } else {
            throw new IllegalStateException("could not handle " + rootPane.getClass().getName());
          }
           //TitledPane
              // This line to resolve keys against Bundle.properties
              //ResourceBundle i18nBundle = ResourceBundle.getBundle("helloi18n.Bundle", new Locale("en", "US"));
              // This line to resolve keys against Bundle_fr_FR.properties
//              ResourceBundle i18nBundle = ResourceBundle.getBundle("helloi18n.Bundle", new Locale("fr", "FR"));
              //AnchorPane page = (AnchorPane) FXMLLoader.load(YogaAppFx.class.getResource("HelloI18N.fxml"), i18nBundle);
              Scene scene = new Scene(anchor);
              primaryStage.setScene(scene);
              if (title != null)
                primaryStage.setTitle( title.getText());//TODO translate
              primaryStage.show();
          } catch (Exception ex) {
              Logger.getLogger(JavaFXApplication.class.getName()).log(Level.SEVERE, null, ex);
            throw ThrowableBoostUtils.toRuntimeException(ex);
          }    
View Full Code Here


    @Override public void start(Stage stage) {
        stage.setTitle("TitledPane");
        Scene scene = new Scene(new Group(), 400, 250);
       
        // --- GridPane container
        TitledPane gridTitlePane = new TitledPane();
        GridPane grid = new GridPane();
        grid.setVgap(4);
        grid.setPadding(new Insets(5, 5, 5, 5));
        grid.add(new Label("To: "), 0, 0);
        grid.add(new TextField(), 1, 0);
        grid.add(new Label("Cc: "), 0, 1);
        grid.add(new TextField(), 1, 1);
        grid.add(new Label("Subject: "), 0, 2);
        grid.add(new TextField(), 1, 2);       
        grid.add(new Label("Attachment: "), 0, 3);
        grid.add(label,1, 3);
        gridTitlePane.setText("Grid");
        gridTitlePane.setContent(grid);
       
        // --- Accordion
        final Accordion accordion = new Accordion ();               
        for (int i = 0; i < imageNames.length; i++) {
            images[i] = new
                Image(AquaFx.class.getResource("demo/images/"+imageNames[i] + ".png").toExternalForm());
            pics[i] = new ImageView(images[i]);
            tps[i] = new TitledPane(imageNames[i],pics[i]);
        }  
        accordion.getPanes().addAll(tps);
        accordion.setExpandedPane(tps[0]);
        accordion.expandedPaneProperty().addListener(new
            ChangeListener<TitledPane>() {
View Full Code Here

                final AnchorPane pane = new AnchorPane();
                AnchorPane.setBottomAnchor(view, 0.0);
                AnchorPane.setTopAnchor(view, 0.0);
                pane.getChildren().add(view);

                aboutInfoAccordion.getPanes().add(new TitledPane(fname, pane));
            } catch (MalformedURLException e) {
                logger.warn("Could not load info file -- {}", url);
            } catch (IOException e) {
                logger.warn("Failed to parse markdown file {}", url, e);
            }
View Full Code Here

    super(parent, style);
  }
 
  @Override
  protected void createWidget() {
    pane = new TitledPane();
    pane.setCollapsible(false);
    layoutPane = new FXLayoutPane(this);
    pane.setContent(layoutPane);
  }
View Full Code Here

  @Inject
  public ControlPanel(BorderPane p, final MApplication application, final MWindow window, @Optional final MPerspective perspective, final EPartService partService, final EModelService modelService, PopupMenuService<Control> menuService) {
    VBox box = new VBox();
   
    {
      TitledPane pane = new TitledPane();
      pane.setText("Part");
     
      VBox vbox = new VBox();
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Toggle Rendering");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            part.setToBeRendered(!part.isToBeRendered());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Toggle Visibile");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            part.setVisible(!part.isVisible());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Add new Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @SuppressWarnings("unchecked")
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
           
            MPart p = BasicFactoryImpl.eINSTANCE.createPart();
            p.setLabel("New Part");
            p.setContributionURI("bundleclass://at.bestsolution.efxclipse.testcases.e4/at.bestsolution.efxclipse.testcases.e4.parts.ContentPanel");
            container.getChildren().add(p);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Remove last Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
            container.getChildren().remove(container.getChildren().size()-1);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MElementContainer> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
         
          @Override
          public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
            return new ListCell<MElementContainer>() {
              @Override
              protected void updateItem(MElementContainer item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getClass().getSimpleName())
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Move last Part");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MElementContainer container = dd.getSelectionModel().getSelectedItem();
            Object o = container.getChildren().remove(container.getChildren().size()-1);
            container.getChildren().add(container.getChildren().size()-1, o);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPart> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
         
          @Override
          public ListCell<MPart> call(ListView<MPart> param) {
            return new ListCell<MPart>() {
              @Override
              protected void updateItem(MPart item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Detach");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPart part = dd.getSelectionModel().getSelectedItem();
            modelService.detach(part, 0, 0, 300, 300);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
       
        final ComboBox<MPerspective> dd = new ComboBox<>();
        dd.setCellFactory(new Callback<ListView<MPerspective>, ListCell<MPerspective>>() {
         
          @Override
          public ListCell<MPerspective> call(ListView<MPerspective> param) {
            return new ListCell<MPerspective>() {
              @Override
              protected void updateItem(MPerspective item, boolean empty) {
                super.updateItem(item, empty);
                if( item != null ) {
                  setText(item.getLocalizedLabel());
                }
              }
            };
          }
        });
        dd.setItems(FXCollections.observableArrayList(modelService.findElements(application, null, MPerspective.class, null)));
        hbox.getChildren().add(dd);
       
        Button b = new Button("Unrender");
        b.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            MPerspective part = dd.getSelectionModel().getSelectedItem();
            engine.removeGui(part);
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      pane.setContent(vbox);
      box.getChildren().add(pane);
    }
   
    {
      TitledPane pane = new TitledPane();
      pane.setText("Window Properties");
     
      VBox vbox = new VBox(10);
     
      {
        HBox hbox = new HBox(10);
        hbox.getChildren().add(new Label("X"));
        final TextField f = new TextField(window.getX()+"");
        f.setId("text_windowX");
        hbox.getChildren().add(f);
       
        Button b = new Button("Set");
        b.setId("button_windowX");
        b.setOnAction(new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            window.setX(Integer.parseInt(f.getText()));
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
        hbox.getChildren().add(new Label("Y"));
        final TextField f = new TextField(window.getY()+"");
        hbox.getChildren().add(f);
       
        Button b = new Button("Set");
        b.setOnAction(new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            window.setY(Integer.parseInt(f.getText()));
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
        hbox.getChildren().add(new Label("W"));
        final TextField f = new TextField(window.getWidth()+"");
        hbox.getChildren().add(f);
       
        Button b = new Button("Set");
        b.setOnAction(new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            window.setWidth(Integer.parseInt(f.getText()));
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
        hbox.getChildren().add(new Label("H"));
        final TextField f = new TextField(window.getHeight()+"");
        hbox.getChildren().add(f);
       
        Button b = new Button("Set");
        b.setOnAction(new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            window.setHeight(Integer.parseInt(f.getText()));
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      {
        HBox hbox = new HBox(10);
        hbox.getChildren().add(new Label("Title"));
        final TextField f = new TextField(window.getLabel()+"");
        hbox.getChildren().add(f);
       
        Button b = new Button("Set");
        b.setOnAction(new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            window.setLabel(f.getText());
          }
        });
        hbox.getChildren().add(b);
        vbox.getChildren().add(hbox);
      }
     
      pane.setContent(vbox);
      box.getChildren().add(pane);     
    }
   
    {
      Label label = new Label("Context menu");
View Full Code Here

TOP

Related Classes of javafx.scene.control.TitledPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.