Add combo box into table pagination

I want to add combo box into JavaFX table with pagination. Something like that:
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Pagination;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Callback;
public class MainApp extends Application
   final ObservableList<Person> data = FXCollections.observableArrayList(
   new Person("1", "Joe", "Pesci"),
   new Person("2", "Audrey", "Hepburn"),
   new Person("3", "Gregory", "Peck")
   private Pagination pagination;
   public static void main(String[] args) throws Exception
  launch(args);
   public int itemsPerPage()
   return 1;
   public int rowsPerPage()
   return 5;
   public VBox createPage(int pageIndex)
   int lastIndex = 0;
   int displace = data.size() % rowsPerPage();
   if (displace > 0)
  lastIndex = data.size() / rowsPerPage();
   else
  lastIndex = data.size() / rowsPerPage() - 1;
   VBox box = new VBox(5);
   int page = pageIndex * itemsPerPage();
   for (int i = page; i < page + itemsPerPage(); i++)
   TableView<Person> table = new TableView<>();
   TableColumn numCol = new TableColumn("ID");
  numCol.setCellValueFactory(
   new PropertyValueFactory<Person, String>("num"));
  numCol.setMinWidth(20);
   TableColumn firstNameCol = new TableColumn("First Name");
  firstNameCol.setCellValueFactory(
   new PropertyValueFactory<Person, String>("firstName"));
  firstNameCol.setMinWidth(160);
   TableColumn lastNameCol = new TableColumn("Last Name");
  lastNameCol.setCellValueFactory(
   new PropertyValueFactory<Person, String>("lastName"));
  lastNameCol.setMinWidth(160);
  table.getColumns().addAll(numCol, firstNameCol, lastNameCol);
   if (lastIndex == pageIndex)
  table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage(), pageIndex * rowsPerPage() + displace)));
   else
  table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage(), pageIndex * rowsPerPage() + rowsPerPage())));
  box.getChildren().add(table);
   return box;
   @Override
   public void start(final Stage stage) throws Exception
  pagination = new Pagination((data.size() / rowsPerPage() + 1), 0);
   // pagination = new Pagination(20 , 0);
   //pagination.setStyle("-fx-border-color:red;");
  pagination.setPageFactory(new Callback<Integer, Node>()
   @Override
   public Node call(Integer pageIndex)
   if (pageIndex > data.size() / rowsPerPage() + 1)
   return null;
   else
   return createPage(pageIndex);
   public static class Person
   private final SimpleStringProperty num;
   private final SimpleStringProperty firstName;
   private final SimpleStringProperty lastName;
   private Person(String id, String fName, String lName)
   this.firstName = new SimpleStringProperty(fName);
   this.lastName = new SimpleStringProperty(lName);
   this.num = new SimpleStringProperty(id);
   public String getFirstName()
   return firstName.get();
   public void setFirstName(String fName)
  firstName.set(fName);
   public String getLastName()
   return lastName.get();
   public void setLastName(String fName)
  lastName.set(fName);
   public String getNum()
   return num.get();
   public void setNum(String id)
  num.set(id);
I suppose that this can be done with StackPane but I need some other more universal way to do this because I want to expand the table size. I need to place there the combo box always in a fix position.
Ref http://stackoverflow.com/questions/21147261/add-combo-box-into-table-pagination

Hi. You can do it using an AnchorPane:
AnchorPane.setBottomAnchor(comboBox, 40.0);
AnchorPane.setLeftAnchor(comboBox, 12.0);
The complete  example :
import java.util.List;
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ListChangeListener.Change;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.Pagination;
import javafx.scene.Node;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Callback;
public class TablePager extends Application {
    final ObservableList<Person> data = FXCollections.observableArrayList(
            new Person("1", "Joe", "Pesci"),
            new Person("2", "Audrey", "Hepburn"),
            new Person("3", "Gregory", "Peck"),
            new Person("4", "Cary", "Grant"),
            new Person("5", "De", "Niro"),
            new Person("6", "Katharine", "Hepburn"),
            new Person("7", "Jack", "Nicholson"),
            new Person("8", "Morgan", "Freeman"),
            new Person("9", "Elizabeth", "Taylor"),
            new Person("10", "Marcello", "Mastroianni"),
            new Person("11", "Innokenty", "Smoktunovsky"),
            new Person("12", "Sophia", "Loren"),
            new Person("13", "Alexander", "Kalyagin"),
            new Person("14", "Peter", "OToole"),
            new Person("15", "Gene", "Wilder"),
            new Person("16", "Evgeny", "Evstegneev"),
            new Person("17", "Michael", "Caine"),
            new Person("18", "Jean-Paul", "Belmondo"),
            new Person("19", " Julia", "Roberts"),
            new Person("20", "James", "Stewart"),
            new Person("21", "Sandra", "Bullock"),
            new Person("22", "Paul", "Newman"),
            new Person("23", "Oleg", "Tabakov"),
            new Person("24", "Mary", "Steenburgen"),
            new Person("25", "Jackie", "Chan"),
            new Person("26", "Rodney", "Dangerfield"),
            new Person("27", "Betty", "White"),
            new Person("28", "Eddie", "Murphy"),
            new Person("29", "Amitabh", "Bachchan"),
            new Person("30", "Nicole", "Kidman"),
            new Person("31", "Adriano", "Celentano"),
            new Person("32", "Rhonda", " Fleming's"),
            new Person("32", "Humphrey", "Bogart"));
    private Pagination pagination;
    public static void main(String[] args) throws Exception {
        launch(args);
    public int itemsPerPage() {
        return 1;
    public int rowsPerPage() {
        return 5;
    public VBox createPage(int pageIndex) {
        int lastIndex = 0;
        int displace = data.size() % rowsPerPage();
        if (displace > 0) {
            lastIndex = data.size() / rowsPerPage();
        } else {
            lastIndex = data.size() / rowsPerPage() - 1;
        VBox box = new VBox();
        int page = pageIndex * itemsPerPage();
        for (int i = page; i < page + itemsPerPage(); i++) {
            TableView<Person> table = new TableView<Person>();
            TableColumn numCol = new TableColumn("ID");
            numCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("num"));
            numCol.setMinWidth(20);
            TableColumn firstNameCol = new TableColumn("First Name");
            firstNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("firstName"));
            firstNameCol.setMinWidth(160);
            TableColumn lastNameCol = new TableColumn("Last Name");
            lastNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("lastName"));
            lastNameCol.setMinWidth(160);
            table.getColumns().addAll(numCol, firstNameCol, lastNameCol);
            if (lastIndex == pageIndex) {
                table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage(), pageIndex * rowsPerPage() + displace)));
            } else {
                table.setItems(FXCollections.observableArrayList(data.subList(pageIndex * rowsPerPage(), pageIndex * rowsPerPage() + rowsPerPage())));
            box.getChildren().addAll(table);
        return box;
    @Override
    public void start(final Stage stage) throws Exception {
        ObservableList<String> options =
                FXCollections.observableArrayList(
                "Opt1",
                "Opt2",
                "Opt3");
        final ComboBox comboBox = new ComboBox(options);
        pagination = new Pagination((data.size() / rowsPerPage() + 1), 0);
        //   pagination = new Pagination(20 , 0);
        pagination.setStyle("-fx-border-color:red;");
        pagination.setPageFactory(new Callback<Integer, Node>() {
            @Override
            public Node call(Integer pageIndex) {
                if (pageIndex > data.size() / rowsPerPage() + 1) {
                    return null;
                } else {
                    return createPage(pageIndex);
        AnchorPane anchor = new AnchorPane();
        AnchorPane.setTopAnchor(pagination, 10.0);
        AnchorPane.setRightAnchor(pagination, 10.0);
        AnchorPane.setBottomAnchor(pagination, 10.0);
        AnchorPane.setLeftAnchor(pagination, 10.0);
        Scene scene = new Scene(anchor, 400, 250);
        AnchorPane.setBottomAnchor(comboBox, 40.0);
        AnchorPane.setLeftAnchor(comboBox, 12.0);
        anchor.getChildren().addAll(pagination, comboBox);
        stage.setScene(scene);
        stage.setTitle("Table pager");
        stage.show();
    public static class Person {
        private final SimpleStringProperty num;
        private final SimpleStringProperty firstName;
        private final SimpleStringProperty lastName;
        private Person(String id, String fName, String lName) {
            this.firstName = new SimpleStringProperty(fName);
            this.lastName = new SimpleStringProperty(lName);
            this.num = new SimpleStringProperty(id);
        public String getFirstName() {
            return firstName.get();
        public void setFirstName(String fName) {
            firstName.set(fName);
        public String getLastName() {
            return lastName.get();
        public void setLastName(String fName) {
            lastName.set(fName);
        public String getNum() {
            return num.get();
        public void setNum(String id) {
            num.set(id);

Similar Messages

  • How do you add a combo box into a Jfilechooser?

    how do you add a combo box into a Jfilechooser?
    thanks

    See the API For JFileChooser
    public void setAccessory(JComponent newAccessory)Extend a JPanel or Such like, put your Combo Box on it, fiddle around with event handling code for the ComboBox..
    Set an Instance of that as The Accessory for the JFileChooser.
    Look In Your Docs:-
    <JAVA_HOME>/Demo/jfc/SwingSet2/src , unpack SwingSet2.jar if neccessary
    In there is a demo of using A JFileChooser with an accessory Panel, and Source code that is adaptable...

  • How to add check box in table control?

    Dear frnds,
    In our requirement i am used tablec ontrol for dialog programming, but i am confused about addition of check box as fields in table control.
    Any help are welcome from your side.

    Hi,
    Chk this demo program: DEMO_DYNPRO_TABCONT_LOOP_AT
    & RSDEMO02.
    Another way:
    Go to the edit mode of the screen select the table control column you want to make it as check box and follow the menu EDIT->CONVERT->check box.
    (make sure that column definition in itab/ddtab is of size 1 char)
    Also chek out this link:
    Add Check box in Table control
    Hope these help you.
    Regards,
    Anjali

  • Combo box in table

    Hi,
    I have a combo box in table.
    In my table i have 5 Rows with 3 column and in 3rd column i have my combo box.
    Now my problem is i want to set my own value in combo box but when i write:
    comboBox.setvalue(3)
    then it update all the combo box in each row with the same value.
    I want to update my combo with different value in each row.
    Thanks,

    Where is the data for table coming from?
    Possible duplicate of [url http://forums.oracle.com/forums/thread.jspa?threadID=2205385]this post
    Sireesha

  • Asset related question - How to add a record into table ANLC?

    Hello experts,
    Could anyone tell me how to add a record into table ANLC?
    Thanks very much!
    Christina.

    how you want add?
    you want add direct in table???.
    Normally if yo post any transaction this table will update.
    ex;acquisition;
    chandra

  • Add a Drop down menu / Combo Box into a specified cell of a multi column lsit box

    Hello,
    i have a question how to manipulate a cell of a multi column list box in that way that i can add a drop down menu or a combo box in this cell?
    Is this possible in LabView?
    Thank you!

    Wow, I took a look at the alternate code posted here at that really takes you through gyration (also a similiar comment I see on Lava) to perform what I've done with a few functions....
    See the Pics and attached VI for how its done. KISS, I added an event stucture and changed my first enum case to " " (i.e. a blank) to make it look like the other posted code....
    Attachments:
    DropDownMenuInABox.vi ‏18 KB
    DropDownMenuInABox_FP.PNG ‏18 KB
    DropDownMenuInABox_BD.PNG ‏36 KB

  • OIM 11gR2 Add combo box UDF on Create User Form

    Hi.
    We have created a new UDF on user form. It is a lookup field and has the following lookup associated: "Lookup.Users.Continente"
    "Lookup.Users.Continente" has two values, both of them checked as Enabled.
    From the form designer all the values are displayed when selecting one default value so it is reading correctly from the lookup.
    We published the sandbox after this.
    Then we created a new sandbox and tried to add that field to the Create User Page. We went to "Create User Page", customize it and add content from "Data Component - Catalog" -> "userVO" -> Select the UDF, clicked on "Add" and selected "ADF Select One Choice".
    A new combobox is added but no values are shown. We have plublished the sandbox, restarted OIM, purged cache, etc... but it still shows an empty combo box. We have also tried adding it as "ADF Input List of values" but it does not add the field to the create user page.
    Any ideas of what are we doing wrong?
    The idea is very simple, just create a field with the same behaviour as, for example,  "User Type" field. A combobox that displays the enabled values from a lookup...
    We have also tried creating the UDF cheking the searchable option, searchable picklist and all the possible combinations.
    Thanks in advance!!

    oim version is oim 11gR2 with BP4

  • Combo Box in a JTable not appearing

    Hi Swing,
    I have a snippet of code that I took from the Swing guide for JTables that adds a JComboBox into the 3rd column in the table. However, the ComboBox doesnt appear?
    Can anyone see what is going wrong? Code is below:- I can post more if needed:-
         public void addTable() {
              tableModel = new MyTableModel(rows,columns);
              relationTable = new JTable(tableModel);
           //Set up the editor for the sport cells.
            TableColumn sportColumn = table.getColumnModel().getColumn(2);                                              
            JComboBox allStaff = new JComboBox();
            allStaff.addItem("Snowboarding");
            allStaff.addItem("Rowing");
            allStaff.addItem("Knitting");
            allStaff.addItem("Speed reading");
            allStaff.addItem("Pool");
            allStaff.addItem("None of the above");
            sportColumn.setCellEditor(new DefaultCellEditor(allStaff));
              // set so only one row can be selected at once
              relationTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
              relationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              // add to pane:-
              JScrollPane scrollPane3 = new JScrollPane(relationTable);
              scrollPane3.setBounds(X,Y,Z,W);
              getContentPane().add(scrollPane3 );
         }Cheers

    hi
    look I will give u a simple code I created based on your combo box
    enjoy (:
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class TablCo extends JPanel {
    static JFrame frame;
    JTable table;
    DefaultTableModel tm;
    public TablCo() {
    super(new BorderLayout());
    JPanel leftPanel = createVerticalBoxPanel();
    //Create a table model.
    tm = new DefaultTableModel();
    tm.addColumn("Column 0");
    tm.addColumn("Column 1");
    tm.addColumn("Column 2");
    tm.addColumn("Column 3");
    tm.addRow(new String[]{"01", "02", "03", "Snowboarding"});
    tm.addRow(new String[]{"04 ", "05", "06", "Snowboarding"});
    tm.addRow(new String[]{"07", "08", "09", "Snowboarding"});
    tm.addRow(new String[]{"10", "11", "12", "Snowboarding"});
    //Use the table model to create a table.
    table = new JTable(tm);
              //insert a combo box in table
              TableColumn sportColumn = table.getColumnModel().getColumn(3);
              JComboBox allStaff = new JComboBox();
                   allStaff.addItem("Snowboarding");
                   allStaff.addItem("Rowing");
                   allStaff.addItem("Knitting");
                   allStaff.addItem("Speed reading");
                   allStaff.addItem("Pool");
                   allStaff.addItem("None of the above");
              //DefaultCellEditor dce = new DefaultCellEditor(allStaff);
              sportColumn.setCellEditor(new DefaultCellEditor(allStaff));
              JScrollPane tableView = new JScrollPane(table);
    tableView.setPreferredSize(new Dimension(300, 100));
              leftPanel.add(createPanelForComponent(tableView, "JTable"));
              JFrame.setDefaultLookAndFeelDecorated(true);
              //Create and set up the window.
              frame = new JFrame("BasicDnD");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //Create and set up the content pane.
              frame.setContentPane(leftPanel);
              //Display the window.
              frame.pack();
              frame.setVisible(true);
              protected JPanel createVerticalBoxPanel() {
              JPanel p = new JPanel();
              p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
              p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
              return p;
              public JPanel createPanelForComponent(JComponent comp,
              String title) {
              JPanel panel = new JPanel(new BorderLayout());
              panel.add(comp, BorderLayout.CENTER);
              if (title != null) {
              panel.setBorder(BorderFactory.createTitledBorder(title));
              return panel;
    public static void main(String[] args) {
         new TablCo();
    }

  • Combo boxes on web forms

    I'm currently converting a forms v4.5 application onto 9iAS with web forms. I'm have major problems with my user community as combo boxes are no longer supported under web forms and they use them extensively.
    To try and overcome the problem I have converted the combo box into a 'TEXT_ITEM' and set up a LOV called from a button. This works for inserting new records, but when they query back existing records no data is displayed in the text_item boxes.
    Does anybody know how I get the LOV to fire JUST to display back existing single row data.
    Many Thanks
    Jez Thorpe.

    combobox is available on webform, but it did not deliver what a standard combobox supposes to offer.
    e.g., 1) it can display one column and return one valure;
    for emp table, there are ename and empno:
    ename empno
    David M Brown 100
    David M Brown 101
    David L Miller 103
    Then I have to use LOV to display these records of different persons and same name. If you try MS OFFICE, with ACCESS, you will see how nice the combox it is. Of course they are industry GUI standard, forms cannot do it, it is normal.
    2) it does not support partial search as seen on MS Access application
    for ename records in the list,
    David M Brown
    Bill L Kim
    Bill P Kelly
    What is expecting is that if user types in 'D', then the first records should automatically populate into the box's text field; if types in 'B', then the shortened list with the two records beginning with 'B' should be displayed for user to pick.
    This can be seen on MS ACCESS, but not on webforms.
    When we say combobox is available, it is not accurate enough to define the 'availability' of it.

  • Problem with Combo Box in a Dialog Box

    I have a dialog box that includes a combo box.
    For some reason the combo box shows up under the first text box. In other words, the combo box is not separate from the first field. It has the following:
    ComboBox with Sequence showing, then Enter Identifyer
    Textbox URL
    Textbox Enter Resource 1
    Textbox Enter Resource 2
    Textbox Enter Resource 3
    Textbox Enter Resource 4
    Textbox Enter Resource 5
    It's putting the combo box in the first text field...it should be
    ComboBox with Sequence showing
    URL Textbox
    Enter Identifyer Textbox
    Enter Resource 1 Textbox
    Enter Resource 2 Textbox...
    Here is my code:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import dl.*;
    * Dialog to enter container information
    public class AddContainer extends JDialog {
    private JTextField valueBox1;
    private JTextField valueBox2;
    private JTextField valueBox3;
    private JTextField valueBox4;
    private JTextField valueBox5;
    public String value1;
    public String value2;
    public String value3;
    public String value4;
    public String value5;
    private JTextField identifyerBox;
    private JTextField URLBox;
    private JTextField attrBox;
    public String identifyer;
    public String URL;
    public int choice;
    * Constructor.
    public AddContainer(Frame parent) {
    super(parent, "Add Container", true);
    JPanel pp = new JPanel(new DialogLayout2());
    pp.setBorder(new CompoundBorder(
    new EtchedBorder(EtchedBorder.RAISED),
    new EmptyBorder(5,5,5,5)));
    String[] ContStrings = {  "Sequence", "Bag", "Alternative" };
    // Add action listener.
    ActionListener contlst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox)e.getSource();
    int choice = (int)cb.getSelectedIndex();
    //Create the combo box, select the item at index 0.
    //Indices start at 0, so 2 specifies the Alternative
    JComboBox ContList = new JComboBox(ContStrings);
    ContList.setSelectedIndex(0);
    ContList.addActionListener(contlst);
    //Add combo box to panel.
    pp.add(ContList);
    pp.add(new JLabel("Enter Identifyer"));
    identifyerBox = new JTextField(16);
    pp.add(identifyerBox);
    pp.add(new JLabel("URL"));
    URLBox = new JTextField(16);
    pp.add(URLBox);
    pp.add(new JLabel("Enter Resource 1"));
    valueBox1 = new JTextField(25);
    pp.add(valueBox1);
    pp.add(new JLabel("Enter Resource 2"));
    valueBox2 = new JTextField(25);
    pp.add(valueBox2);
    pp.add(new JLabel("Enter Resource 3"));
    valueBox3 = new JTextField(25);
    pp.add(valueBox3);
    pp.add(new JLabel("Enter Resource 4"));
    valueBox4 = new JTextField(25);
    pp.add(valueBox4);
    pp.add(new JLabel("Enter Resource 5"));
    valueBox5 = new JTextField(25);
    pp.add(valueBox5);
    JPanel p = new JPanel(new DialogLayout2());
    p.setBorder(new EmptyBorder(10, 10, 10, 10));
    p.add(pp);
    ActionListener lst = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    identifyer = identifyerBox.getText();
    URL = URLBox.getText();
    value1 = valueBox1.getText();
    value2 = valueBox2.getText();
    value3 = valueBox3.getText();
    value4 = valueBox4.getText();
    value5 = valueBox5.getText();
    dispose();
    JButton saveButton = new JButton("ADD");
    saveButton.addActionListener(lst);
    getRootPane().setDefaultButton(saveButton);
    getRootPane().registerKeyboardAction(lst,
    KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    p.add(saveButton);
    JButton cancelButton = new JButton("Cancel");
    lst = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    dispose();
    cancelButton.addActionListener(lst);
    getRootPane().registerKeyboardAction(lst,
    KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    p.add(cancelButton);
    getContentPane().add(p, BorderLayout.CENTER);
    pack();
    setResizable(false);
    setLocationRelativeTo(parent);

    Seems the problem is in your DialogLayout2 class which must be in package dl. I tried a grid layout and got something that looks like what you described. I laid out pp with a gridbag layout.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    //import dl.*;
    * Dialog to enter container information
    public class jello extends JDialog {
      private JTextField valueBox1;
      private JTextField valueBox2;
      private JTextField valueBox3;
      private JTextField valueBox4;
      private JTextField valueBox5;
      public String value1;
      public String value2;
      public String value3;
      public String value4;
      public String value5;
      private JTextField identifyerBox;
      private JTextField URLBox;
      private JTextField attrBox;
      public String identifyer;
      public String URL;
      public int choice;
      * Constructor.
      public jello(JFrame parent) {
        super(parent, "Add Container", true);
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints gbc = new GridBagConstraints();
        JPanel pp = new JPanel(gridbag);
                            //(new GridLayout(0,2));
                            //(new DialogLayout2());
        pp.setBackground(Color.red);
        pp.setBorder(
          new CompoundBorder(
            new EtchedBorder(EtchedBorder.RAISED),
            new EmptyBorder(5,5,5,5)));
        String[] ContStrings = { "Sequence", "Bag", "Alternative" };
        // Add action listener.
        ActionListener contlst = new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox)e.getSource();
            int choice = (int)cb.getSelectedIndex();
        //Create the combo box, select the item at index 0.
        //Indices start at 0, so 2 specifies the Alternative
        JComboBox ContList = new JComboBox(ContStrings);
        ContList.setSelectedIndex(0);
        ContList.addActionListener(contlst);
        //Add combo box to panel.
        gbc.insets = new Insets(2,2,2,2);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(ContList, gbc);
        gbc.anchor = gbc.EAST;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Identifyer"), gbc);
        identifyerBox = new JTextField(16);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(identifyerBox, gbc);
        gbc.anchor = gbc.EAST;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("URL"), gbc);
        URLBox = new JTextField(16);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(URLBox, gbc);
        gbc.anchor = gbc.CENTER;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 1"), gbc);
        valueBox1 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox1, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 2"), gbc);
        valueBox2 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox2, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 3"), gbc);
        valueBox3 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox3, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 4"), gbc);
        valueBox4 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox4, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 5"), gbc);
        valueBox5 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox5, gbc);
        JPanel p = new JPanel();//(new DialogLayout2());
        p.setBackground(Color.blue);
        p.setBorder(new EmptyBorder(10, 10, 10, 10));
        p.add(pp);
        ActionListener lst = new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            identifyer = identifyerBox.getText();
            URL = URLBox.getText();
            value1 = valueBox1.getText();
            value2 = valueBox2.getText();
            value3 = valueBox3.getText();
            value4 = valueBox4.getText();
            value5 = valueBox5.getText();
            dispose();
        JButton saveButton = new JButton("ADD");
        saveButton.addActionListener(lst);
        getRootPane().setDefaultButton(saveButton);
        getRootPane().registerKeyboardAction(lst,
          KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
        p.add(saveButton);
        JButton cancelButton = new JButton("Cancel");
        lst = new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            dispose();
        cancelButton.addActionListener(lst);
        getRootPane().registerKeyboardAction(lst,
          KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
        p.add(cancelButton);
        parent.getContentPane().add(p, BorderLayout.CENTER);
        parent.pack();
        parent.setResizable(false);
    //    setLocationRelativeTo(parent);
        parent.setVisible(true);
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        new jello(frame);
        frame.setLocation(0,200);
    }

  • Problem rendering a combo box in the data grid

    Hi,
    I am rendering a combo box in the data grid control using an
    item renderer. When I click on it to select a value from the drop
    down, the combo box immediately closes giving no time to even click
    on the dropdown. This doesn’t happen every time the combo is
    clicked, although it happens frequently. What I think is that the
    problem arises because the data grid tries to refresh the renderers
    and during this process, the existing combo is removed, thereby
    getting closed automatically. Please let me know of a work around.
    Thanks,
    Cheree

    hi hiwa,
    i have to add combo box in datagrid dynamically.
    it should append as and when i add the data in the above text boxes.
    thanks in advance.

  • Field EBELN into table EQUP

    Hi gurus,
    I need some help:
    Is it possible, via user exit or something similar, to add the field EKKO-EBELN into table EQUP? It should be useful just right to LIFNR column.
    THe idea is to have the doc. number into quota arrangement.
    Thanks,
    G

    Do you have a user exit that should be used with MRP?
    And is it also possible to add EBELN field into table control of screen #215 of transaction MEQ1?
    Edited by: Giovanni Usberti on Aug 6, 2008 2:41 PM

  • Access 2010 - How to display data from a table into a text box upon combo box selection?

    Hi
    I have a a table with 5 columns: month, year, USD, SGD, BAHT.
    I created a form with a combo box for selection of the month and year, and I would like to set adjacent text boxes to show USD, SGD, BAHT information. How can i go about doing that?
    From the Q&A here, most of them uses the function similar to this "=[Combo0].[Column](1)" to show the data in the text box, but this would require the combo box to list a whole bunch of details if i were to add in more currency values to the
    table. Is it possible to not show this information in the combo box, but still populate data in the textboxes base on a selection on only the "month" and "year" in the combo box.

    Hi,
    According to your description, my understanding is that you want to show only the month/year in the combo box, we can choose the date, and it will display the value of USD/SGD/BAHT based on the month/year.
    If it is, I recommend you try the steps:
    Create a form based on your data source table>Add the combo box>combo box wizard>Find a record on my form based on the value I selected my combo box>Add mouth and year to selected fields
    http://office.microsoft.com/en-us/access-help/create-a-list-of-choices-by-using-a-list-box-or-combo-box-HA010113052.aspx
    If I misunderstand something, please let me know. We may upload some screenshots or a sample through OneDrive.
    Regards,
    George Zhao
    TechNet Community Support

  • How to add  the fields into combo ?

    Hi,
    I want to add the table fields into combo box. Now I am able to getting the columns from table but I don�t know how to add that columns in combo box.
    My jsp getting the columns from table.
    function metadata(){
         try {
         Connection con =  null;
         Class.forName("oracle.jdbc.driver.OracleDriver") ;
         con = DriverManager.getConnection("jdbc:oracle:thin:@10.60.4.25:1521:clopaydb","scott","tiger");
         String query = "SELECT * FROM emp";
               DatabaseMetaData dma = con.getMetaData ();
             Statement stmt = con.createStatement ();
              ResultSet rs = stmt.executeQuery (query);
              ResultSetMetaData rsmd = rs.getMetaData ();
              int i;
              int numCols = rsmd.getColumnCount ();
              for (i=1; i<=numCols; i++) {
              if (i > 1) System.out.print(",");
              System.out.print("\nThe Table Column list "+rsmd.getColumnLabel(i));
              rs.close();
              stmt.close();
              con.close();
              catch (Exception ex) {
              ex.printStackTrace ();
         }Please give me a sample code for add these items into combo. (I need JSP sample code )
    Thanks & Regards,
    Merlin Roshina

    function metadata(){
    try {??
    Are you sure on this ? Dont mix javascript function with a java method.
    Make a java bean and your method may return an ArrayList.
    In your JSP ..
    <select name="yourComboBox">
    <%
    // Make a For Loop for the arraylist
    String columnLabel = (String ) arrayList.get(i);
    <option value="<%=columnLabel%>"><%=columnLabel%></option>
    <%
    } // end bracing of for loop
    %>
    </select>
    Post your code based on the directions above then we can help you more on this if reqd.
    Probably you should look up into sample JSP ..JDBC sample codes on google.
    -Rohit

  • How to Bind a Combo Box so that it retrieves and display content corresponding to the Id in a link table and populates itself with the data in the main table?

    I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
    1. Party (PartyId, Name)
    2. Case (CaseId, CaseNo)
    3. Petitioner (CaseId, PartyId) ............. Link Table
    I am completely new to .Net and to begin with I download Microsoft's sample application and
    following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
    with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
    And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
    users can choose one from the dropdown list to add or edit the petitioner.

    Hello Barry,
    Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
    the sample available at the link you supplied.
    To get the idea of the thing here is my code behind of a view vBoxPetitioner:
    <UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:v="clr-namespace:CCIS.View.Case"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    d:DesignWidth="300"
    d:DesignHeight="200">
    <UserControl.Resources>
    <DataTemplate DataType="{x:Type vm:vmPetitioner}">
    <v:vPetitioner Margin="0,2,0,0" />
    </DataTemplate>
    </UserControl.Resources>
    <Grid>
    <HeaderedContentControl>
    <HeaderedContentControl.Header>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
    <TextBlock Margin="2">
    <Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
    | <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
    </TextBlock>
    </StackPanel>
    </HeaderedContentControl.Header>
    <ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
    </HeaderedContentControl>
    </Grid>
    </UserControl>
    This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
    Here is the code of vmPetitioner, a ViewModel:
    Imports Microsoft.VisualBasic
    Imports System.Collections.ObjectModel
    Imports System
    Imports CCIS.Model.Party
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' ViewModel of an individual Email
    ''' </summary>
    Public Class vmPetitioner
    Inherits vmParty
    ''' <summary>
    ''' The Email object backing this ViewModel
    ''' </summary>
    Private petitioner As tblParty
    ''' <summary>
    ''' Initializes a new instance of the EmailViewModel class.
    ''' </summary>
    ''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
    Public Sub New(ByVal detail As tblParty)
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Me.petitioner = detail
    End Sub
    ''' <summary>
    ''' Gets the underlying Email this ViewModel is based on
    ''' </summary>
    Public Overrides ReadOnly Property Model() As tblParty
    Get
    Return Me.petitioner
    End Get
    End Property
    ''' <summary>
    ''' Gets or sets the actual email address
    ''' </summary>
    Public Property fldPartyId() As String
    Get
    Return Me.petitioner.fldPartyId
    End Get
    Set(ByVal value As String)
    Me.petitioner.fldPartyId = value
    Me.OnPropertyChanged("fldPartyId")
    End Set
    End Property
    End Class
    End Namespace
    And below is the ViewMode vmParty which vmPetitioner Inherits:
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Collections.Generic
    Imports CCIS.Model.Case
    Imports CCIS.Model.Party
    Imports CCIS.ViewModel.Helpers
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' Common functionality for ViewModels of an individual ContactDetail
    ''' </summary>
    Public MustInherit Class vmParty
    Inherits ViewModelBase
    ''' <summary>
    ''' Gets the underlying ContactDetail this ViewModel is based on
    ''' </summary>
    Public MustOverride ReadOnly Property Model() As tblParty
    '''' <summary>
    '''' Gets the underlying ContactDetail this ViewModel is based on
    '''' </summary>
    'Public MustOverride ReadOnly Property Model() As tblAdvocate
    ''' <summary>
    ''' Gets or sets the name of this department
    ''' </summary>
    Public Property fldName() As String
    Get
    Return Me.Model.fldName
    End Get
    Set(ByVal value As String)
    Me.Model.fldName = value
    Me.OnPropertyChanged("fldName")
    End Set
    End Property
    ''' <summary>
    ''' Constructs a view model to represent the supplied ContactDetail
    ''' </summary>
    ''' <param name="detail">The detail to build a ViewModel for</param>
    ''' <returns>The constructed ViewModel, null if one can't be built</returns>
    Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Dim e As tblParty = TryCast(detail, tblParty)
    If e IsNot Nothing Then
    Return New vmPetitioner(e)
    End If
    Return Nothing
    End Function
    End Class
    End Namespace
    And final the code behind of the view vPetitioner:
    <UserControl x:Class="CCIS.View.Case.vPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    Width="300">
    <UserControl.Resources>
    <ResourceDictionary Source=".\CompactFormStyles.xaml" />
    </UserControl.Resources>
    <Grid>
    <Border Style="{StaticResource DetailBorder}">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Column="0" Text="Petitioner:" />
    <ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
    </Grid>
    </Border>
    </Grid>
    </UserControl>
    The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
    what I need to Know is how to route the binding path if it exists in a different ViewModel?
    Sir, I look forward to your early reply bringing a workable solution to the problem I face. 
    Warm Regards,
    Arun

Maybe you are looking for

  • Iphone from germany is not working in egypt is locked What to do ?

    Can anybody help me

  • Airport and GPS

    If the iPhone tries to get your current location from whatever WiFi network it is connected to before turning on the GPS radio why is there no place to put in GPS coordinates to the Airport Extreme? Or am I missing something?

  • What's the best text organizer software

    I used to use a program from Lotus Notes called "Organizer".  I used to be able to type notes and organize them be catagory.  I was also able to do a search on a word to find the appropriate note.  Does anyone know if their is a similar software for

  • Active screen corners do not always respond

    Sometimes, maybe due too high CPU load, or switching displays my Active screen corners do not respond.... Hitting the F9-F12 buttons do active expose, but only after re-initializing the displays (put it in other refreshrate or so), my active screen c

  • Jerky playback of video clips in iMovie

    Just purchased a Sony Handycam (DCR-SR37E), and the movie playback is very jerky: the red line doesn't flow smoothly through the clips and the playback correspondingly jumps about. The sound is unaffected - it plays back smoothly. Is this a problem w