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


Java TableColumn.setMaxWidth方法代码示例

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


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

示例1: VarsPanel

import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public VarsPanel(AppSession session) {
    this.session = session;        
    table = new TableView();
    table.setPrefWidth(300);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    setCenter(table);
    TableColumn nameCol = new TableColumn("Variable");
    nameCol.setMinWidth(120);
    nameCol.setMaxWidth(250);
    nameCol.setCellValueFactory(new PropertyValueFactory("name"));
    nameCol.setCellFactory(c -> new StringTooltipCell());
    TableColumn typeCol = new TableColumn("Type");
    typeCol.setMinWidth(45);
    typeCol.setMaxWidth(60);
    typeCol.setCellValueFactory(new PropertyValueFactory("type"));
    TableColumn<Var, ScriptValue> valueCol = new TableColumn("Value");
    valueCol.setCellValueFactory(c -> new ReadOnlyObjectWrapper(c.getValue().getValue()));        
    valueCol.setCellFactory(c -> new VarValueCell());
    table.getColumns().addAll(nameCol, typeCol, valueCol);
    table.setItems(session.getVars());
    table.setRowFactory(tv -> {
        TableRow<Var> row = new TableRow<>();
        row.setOnMouseClicked(e -> {
            if (e.getClickCount() == 2 && !row.isEmpty()) {
                Var var = row.getItem();
                session.logVar(var);
            }
        });
        return row ;
    });        
}
 
开发者ID:intuit,项目名称:karate,代码行数:32,代码来源:VarsPanel.java

示例2: createOrganizationTable

import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
private TableView<OrganizationView> createOrganizationTable(ObservableList<OrganizationView> orgas) {
	TableView<OrganizationView> result = new TableView<>(orgas);

	TableColumn<OrganizationView, String> name = new TableColumn<>("Name");
	TableColumn<OrganizationView, String> owned = new TableColumn<>("Owned");
	TableColumn<OrganizationView, Integer> serverCount = new TableColumn<>("Servers");

	name.setCellValueFactory(new PropertyValueFactory<>("name"));
	serverCount.setCellValueFactory(new PropertyValueFactory<>("serverCount"));
	owned.setCellValueFactory(new PropertyValueFactory<>("isOwned"));
	
	serverCount.setMinWidth(70);
	serverCount.setMaxWidth(70);
	owned.setMaxWidth(70);
	owned.setMinWidth(70);
	
	result.getColumns().add(name);
	result.getColumns().add(serverCount);
	result.getColumns().add(owned);

	return result;
}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:23,代码来源:OrganizationManagerStage.java

示例3: PlayerListTable

import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public PlayerListTable(ObservableList<PlayerView> players) {
	super();

	TableColumn<PlayerView, Integer> id = new TableColumn<>("ID");
	TableColumn<PlayerView, String> name = new TableColumn<>("Name");
	TableColumn<PlayerView, HBox> steamId = new TableColumn<>("Steam ID");
	TableColumn<PlayerView, String> vacBans = new TableColumn<>("VAC");
	TableColumn<PlayerView, HBox> actions = new TableColumn<>("Actions");

	id.setCellValueFactory(new PropertyValueFactory<>("id"));
	name.setCellValueFactory(new PropertyValueFactory<>("name"));
	steamId.setCellValueFactory(new PropertyValueFactory<>("steamPan"));
	vacBans.setCellValueFactory(new PropertyValueFactory<>("vacBans"));
	actions.setCellValueFactory(new PropertyValueFactory<>("actionPan"));
	
	
	id.setMaxWidth(25);
	id.setMinWidth(25);
	steamId.setMinWidth(220);
	steamId.setMaxWidth(220);
	vacBans.setMaxWidth(50);
	vacBans.setMinWidth(50);
	actions.setMinWidth(80);
	actions.setMaxWidth(80);
	
	id.setResizable(false);
	steamId.setResizable(false);
	actions.setResizable(false);
	vacBans.setResizable(false);
	
	this.getColumns().add(id);
	this.getColumns().add(name);
	this.getColumns().add(steamId);
	this.getColumns().add(vacBans);
	this.getColumns().add(actions);

	this.getColumns().forEach(c -> {
		c.setStyle(DEFAULT_STYLE);
	});
	
	this.players = players;
	
	this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
	this.setPrefHeight(1000000);

	this.setItems(this.players);

}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:49,代码来源:PlayerListTable.java


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