javafx.scene.control.Tab.getGraphic()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(252)

本文整理了Java中javafx.scene.control.Tab.getGraphic()方法的一些代码示例,展示了Tab.getGraphic()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tab.getGraphic()方法的具体详情如下:
包路径:javafx.scene.control.Tab
类名称:Tab
方法名:getGraphic

Tab.getGraphic介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

  1. tabLabel.setText(tab.getText());
  2. } else if ("GRAPHIC".equals(p)) {
  3. tabLabel.setGraphic(tab.getGraphic());
  4. } else if ("TOOLTIP".equals(p)) {

代码示例来源:origin: jfoenixadmin/JFoenix

  1. setStyle(tab.getStyle());
  2. tabLabel = new Label(tab.getText(), tab.getGraphic());
  3. tabLabel.getStyleClass().setAll("tab-label");

代码示例来源:origin: com.aquafx-project/aquafx

  1. @Override public void run() {
  2. for (Tab tab : tabPane.getTabs()) {
  3. if (tab.getGraphic() != null) {
  4. tab.getGraphic().getStyleClass().add("icon");
  5. }
  6. }
  7. }
  8. });

代码示例来源:origin: org.gillius/jfxutils

  1. /**
  2. * Makes the specified tab draggable. It can be dragged to a {@link TabPane} set up by {@link #makeDroppable(TabPane)}.
  3. * setOnDragDetected on the tab's graphic is called to handle the event.
  4. */
  5. public static void makeDraggable( final Tab tab ) {
  6. tab.getGraphic().setOnDragDetected( new EventHandler<MouseEvent>() {
  7. @Override
  8. public void handle( MouseEvent event ) {
  9. Dragboard dragboard = tab.getGraphic().startDragAndDrop( TransferMode.MOVE );
  10. ClipboardContent clipboardContent = new ClipboardContent();
  11. clipboardContent.put( TAB_TYPE, 1 );
  12. dndTab = new WeakReference<>( tab );
  13. dragboard.setContent( clipboardContent );
  14. event.consume();
  15. }
  16. } );
  17. }

代码示例来源:origin: org.gillius/jfxutils

  1. @Override
  2. public void handle( MouseEvent event ) {
  3. Dragboard dragboard = tab.getGraphic().startDragAndDrop( TransferMode.MOVE );
  4. ClipboardContent clipboardContent = new ClipboardContent();
  5. clipboardContent.put( TAB_TYPE, 1 );
  6. dndTab = new WeakReference<>( tab );
  7. dragboard.setContent( clipboardContent );
  8. event.consume();
  9. }
  10. } );

代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx

  1. /**
  2. * set the color of the graphic of the given tab
  3. *
  4. * @param tab
  5. * - the tab to change
  6. * @param oldColor
  7. * - the old color
  8. * @param newColor
  9. * - the new color
  10. */
  11. protected void setColor(Tab tab, Color oldColor, Color newColor) {
  12. if (debug)
  13. LOGGER.log(Level.INFO, "changing tab color for " + tab.getId() + " from "
  14. + oldColor + " to " + newColor);
  15. Node graphic = tab.getGraphic();
  16. if (graphic instanceof Glyph) {
  17. Glyph glyph = (Glyph) graphic;
  18. glyph.setColor(newColor);
  19. } else if (graphic instanceof ImageView) {
  20. // https://docs.oracle.com/javafx/2/image_ops/jfxpub-image_ops.htm
  21. ImageView imageView = (ImageView) graphic;
  22. imageView.setImage(reColor(imageView.getImage(), oldColor, newColor));
  23. }
  24. }

代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx

  1. if (tab.getGraphic() == null) {
  2. tab.setText(title);

代码示例来源:origin: com.jfoenix/jfoenix

  1. setStyle(tab.getStyle());
  2. tabLabel = new Label(tab.getText(), tab.getGraphic());
  3. tabLabel.getStyleClass().setAll("tab-label");
  4. });
  5. listener.registerChangeListener(tab.textProperty(), obs-> tabLabel.setText(tab.getText()));
  6. listener.registerChangeListener(tab.graphicProperty(), obs-> tabLabel.setGraphic(tab.getGraphic()));
  7. listener.registerChangeListener(widthProperty(), obs-> header.updateSelectionLine(true));
  8. listener.registerChangeListener(tab.tooltipProperty(), obs->{

相关文章