Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 添加(新标签(value.substring(lastPartIndex)); } } 设置图形(hbox); } } }; 返回单元; } }; } 我喜欢你最后的建议。我喜欢你最后的建议。 public Callback<TableColumn&_Java_Javafx 2 - Fatal编程技术网

Java 添加(新标签(value.substring(lastPartIndex)); } } 设置图形(hbox); } } }; 返回单元; } }; } 我喜欢你最后的建议。我喜欢你最后的建议。 public Callback<TableColumn&

Java 添加(新标签(value.substring(lastPartIndex)); } } 设置图形(hbox); } } }; 返回单元; } }; } 我喜欢你最后的建议。我喜欢你最后的建议。 public Callback<TableColumn&,java,javafx-2,Java,Javafx 2,添加(新标签(value.substring(lastPartIndex)); } } 设置图形(hbox); } } }; 返回单元; } }; } 我喜欢你最后的建议。我喜欢你最后的建议。 public Callback<TableColumn<Address, String>, TableCell<Address, String>> getCellFactory() { return new Callback<TableColumn

添加(新标签(value.substring(lastPartIndex)); } } 设置图形(hbox); } } }; 返回单元; } }; }
我喜欢你最后的建议。我喜欢你最后的建议。
public Callback<TableColumn<Address, String>, TableCell<Address, String>> getCellFactory() {
        return new Callback<TableColumn<Address, String>, TableCell<Address, String>>() {
            @Override
            public TableCell<Address, String> call( final TableColumn<Address, String> param ) {
                final TableCell<Address, String> cell = new TableCell<Address, String>() {
                    @Override
                    protected void updateItem( final String value, final boolean empty ) {
                        setGraphic( null );
                        if( null != getTableRow() && !empty ) {
                            final HBox hbox = new HBox();
                            hbox.setAlignment( Pos.CENTER_LEFT );
                            hbox.getChildren().clear();
                            if( null == value ) {
                                return;
                            }

                        final int index = value.toLowerCase().indexOf(str);

                        if( -1 == index ) {
                            //no match
                            hbox.getChildren().add( new Label( value ) );
                        } else {
                            //part of string before match
                            hbox.getChildren().add( new Label( value.substring( 0, index ) ) );
                            //matched part
                            final Label label = new Label( value.substring( index, index + str.length() ) );
                            label.setStyle( "-fx-background-color: #FFFFBF;-fx-text-fill: #FF0000;" );
                            hbox.getChildren().add( label );
                            //part of string after match
                            final int lastPartIndex = index + str.length();
                            if( lastPartIndex < value.length() ) {
                                hbox.getChildren().add( new Label( value.substring( lastPartIndex ) ) );
                            }
                        }
                        setGraphic( hbox );
                    }
                }
            };
            return cell;
        }
    };
}