类javafx.scene.control.Skin源码实例Demo

下面列出了怎么用javafx.scene.control.Skin的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: pmd-designer   文件: TreeViewWrapper.java
private void initialiseTreeViewReflection() {

        // we can't use wrapped.getSkin() because it may be null.
        // we don't care about the specific instance, we just want the class
        @SuppressWarnings("PMD.UselessOverridingMethod")
        Skin<?> dftSkin = new TreeView<Object>() {
            @Override
            protected Skin<?> createDefaultSkin() {
                return super.createDefaultSkin();
            }
        }.createDefaultSkin();

        Object flow = getVirtualFlow(dftSkin);

        if (flow == null) {
            return;
        }

        treeViewFirstVisibleMethod = MethodUtils.getMatchingMethod(flow.getClass(), "getFirstVisibleCell");
        treeViewLastVisibleMethod = MethodUtils.getMatchingMethod(flow.getClass(), "getLastVisibleCell");
    }
 
源代码2 项目: phoebus   文件: IncDecSlider.java
@Override
protected Skin<?> createDefaultSkin()
{
    final SliderSkin skin = (SliderSkin) super.createDefaultSkin();

    // SliderSkin is accessible, but the more interesting
    // com.sun.javafx.scene.control.behavior.SliderBehavior
    // is not.
    // Work around this by locating 'track'...
    for (Node node : skin.getChildren())
        if (node.getStyleClass().contains("track"))
        {
            // Capture mouse clicks, use to inc/dec instead of jumping there
            node.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> handleTrackClick(node, event));

            // Disable mouse drag, which by default also jumps to mouse
            node.setOnMouseDragged(null);
            break;
        }

    return skin;
}
 
源代码3 项目: Medusa   文件: Clock.java
@Override protected Skin createDefaultSkin() {
    switch(skinType) {
        case YOTA2     : return new ClockSkin(Clock.this);
        case LCD       : return new LcdClockSkin(Clock.this);
        case PEAR      : return new PearClockSkin(Clock.this);
        case PLAIN     : return new PlainClockSkin(Clock.this);
        case DB        : return new DBClockSkin(Clock.this);
        case FAT       : return new FatClockSkin(Clock.this);
        case ROUND_LCD : return new RoundLcdClockSkin(Clock.this);
        case SLIM      : return new SlimClockSkin(Clock.this);
        case MINIMAL   : return new MinimalClockSkin(Clock.this);
        case DIGITAL   : return new DigitalClockSkin(Clock.this);
        case TEXT      : return new TextClockSkin(Clock.this);
        case DESIGN    : return new DesignClockSkin(Clock.this);
        case INDUSTRIAL: return new IndustrialClockSkin(Clock.this);
        case TILE      : return new TileClockSkin(Clock.this);
        case DIGI      : return new DigitalClockSkin(Clock.this);
        case MORPHING  : return new MorphingClockSkin(Clock.this);
        case CLOCK     :
        default        : return new ClockSkin(Clock.this);
    }
}
 
源代码4 项目: Medusa   文件: FGauge.java
public FGauge(final Gauge GAUGE, final GaugeDesign DESIGN, final GaugeBackground BACKGROUND) {
    getStylesheets().add(getClass().getResource("framed-gauge.css").toExternalForm());
    getStyleClass().setAll("framed-gauge");
    gauge           = GAUGE;
    gaugeDesign     = DESIGN;
    gaugeBackground = BACKGROUND;

    Skin skin = gauge.getSkin();

    if (null == skin) {
        throw new RuntimeException("Please use a valid Skin.");
    }

    init();
    initGraphics();
    registerListeners();
}
 
源代码5 项目: pmd-designer   文件: TreeViewWrapper.java
private Object getVirtualFlow(Skin<?> skin) {
    try {
        // On JRE 9 and 10, the field is declared in TreeViewSkin
        // http://hg.openjdk.java.net/openjfx/9/rt/file/c734b008e3e8/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeViewSkin.java#l85
        // http://hg.openjdk.java.net/openjfx/10/rt/file/d14b61c6be12/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeViewSkin.java#l85
        // On JRE 8, the field is declared in the VirtualContainerBase superclass
        // http://hg.openjdk.java.net/openjfx/8/master/rt/file/f89b7dc932af/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualContainerBase.java#l68

        return FieldUtils.readField(skin, "flow", true);
    } catch (IllegalAccessException ignored) {

    } catch (RuntimeException re) {
        if (!reflectionImpossibleWarning && "java.lang.reflect.InaccessibleObjectException".equals(re.getClass().getName())) {
            // that exception was introduced for Jigsaw (JRE 9)
            // so we can't refer to it without breaking compat with Java 8

            // TODO find a way to report errors in the app directly, System.out is too shitty

            System.out.println();
            System.out.println("On JRE 9+, the following VM argument makes the controls smarter:");
            System.out.println("--add-opens javafx.controls/javafx.scene.control.skin=ALL-UNNAMED");
            System.out.println("Please consider adding it to your command-line or using the launch script bundled with PMD's binary distribution.");

            reflectionImpossibleWarning = true;
        } else {
            throw re;
        }
    }
    return null;
}
 
