當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。