本文整理汇总了Java中javafx.scene.control.TableColumn.setMinWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumn.setMinWidth方法的具体用法?Java TableColumn.setMinWidth怎么用?Java TableColumn.setMinWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TableColumn
的用法示例。
在下文中一共展示了TableColumn.setMinWidth方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TableSample
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public TableSample() {
final ObservableList<Person> data = FXCollections.observableArrayList(
new Person("Jacob", "Smith", "[email protected]" ),
new Person("Isabella", "Johnson", "[email protected]" ),
new Person("Ethan", "Williams", "[email protected]" ),
new Person("Emma", "Jones", "[email protected]" ),
new Person("Michael", "Brown", "[email protected]" )
);
TableColumn firstNameCol = new TableColumn();
firstNameCol.setText("First");
firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
TableColumn lastNameCol = new TableColumn();
lastNameCol.setText("Last");
lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
TableColumn emailCol = new TableColumn();
emailCol.setText("Email");
emailCol.setMinWidth(200);
emailCol.setCellValueFactory(new PropertyValueFactory("email"));
TableView tableView = new TableView();
tableView.setItems(data);
tableView.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
getChildren().add(tableView);
}
示例2: 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 ;
});
}
示例3: 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;
}
示例4: TableScrollSample
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public TableScrollSample() {
final ObservableList<Person> data = FXCollections.observableArrayList(
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"));
TableColumn firstNameCol = new TableColumn();
firstNameCol.setText("First");
firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
TableColumn lastNameCol = new TableColumn();
lastNameCol.setText("Last");
lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
TableColumn emailCol = new TableColumn();
emailCol.setText("Email");
emailCol.setMinWidth(200);
emailCol.setCellValueFactory(new PropertyValueFactory("email"));
TableView tableView = new TableView();
tableView.setItems(data);
ObservableList items = tableView.getItems();
for (int i = 0; i < 10; i++)
items.add(new Person("Name" + i, "Last" + i, "Email " + i));
tableView.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
getChildren().add(tableView);
}
示例5: createColumns
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
private void createColumns() {
TableColumn<RequestEntry, String> eventTypeCol = new TableColumn("Type");
eventTypeCol.setMinWidth(100);
eventTypeCol.setCellValueFactory(new PropertyValueFactory<>("eventType"));
eventTypeCol.setSortable(false);
TableColumn<RequestEntry, String> eventNameCol = new TableColumn("Name");
eventNameCol.setMinWidth(100);
eventNameCol.setCellValueFactory(new PropertyValueFactory<>("eventName"));
eventNameCol.setSortable(false);
TableColumn<RequestEntry, String> eventDateTimeCol = new TableColumn("Time");
eventDateTimeCol.setMinWidth(200);
eventDateTimeCol.setCellValueFactory(new PropertyValueFactory<>("eventDateTime"));
eventDateTimeCol.setSortable(false);
TableColumn<RequestEntry, String> eventLocationCol = new TableColumn("Location");
eventLocationCol.setMinWidth(100);
eventLocationCol.setCellValueFactory(new PropertyValueFactory<>("eventLocation"));
eventLocationCol.setSortable(false);
TableColumn<RequestEntry, String> eventConductorCol = new TableColumn("Conductor");
eventConductorCol.setMinWidth(100);
eventConductorCol.setCellValueFactory(new PropertyValueFactory<>("eventConductor"));
eventConductorCol.setSortable(false);
TableColumn<RequestEntry, RequestTypeGUI> requestTypeCol = new TableColumn("Request");
requestTypeCol.setCellFactory((param) -> new RequestRadioButtonCell<>(EnumSet.allOf(RequestTypeGUI.class)));
requestTypeCol.setCellValueFactory(new PropertyValueFactory<>("requestType"));
requestTypeCol.setSortable(false);
TableColumn<RequestEntry, TextField> eventDescriptionCol = new TableColumn("Description");
eventDescriptionCol.setMinWidth(300);
eventDescriptionCol.setCellValueFactory(new PropertyValueFactory<RequestEntry, TextField>("requestDescription"));
eventDescriptionCol.setResizable(false);
eventDescriptionCol.setSortable(false);
table.getColumns().addAll(eventTypeCol, eventNameCol, eventDateTimeCol, eventLocationCol, eventConductorCol, requestTypeCol, eventDescriptionCol);
}
示例6: TaskSample
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public TaskSample() {
TableView<DailySales> tableView = new TableView<DailySales>();
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
StackPane stack = new StackPane();
stack.getChildren().addAll(tableView, veil, p);
// Use binding to be notified whenever the data source chagnes
Task<ObservableList<DailySales>> task = new GetDailySalesTask();
p.progressProperty().bind(task.progressProperty());
veil.visibleProperty().bind(task.runningProperty());
p.visibleProperty().bind(task.runningProperty());
tableView.itemsProperty().bind(task.valueProperty());
getChildren().add(stack);
new Thread(task).start();
}
示例7: TableSample1
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public TableSample1() {
final ObservableList<Person> data = FXCollections.observableArrayList(
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]"));
TableColumn firstNameCol = new TableColumn();
firstNameCol.setText("First");
firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
TableColumn lastNameCol = new TableColumn();
lastNameCol.setText("Last");
lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
TableColumn emailCol = new TableColumn();
emailCol.setText("Email");
emailCol.setMinWidth(200);
emailCol.setCellValueFactory(new PropertyValueFactory("email"));
TableView tableView = new TableView();
tableView.setItems(data);
tableView.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
getChildren().add(tableView);
}
示例8: init
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 800, 0, 0.3)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setMinWidth(150);
idCol.setCellValueFactory(new PropertyValueFactory<>("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setMinWidth(150);
qtyCol.setCellValueFactory(new PropertyValueFactory<>("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory<>("date"));
dateCol.setMinWidth(150);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
root.getChildren().add(stack);
service.start();
}
示例9: addColumn
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
private void addColumn(String name, int width) {
TableColumn<E, String> column = new TableColumn<>(name);
column.setCellValueFactory(
new PropertyValueFactory<>(name)
);
column.setMinWidth(width);
getColumns().add(column);
}
示例10: createTableColumn
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
private <T> TableColumn<ProcessHandle, T> createTableColumn(String header, int width,
Function<ProcessHandle, T> function) {
TableColumn<ProcessHandle, T> column = new TableColumn<>(header);
column.setMinWidth(width);
column.setCellValueFactory(data -> new SimpleObjectProperty<>(function.apply(data.getValue())));
return column;
}
示例11: 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);
}
示例12: ServiceSample
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public ServiceSample() {
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
getChildren().add(stack);
service.start();
}
示例13: display
import javafx.scene.control.TableColumn; //导入方法依赖的package包/类
public static void display() {
window = new Stage();
window.setTitle("Home");
Label titleLabel = new Label("Master Hash");
titleLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 30));
titleLabel.setAlignment(Pos.CENTER);
Button newLoginButton = new Button();
newLoginButton.setText("New Login");
newLoginButton.setOnAction(e -> NewLogin.display());
TableColumn<Table, String> nameCol = new TableColumn<>("Name");
nameCol.setMinWidth(200);
nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
TableColumn<Table, String> usernameCol = new TableColumn<>("Username");
usernameCol.setMinWidth(200);
usernameCol.setCellValueFactory(new PropertyValueFactory<>("username"));
TableColumn<Table, String> passwordCol = new TableColumn<>("Password");
passwordCol.setMinWidth(200);
passwordCol.setCellValueFactory(new PropertyValueFactory<>("password"));
BorderPane borderPane = new BorderPane();
borderPane.setLeft(titleLabel);
borderPane.setRight(newLoginButton);
borderPane.setPadding(new Insets(20, 20, 10, 20));
table = new TableView<>();
table.setItems(getTable());
ObservableList<TableColumn<Table, ?>> columns = table.getColumns();
columns.add(nameCol);
columns.add(usernameCol);
columns.add(passwordCol);
VBox vBox = new VBox(10);
vBox.getChildren().addAll(borderPane, table);
Scene scene = new Scene(vBox, 600, 600);
window.setScene(scene);
window.show();
}