本文整理匯總了Java中javafx.scene.control.ScrollPane.setContent方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPane.setContent方法的具體用法?Java ScrollPane.setContent怎麽用?Java ScrollPane.setContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.setContent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: listCreatureContents
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private void listCreatureContents(Player current, ScrollPane scroll) {
HBox content = new HBox();
scroll.setContent(content);
content.setSpacing(20);
for (Card c : current.getPlayerCreature()) {
Rectangle rectangle = new Rectangle(100, 120);
Image img = new Image("images/Spellmonger_" + c.getName() + ".png");
rectangle.setFill(new ImagePattern(img));
rectangle.setLayoutY(10);
rectangle.getStyleClass().add("cartes_ombre");
content.getChildren().add(rectangle);
if (!player1.isDead() && !player2.isDead()) {
Rectangle newRectangle = new Rectangle(250, 300);
eventEnter(rectangle, newRectangle, img);
eventExit(rectangle, newRectangle);
}
}
}
示例2: hands
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private void hands(Player current, Player oppenent, ScrollPane hand) {
HBox content = new HBox();
hand.setContent(content);
content.setSpacing(20);
int index = 0;
for (Card c : current.getHand()) {
Rectangle rectangle = new Rectangle(100, 120);
String imageOfCard = "Spellmonger_" + c.getName();
if (turnPlayer.equals(oppenent)) imageOfCard = "dosCartes_ocre";
if (isIA && current == player2) imageOfCard = "dosCartes_ocre";
Image img = new Image("images/" + imageOfCard + ".png");
rectangle.setFill(new ImagePattern(img));
rectangle.setLayoutY(10);
rectangle.getStyleClass().add("cartes_ombre");
content.getChildren().add(rectangle);
if (turnPlayer.equals(current) && !player1.isDead() && !player2.isDead()) {
Rectangle newRectangle = new Rectangle(250, 300);
eventEnter(rectangle, newRectangle, img);
eventExit(rectangle, newRectangle);
eventClick(rectangle, current, oppenent, index);
}
index++;
}
}
示例3: getScene
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
@Override
protected Scene getScene() {
scene = new Scene(root, 320, 200, Color.WHITE);
VBox vb = new VBox();
vb.setPrefSize(250, 150);
TextArea textArea = new TextArea();
ScrollPane scrollPane = new ScrollPane();
for (int i = 0; i < 100; ++i) {
textArea.setText(textArea.getText() +
"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n");
}
root.getChildren().add(vb);
vb.getChildren().add(textArea);
vb.getChildren().add(scrollPane);
scrollPane.setContent(new Rectangle(1000,1000,Color.RED));
//Utils.addBrowser(scene);
return scene;
}
示例4: addPropertiesTable
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public void addPropertiesTable(String domainName, Node content) {
try {
final Tab newTab = new Tab(domainName);
final ScrollPane sp = new ScrollPane();
sp.setPannable(true);
sp.setContent(content);
sp.setPrefSize(content.getBoundsInLocal().getWidth(), content.getBoundsInLocal().getHeight());
sp.setMaxSize(1000, 1000);
content.boundsInLocalProperty().addListener(new ChangeListener<Bounds>() {
public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
sp.setPrefSize(t1.getWidth(), t1.getHeight());
}
});
content.setId(domainName.toUpperCase() + PropertiesTable.PROPERTIES_TABLE_SUFFIX_ID);
newTab.setContent(sp);
sp.setId(domainName + TAB_CONTENT_ID);
this.getTabs().add(newTab);
} catch (Throwable ex) {
log(ex);
}
}
示例5: MonthBarChart
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public MonthBarChart(ArrayList<MonthInOutSum> monthInOutSums, String currency)
{
if(monthInOutSums == null)
{
this.monthInOutSums = new ArrayList<>();
}
else
{
this.monthInOutSums = monthInOutSums;
}
this.currency = currency;
ScrollPane scrollPane = new ScrollPane();
scrollPane.setVbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setFocusTraversable(false);
scrollPane.setStyle("-fx-background-color: transparent; -fx-background-insets: 0; -fx-border-color: transparent; -fx-border-width: 0; -fx-border-insets: 0;");
scrollPane.setPadding(new Insets(0, 0, 10, 0));
HBox generatedChart = generate();
scrollPane.setContent(generatedChart);
generatedChart.prefHeightProperty().bind(scrollPane.heightProperty().subtract(30));
this.getChildren().add(scrollPane);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
this.getChildren().add(generateLegend());
}
示例6: buildUI
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private void buildUI() {
contentWrapper = new ScrollPane();
contentWrapper.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
getChildren().add(contentWrapper);
setTopAnchor(contentWrapper, 0d);
setLeftAnchor(contentWrapper, 0d);
setBottomAnchor(contentWrapper, 0d);
setRightAnchor(contentWrapper, 0d);
logsContent = new VBox();
logsContent.heightProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
contentWrapper.setVvalue((Double) newValue);
}
});
logsContent.setSpacing(5);
contentWrapper.setContent(logsContent);
}
示例7: init
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vRoot = new VBox();
vRoot.setPadding(new Insets(8, 8, 8, 8));
vRoot.setSpacing(5);
htmlEditor = new HTMLEditor();
htmlEditor.setPrefSize(500, 245);
htmlEditor.setHtmlText(INITIAL_TEXT);
vRoot.getChildren().add(htmlEditor);
final Label htmlLabel = new Label();
htmlLabel.setMaxWidth(500);
htmlLabel.setWrapText(true);
ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("noborder-scroll-pane");
scrollPane.setContent(htmlLabel);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(180);
Button showHTMLButton = new Button("Show the HTML below");
vRoot.setAlignment(Pos.CENTER);
showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
htmlLabel.setText(htmlEditor.getHtmlText());
}
});
vRoot.getChildren().addAll(showHTMLButton, scrollPane);
root.getChildren().addAll(vRoot);
}
示例8: _resize
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
void _resize( final double width, final double height ) {
if( !(container.getScene().getRoot() instanceof ScrollPane) ) {
ScrollPane scroll = new ScrollPane();
scroll.setContent( browser );
container.getScene().setRoot( scroll );
}
browser.setMaxWidth( width );
browser.setMaxHeight( height );
browser.setMinWidth( width );
browser.setMinHeight( height );
}
示例9: licencesp
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private ScrollPane licencesp(double width, double height) {
ScrollPane sp = new ScrollPane();
Text text = new Text();
text.setX(width * 0.1);
text.setY(height * 0.1);
text.setFont(new Font(20));
text.setFill(new Color(1, 1, 1, 1));
StringBuilder licence = new StringBuilder(10000);
String line;
try {
BufferedReader br = new BufferedReader(new FileReader("data/common/licence.txt"));
while ((line = br.readLine()) != null) {
licence.append('\n');
licence.append(line);
}
br.close();
} catch (IOException e) {
log.error("Exception", e);
}
text.setText(licence.toString());
sp.setContent(text);
sp.setFitToHeight(true);
sp.setFitToWidth(true);
sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
sp.setVmax(height);
// sp.setPrefSize(width*0.8, height*0.8);
return sp;
}
示例10: initBoxes
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private void initBoxes(Pane root, Scene scene) {
VBox vBox = Nodes.TEXT_VBOX;
HBox hBox = Nodes.TEXTBAR_HBOX;
ScrollPane scrollPane = Nodes.SCROLL_PANE;
vBox.setTranslateY(10);
vBox.setTranslateX(10);
vBox.prefWidthProperty().bind(scene.widthProperty().subtract(10));
vBox.prefHeightProperty().bind(scene.heightProperty().subtract(20).subtract(preferences.getDouble("textbar-height")));
vBox.setSpacing((preferences.getDouble("messages-spacing-level") - 1)*10-5);
hBox.setPrefWidth(scene.getWidth());
hBox.setPrefHeight(preferences.getDouble("textbar-height"));
hBox.setTranslateY(scene.getHeight() - hBox.getPrefHeight());
hBox.setSpacing(20);
root.widthProperty().addListener(o -> hBox.setPrefWidth(root.getWidth()));
root.heightProperty().addListener(o -> hBox.setTranslateY(scene.getHeight() - Nodes.TEXTBAR_HBOX.getPrefHeight()));
scrollPane.setContent(vBox);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setTranslateX(vBox.getTranslateX());
scrollPane.setTranslateY(vBox.getTranslateY());
scrollPane.maxWidthProperty().bind(vBox.prefWidthProperty());
scrollPane.prefWidthProperty().bind(vBox.prefWidthProperty());
scrollPane.prefHeightProperty().bind(vBox.prefHeightProperty());
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
}
示例11: getTestNod
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
Node getTestNod() {
/* [시작] 분석하고자하는 UI구조 */
BorderPane borderPane = new BorderPane();
ScrollPane scrollPane2 = new ScrollPane();
scrollPane2.setContent(new TextArea());
borderPane.setTop(new HBox(new Button(), new Button(), new HTMLEditor()));
borderPane.setCenter(new BorderPane(scrollPane2));
/* [끝] 분석하고자하는 UI구조 */
return borderPane;
}
示例12: GoogleLoginDialog
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public GoogleLoginDialog(LoginDialog parent) {
super();
this.setTitle(Configuration.getBundle().getString("ui.dialog.auth.google.title"));
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();
ScrollPane scrollPane = new ScrollPane();
scrollPane.setContent(browser);
CookieManager manager = new CookieManager();
CookieHandler.setDefault(manager);
webEngine.setJavaScriptEnabled(false);
this.getDialogPane().setContent(scrollPane);
this.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL);
webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
if(newState == State.RUNNING) {
if(webEngine.getLocation().contains("accounts.google.com/ServiceLoginAuth")) {
scrollPane.setVisible(false);
}
}
if(newState == State.SUCCEEDED) {
if("https://zestedesavoir.com/".equals(webEngine.getLocation())) {
Element elementary = webEngine.getDocument().getDocumentElement();
Element logbox = getLogBox(elementary);
String pseudo = getPseudo(logbox);
String id = getId(logbox);
MainApp.getZdsutils().authToGoogle(manager.getCookieStore().getCookies(), pseudo, id);
getThis().close();
parent.close();
} else {
if(webEngine.getLocation().contains("accounts.google.com/ServiceLoginAuth")) {
scrollPane.setVisible(true);
}
}
}
});
webEngine.load("https://zestedesavoir.com/login/google-oauth2/");
}
示例13: createUIList
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
/**
* Function to create UI element that will hold a list of songs in it based on the collection passed in.
*
* @param listOfSongs The list of songs to displays.
* @param rowCreation The row creation action.
* @param style The styling to style the list.
* @return A scrollable UI element that contains all the songs in the collection.
*/
public static ScrollPane createUIList(Collection<Song> listOfSongs, ILabelAction rowCreation, String style) {
ScrollPane wrapper = new ScrollPane();
wrapper.setStyle(style);
wrapper.setFitToHeight(true);
wrapper.setFitToWidth(true);
VBox allSongs = new VBox();
allSongs.setStyle(style);
allSongs.setSpacing(VERTICAL_SPACING);
int songNumber = 1;
for (Song song : listOfSongs) {
HBox row = rowCreation.createRow(song, songNumber);
String baseStyle = row.getStyle();
row.setOnMouseEntered(event -> row.setStyle("-fx-background-color: lightgray"));
row.setOnMouseExited(event -> row.setStyle(baseStyle));
HBox.setHgrow(row, Priority.ALWAYS);
row.setFillHeight(true);
row.setMaxWidth(Double.MAX_VALUE);
row.setSpacing(HORIZONTAL_ELEMENT_SPACING);
allSongs.getChildren().add(row);
songNumber++;
}
allSongs.setPrefHeight(PREF_HEIGHT);
allSongs.setMaxHeight(MAX_HEIGHT);
allSongs.setFillWidth(true);
wrapper.setContent(allSongs);
return wrapper;
}
示例14: Options
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public Options() {
pane = new BorderPane();
folders = new TreeView<>();
GridPane.setVgrow(folders, Priority.ALWAYS);
GridPane.setHgrow(folders, Priority.NEVER);
folders.getStyleClass().add("tree");
folders.setCursor(Cursor.DEFAULT);
folders.minWidth(400);
pane.setLeft(folders);
values = new VBox(5);
values.setCursor(Cursor.DEFAULT);
values.getStyleClass().add("options");
values.setPadding(new Insets(5, 10, 15, 10));
values.setMinWidth(400);
ScrollPane scroll = new ScrollPane();
scroll.setContent(values);
scroll.setFitToWidth(true);
GridPane.setVgrow(scroll, Priority.ALWAYS);
GridPane.setHgrow(scroll, Priority.SOMETIMES);
GridPane.setFillWidth(scroll, true);
pane.setCenter(scroll);
getContentPane().getChildren().add(pane);
}
示例15: getImagePane
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
/**
* Get a Pane show otherImage, in center
*/
public static Node getImagePane(InputStream in, BodyType type) {
if (type == BodyType.jpeg || type == BodyType.png || type == BodyType.gif
|| type == BodyType.bmp || type == BodyType.icon) {
Image image;
if (type == BodyType.icon) {
try {
image = getIconImage(in);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
} else {
image = new Image(in);
}
ImageView imageView = new ImageView();
imageView.setImage(image);
ScrollPane scrollPane = new ScrollPane();
StackPane stackPane = new StackPane(imageView);
stackPane.minWidthProperty().bind(Bindings.createDoubleBinding(() ->
scrollPane.getViewportBounds().getWidth(), scrollPane.viewportBoundsProperty()));
stackPane.minHeightProperty().bind(Bindings.createDoubleBinding(() ->
scrollPane.getViewportBounds().getHeight(), scrollPane.viewportBoundsProperty()));
scrollPane.setContent(stackPane);
scrollPane.setStyle("-fx-background-color:transparent");
return scrollPane;
} else {
return new Text("Unsupported image format");
}
}