源代码6 项目: pmd-designer   文件: XPathAutocompleteProvider.java
private void showAutocompletePopup(int insertionIndex, String input) {

        CompletionResultSource suggestionMaker = mySuggestionProvider.get();

        List<MenuItem> suggestions =
            suggestionMaker.getSortedMatches(input, 5)
                           .map(result -> {

                               Label entryLabel = new Label();
                               entryLabel.setGraphic(result.getTextFlow());
                               entryLabel.setPrefHeight(5);
                               CustomMenuItem item = new CustomMenuItem(entryLabel, true);
                               item.setUserData(result);
                               item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getStringMatch()));
                               return item;
                           })
                           .collect(Collectors.toList());

        autoCompletePopup.getItems().setAll(suggestions);


        myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length())
                  .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY()));

        Skin<?> skin = autoCompletePopup.getSkin();
        if (skin != null) {
            Node fstItem = skin.getNode().lookup(".menu-item");
            if (fstItem != null) {
                fstItem.requestFocus();
            }
        }
    }
 
源代码7 项目: SONDY   文件: DataManipulationUI.java
public final void filterUI(){
        GridPane gridLEFT = new GridPane();
        // Labels
        Label stopwordsLabel = new Label("Stop words removal");
        UIUtils.setSize(stopwordsLabel, Main.columnWidthLEFT/2, 24);
        Label resizingLabel = new Label("Resizing");
        UIUtils.setSize(resizingLabel, Main.columnWidthLEFT/2, 24);
        gridLEFT.add(stopwordsLabel,0,0);
        gridLEFT.add(new Rectangle(0,3),0,1);
        gridLEFT.add(resizingLabel,0,2);
        
        // Values
        stopwordLists = new StopwordSets();
        stopwordListsCheckComboBox = new CheckComboBox<>(stopwordLists.availableSets);
        stopwordListsCheckComboBox.setStyle("-fx-font-size: 12px;"); 
        stopwordListsCheckComboBox.skinProperty().addListener(new ChangeListener<Skin>() {
        @Override
        public void changed(ObservableValue<? extends Skin> observable, Skin oldValue, Skin newValue) {
             if(oldValue==null && newValue!=null){
                 CheckComboBoxSkin skin = (CheckComboBoxSkin)newValue;
                 ComboBox combo = (ComboBox)skin.getChildren().get(0);
                 combo.setPrefWidth(Main.columnWidthLEFT/2);
                 combo.setMaxWidth(Double.MAX_VALUE);
             }
        }
});
//        stopwordListsCheckComboBox.setMaxWidth(Double.MAX_VALUE);
                
//        UIUtils.setSize(stopwordListsCheckComboBox,Main.columnWidthLEFT/2, 24);
        gridLEFT.add(stopwordListsCheckComboBox,1,0);
        resizeSlider = new RangeSlider();
        resizeSlider.setBlockIncrement(0.1);
        UIUtils.setSize(resizeSlider,Main.columnWidthLEFT/2, 24);
        resizeSlider.resize(Main.columnWidthLEFT/2, 24);
        gridLEFT.add(resizeSlider,1,2);

        HBox filterDatasetBOTH = new HBox(5);
        filterDatasetBOTH.getChildren().addAll(gridLEFT,createFilterButton());
        grid.add(filterDatasetBOTH,0,11);
    }
 
源代码8 项目: ARMStrong   文件: CellUtils.java
private static <T> boolean listenToComboBoxSkin(final ComboBox<T> comboBox, final Cell<T> cell) {
    Skin<?> skin = comboBox.getSkin();
    if (skin != null && skin instanceof ComboBoxListViewSkin) {
        ComboBoxListViewSkin cbSkin = (ComboBoxListViewSkin) skin;
        Node popupContent = cbSkin.getPopupContent();
        if (popupContent != null && popupContent instanceof ListView) {
            popupContent.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> cell.commitEdit(comboBox.getValue()));
            return true;
        }
    }
    return false;
}
 
