Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Insert Text in Column Cells

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Insert Text in Column Cells

    I wrote FXML for the below window in FXML

    Directory.jpg

    by using the following event

    public void DirectoryButtonClick(ActionEvent event) throws Exception
        {
            Stage stage2 = new Stage();
            Parent root2 = FXMLLoader.load(getClass().getResource("Search.fxml"));
            Scene scene2 = new Scene(root2);
     
            stage2.setScene(scene2);
            stage2.show();
            nameColumn.setText("abc");
            phoneColumn.setText("def");
            emailColumn.setText("ghi");
        }


  2. #2
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Insert Text in Column Cells

    The FXML
    <?xml version="1.0" encoding="UTF-8"?>
     
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.collections.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.paint.*?>
     
    <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="373.0" prefWidth="387.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
      <children>
        <ScrollPane layoutX="14.0" layoutY="62.0" prefHeight="298.0" prefWidth="371.0">
          <content>
            <AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="326.0" prefWidth="571.0">
              <children>
                <TableView layoutX="0.0" layoutY="0.0" prefHeight="283.0" prefWidth="357.0">
                  <columns>
                    <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="120.0" text="Name" fx:id="nameColumn" />
                    <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" text="Phone" fx:id="phoneColumn" />
                    <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="133.0" text="Email" fx:id="emailColumn" />
                  </columns>
                </TableView>
              </children>
            </AnchorPane>
          </content>
        </ScrollPane>
        <Button layoutX="247.0" layoutY="35.0" mnemonicParsing="false" prefHeight="21.0" prefWidth="94.0" text="Back" />
        <Button layoutX="247.0" layoutY="10.0" minHeight="11.0" mnemonicParsing="false" prefHeight="21.0" prefWidth="94.0" text="Search" />
        <TextField layoutX="15.0" layoutY="10.0" prefWidth="200.0" />
        <ChoiceBox layoutX="121.0" layoutY="35.0" prefWidth="95">
          <items>
            <FXCollections fx:factory="observableArrayList">
              <String fx:value="Name" />
              <String fx:value="Phone" />
              <String fx:value="Email" />
            </FXCollections>
          </items>
        </ChoiceBox>
      </children>
    </AnchorPane>

    But it doesn't work!
    could anyone help?

Similar Threads

  1. DefaultCellEditor does not support empty cells
    By ALCOLEA1972 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 9th, 2013, 10:12 PM
  2. Sum elements column by column
    By NallelyXIII in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 9th, 2013, 01:22 AM
  3. Merge Cells in JTable
    By Stx in forum AWT / Java Swing
    Replies: 0
    Last Post: July 16th, 2012, 04:21 AM
  4. Randomizing cells in a grid
    By Flowbs in forum AWT / Java Swing
    Replies: 3
    Last Post: December 18th, 2010, 08:53 PM
  5. Counting cells
    By Shyamz1 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 28th, 2010, 05:04 PM

Tags for this Thread