###前提・実現したいこと
FXMLでOracle公式のチュートリアルをもとに学習をしています.
TableView を,
AnchorPane.bottomAnchor="60.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0"
と設定しましたが,サイズ変更をすると,以下のようになります.
確かに,アンカーの設定はできています.
しかし,Email Address が伸びていません.
Email Address を rightAnchor="14.0"の位置にすることはできないのでしょうか?
###該当のソースコード
Java
1public class FXMLTableView extends Application { 2 3 @Override 4 public void start(Stage primaryStage) throws Exception { 5 primaryStage.setTitle("FXML TableView Example"); 6 Pane myPane = (Pane)FXMLLoader.load(getClass().getResource 7 ("fxml_tableview.fxml")); 8 Scene myScene = new Scene(myPane); 9 primaryStage.setScene(myScene); 10 primaryStage.show(); 11 } 12 13 public static void main(String[] args) { 14 launch(args); 15 } 16}
FXML
1<AnchorPane id="AnchorPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxmltableview.FXMLTableViewController"> 2 <children> 3 <TableView fx:id="tableView" AnchorPane.bottomAnchor="60.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0"> 4 <columns> 5 <TableColumn minWidth="100" prefWidth="100" text="First Name"> 6 <cellValueFactory> 7 <PropertyValueFactory property="firstName" /> 8 </cellValueFactory> 9 </TableColumn> 10 <TableColumn minWidth="100" prefWidth="100" text="Last Name"> 11 <cellValueFactory> 12 <PropertyValueFactory property="lastName" /> 13 </cellValueFactory> 14 </TableColumn> 15 <TableColumn maxWidth="1.7976931348623157E308" minWidth="200.0" prefWidth="-1.0" text="Email Address"> 16 <cellValueFactory> 17 <PropertyValueFactory property="email" /> 18 </cellValueFactory> 19 </TableColumn> 20 </columns> 21 <items> 22 <FXCollections fx:factory="observableArrayList"> 23 <Person email="jacob.smith@example.com" firstName="Jacob" lastName="Smith" /> 24 <Person email="isabella.johnson@example.com" firstName="Isabella" lastName="Johnson" /> 25 <Person email="ethan.williams@example.com" firstName="Ethan" lastName="Williams" /> 26 <Person email="emma.jones@example.com" firstName="Emma" lastName="Jones" /> 27 <Person email="michael.brown@example.com" firstName="Michael" lastName="Brown" /> 28 </FXCollections> 29 </items> 30 </TableView> 31 </children> 32</AnchorPane>
Java
1public class Person { 2 private final SimpleStringProperty firstName = new SimpleStringProperty(""); 3 private final SimpleStringProperty lastName = new SimpleStringProperty(""); 4 private final SimpleStringProperty email = new SimpleStringProperty(""); 5 6public Person() { 7 this("", "", ""); 8 } 9 10 public Person(String firstName, String lastName, String email) { 11 setFirstName(firstName); 12 setLastName(lastName); 13 setEmail(email); 14 } 15 16 public String getFirstName() { 17 return firstName.get(); 18 } 19 20 public void setFirstName(String fName) { 21 firstName.set(fName); 22 } 23 24 public String getLastName() { 25 return lastName.get(); 26 } 27 28 public void setLastName(String fName) { 29 lastName.set(fName); 30 } 31 32 public String getEmail() { 33 return email.get(); 34 } 35 36 public void setEmail(String fName) { 37 email.set(fName); 38 } 39}
Java
1public class FXMLTableViewController implements Initializable { 2 3 @Override 4 public void initialize(URL url, ResourceBundle rb) { 5 // TODO 6 } 7}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/09/01 12:00
2016/09/01 12:05
退会済みユーザー
2016/09/01 12:21