源代码9 项目: FxDock   文件: FxTreeTable.java
protected void fixHorizontalScrollbar()
{
	Skin skin = tree.getSkin();
	if(skin == null)
	{
		return;
	}
	
	for(Node n: skin.getNode().lookupAll(".scroll-bar"))
	{
		if(n instanceof ScrollBar)
		{
			ScrollBar b = (ScrollBar)n;
			if(b.getOrientation() == Orientation.HORIZONTAL)
			{
				if(isAutoResizeMode())
				{
					b.setManaged(false);
					b.setPrefHeight(0);
					b.setPrefWidth(0);
				}
				else
				{
					b.setManaged(true);
					b.setPrefHeight(USE_COMPUTED_SIZE);
					b.setPrefWidth(USE_COMPUTED_SIZE);
				}
			}
		}
	}
}
 
源代码10 项目: JFoenix   文件: JFXTooltip.java
/**
 * {@inheritDoc}
 */
@Override
protected Skin<?> createDefaultSkin() {
    return new TooltipSkin(this) {
        {
            Node node = getNode();
            node.setEffect(null);
        }
    };
}
 
源代码11 项目: phoenicis   文件: ControlBase.java
/**
 * {@inheritDoc}
 */
@Override
public Skin<?> createDefaultSkin() {
    S skin = createSkin();

    // initialise the skin
    skin.initialise();

    // create and initialise the behavior of the skin (if it exists)
    skin.createDefaultBehavior();

    return skin;
}
 
源代码12 项目: constellation   文件: SelectableLabel.java
@Override
protected Skin<?> createDefaultSkin() {
    return new SelectableLabelSkin(this);
}
 
源代码13 项目: constellation   文件: MultiChoiceInputPane.java
@Override
protected Skin<?> createDefaultSkin() {
    // TODO: extend default skin to use prompt text property
    return super.createDefaultSkin();
}
 
源代码14 项目: bisq   文件: AutoTooltipCheckBox.java
@Override
protected Skin<?> createDefaultSkin() {
    return new AutoTooltipCheckBoxSkin(this);
}
 
源代码15 项目: pmd-designer   文件: RippleButton.java
@Override
protected Skin<?> createDefaultSkin() {
    final Skin<?> buttonSkin = super.createDefaultSkin();
    RippleEffect.attach(this, this::getChildren);
    return buttonSkin;
}
 
源代码16 项目: milkman   文件: TableViewWithVisibleRowCount.java
@Override
protected Skin<?> createDefaultSkin() {
    return new TableViewSkinX<T>(this);
}
 
源代码17 项目: chart-fx   文件: HiddenSidesPane.java
@Override
protected Skin<?> createDefaultSkin() {
    return new HiddenSidesPaneSkin(this);
}
 
源代码18 项目: chart-fx   文件: SidesPane.java
@Override
protected Skin<?> createDefaultSkin() {
    return new SidesPaneSkin(this);
}
 
源代码19 项目: oim-fx   文件: OnlyContextMenu.java
@Override
protected Skin<?> createDefaultSkin() {
	return new OnlyContextMenuSkin(this);
}
 
源代码20 项目: oim-fx   文件: ListPopup.java
@Override
protected Skin<?> createDefaultSkin() {
	return new ListPopupSkin<>(this);
}
 
源代码21 项目: WorkbenchFX   文件: NumberRangeControl.java
@Override
protected Skin<?> createDefaultSkin() {
  return createSkin(getSkinType());
}
 
源代码22 项目: WorkbenchFX   文件: NumberRangeControl.java
private Skin<?> createSkin(SkinType skinType) {
  return skinType.getFactory().apply(this);
}
 
源代码23 项目: bisq   文件: AutoTooltipLabel.java
@Override
protected Skin<?> createDefaultSkin() {
    return new AutoTooltipLabelSkin(this);
}
 
源代码24 项目: WorkbenchFX   文件: CustomTile.java
@Override
protected Skin<?> createDefaultSkin() {
  return new CustomTileSkin(this);
}
 
源代码25 项目: WorkbenchFX   文件: CustomPage.java
@Override
protected Skin<?> createDefaultSkin() {
  return new CustomPageSkin(this);
}
 
源代码26 项目: WorkbenchFX   文件: CustomTab.java
@Override
protected Skin<?> createDefaultSkin() {
  return new CustomTabSkin(this);
}
 
源代码27 项目: WorkbenchFX   文件: CustomNavigationDrawer.java
@Override
protected Skin<?> createDefaultSkin() {
  return new CustomNavigationDrawerSkin(this);
}
 
源代码28 项目: WorkbenchFX   文件: Workbench.java
@Override
protected final Skin<?> createDefaultSkin() {
  return new WorkbenchSkin(this);
}
 
源代码29 项目: WorkbenchFX   文件: DialogControl.java
@Override
protected Skin<?> createDefaultSkin() {
  return new DialogSkin(this);
}
 
源代码30 项目: WorkbenchFX   文件: Page.java
@Override
protected Skin<?> createDefaultSkin() {
  return new PageSkin(this);
}
 
 类所在包
 同包方法