当前位置: 首页>>代码示例>>Java>>正文


Java Label.setPrefSize方法代码示例

本文整理汇总了Java中javafx.scene.control.Label.setPrefSize方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setPrefSize方法的具体用法?Java Label.setPrefSize怎么用?Java Label.setPrefSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Label的用法示例。


在下文中一共展示了Label.setPrefSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.control.Label; //导入方法依赖的package包/类
@Override
	public void start(Stage stage) throws Exception {
//		Parent root = FXMLLoader.load(getClass().getResource("MasonaryPane.fxml"));	
		JFXMasonryPane root = new JFXMasonryPane();
		Scene scene = new Scene(root,300,250);
		Random r = new Random();
		for (int i=0; i<100; i++){
			Label label = new Label();
			label.setPrefSize(r.nextInt(200),r.nextInt(300));
			label.setStyle("-fx-background-color : rgb("+r.nextInt(255)+","+r.nextInt(255)+","+r.nextInt(255)+")");
			root.getChildren().add(label);
			
		}
		
		stage.setTitle("Masonary Pane");
		stage.setScene(scene);
		stage.show();
	}
 
开发者ID:naeemkhan12,项目名称:JavaFx-Material-Design,代码行数:19,代码来源:Main.java

示例2: generate

import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
 * Generates a panel image form char.
 * <p>First, this function converts ch to upper case if ch is lower case.</p>
 * <p>Then, this generates javafx's image from ch.And return it.</p>
 * You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
 * and {@link capslock.CharPanelGenerator#FONT_SIZE}.
 * @param ch パネルの生成に使う1文字.
 * @param color 背景色.
 * @return 生成されたパネル.
 */
static final Image generate(char ch, Color color){
    final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
    label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setFont(Font.font(FONT_SIZE));
    label.setAlignment(Pos.CENTER);
    label.setTextFill(Color.WHITE);
    label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
    final Scene scene = new Scene(new Group(label));
    final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    scene.snapshot(img);
    return img ;
}
 
开发者ID:chrootRISCassembler,项目名称:CapsLock,代码行数:25,代码来源:CharPanelGenerator.java

示例3: createBox

import javafx.scene.control.Label; //导入方法依赖的package包/类
private Node createBox(Cursor cursor) {
    Label label = new Label(cursor.toString());
    label.setAlignment(Pos.CENTER);
    label.setPrefSize(85, 85);
    label.setStyle("-fx-border-color: #aaaaaa; -fx-background-color: #dddddd;");
    label.setCursor(cursor);
    return label;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:CursorSample.java

示例4: text

import javafx.scene.control.Label; //导入方法依赖的package包/类
private static Label text(Resolution res, YCbCr matrix, int col) {
    Label l = new Label(Integer.toString(getLuma(matrix, col)));
    l.setFont(font(res.height / 54));
    l.setTextFill(gray(matrix.fromLumaCode(matrix.YMIN * 4)));
    l.setTextAlignment(TextAlignment.CENTER);
    l.setAlignment(Pos.CENTER);
    l.setPrefSize(getW(res.width, col), getLabelH(res.height));
    return l;
}
 
开发者ID:testing-av,项目名称:testing-video,代码行数:10,代码来源:BlackLevelBase.java

示例5: createPixel

import javafx.scene.control.Label; //导入方法依赖的package包/类
private Label createPixel()
{
	Label pixel = new Label();
	pixel.setPrefSize(PIXEL_SIZE, PIXEL_SIZE);
	pixel.setStyle("-fx-background-color: " + OFF_COLOR);
	
	return pixel;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:9,代码来源:SevenSegmentPanel.java

示例6: LabelControl

import javafx.scene.control.Label; //导入方法依赖的package包/类
public LabelControl(String name) {
	super(name, FlashboardSendableType.LABEL);
	node = new VBox();
	label = new Label(name + ": " + value);
	label.setPrefSize(LABEL_WIDTH, LABEL_HEIGHT);
	node.getChildren().add(label);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:8,代码来源:LabelControl.java

示例7: start

import javafx.scene.control.Label; //导入方法依赖的package包/类
@Override
	public void start(Stage primaryStage) {
		try {
//			Image setting = new Image(getClass().getResourceAsStream("setting.png"j));
			Image logoimg = new Image(getClass().getResourceAsStream("logo.png"));
//			Button settingbtn = new Button("",new ImageView(setting));
//			settingLabel.setStyle("-fx-background-color:#1d1d1d");
			JFXButton logobtn = new JFXButton("",new ImageView(logoimg));
			Label title = new Label("       Energy Saving System");
			title.setFont(new Font(30));
			title.setPrefSize(650, 60);
			title.setStyle("-fx-background-color:#1d1d1d; \n -fx-text-fill:white ;");
			HBox hbox = new HBox();
			hbox.setStyle("-fx-background-color:#1d1d1d");
			hbox.setSpacing(10);
			hbox.setPadding(new Insets(10,10,10,10));
			hbox.getChildren().addAll(logobtn,title);
			BorderPane root = new BorderPane();
			root.setTop(hbox);
			JFXTabPane pane = new JFXTabPane();
			pane.setSide(Side.RIGHT);
			Tab tab1 = new Tab();
			Tab tab2 = new Tab();
			Tab tab3 = new Tab();
			tab3.setText("Settings");
			tab2.setText("Tweaks");
			tab2.setContent(new Tweaks().getPane());
			tab1.setText("Statistics");
			tab1.setContent(new ChartControls().getPane());
			pane.getTabs().addAll(tab1,tab2,tab3);
			root.setCenter(pane);
			Scene scene = new Scene(root,910,550);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
 
开发者ID:naeemkhan12,项目名称:IOTproject,代码行数:41,代码来源:Main.java

示例8: produceLabel

import javafx.scene.control.Label; //导入方法依赖的package包/类
private Label produceLabel(String name){
	Label label=new Label(name);
	label.setPrefSize(PREF_LABEL_WIDTH, PREF_LABEL_HEIGHT);
	return label;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:6,代码来源:VariableSetter.java


注:本文中的javafx.scene.control.Label.setPrefSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。