How to populate new values in JTable?

hello swing experts!!!
i have a problem plz i need your help. tnx.
so here's the scenario.
i have a program that retrieves information from the database and display it in the JTable. i have JTextBox to search users by "Name" and when i click JButton "search" it will populate all the users that has the "Name" in the JTable.
i already know how to populate a JTable at first like giving a JTable(row,column) or a model = new DefaultTableModel(row,col). but
i dont know how to *"Re-populate"* values in the JTable? an algorithm/steps/code snippets on how it will work will be a great help. tnx!

Just a small example :
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class Testing
     public static void main(String... args)
          final DefaultTableModel model = new DefaultTableModel()
               @Override
               public boolean isCellEditable(int row, int column)
                    return false;
          model.addColumn("One");
          model.addColumn("Two");
          final JTable table = new JTable(model);
          JButton button = new JButton("Click to add data to the table");
          //get your data in a vector from the list you are getting from the database
          final Vector<String> newRow = new Vector<String>();
          newRow.add("Value1");
          newRow.add("Value2");
          button.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent ae)
                    model.addRow(newRow);
          JFrame frame = new JFrame("Testing");
          frame.getContentPane().add(button, BorderLayout.NORTH);
          frame.getContentPane().add(table, BorderLayout.CENTER);
          frame.setSize(400, 200);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
}

Similar Messages

  • How to enter the values in JTable in runtime

    how to enter the values in JTable in runtime

    Basically you need a vector of vectors or an array of arrays. Example (off the top of my head):
    With Arrays
    String[] cols = { "colone", "coltwo", "colthree", "colfour", "colfive" };
    String[] numbers = { "one", "two", "three", "four", "five" };
    String[] letters = { "A", "B", "C", "D", "E" };
    String[][] data = { numbers, letters };
    //make sure that the table has a scroll pane wrapped around it otherwise the header is not displayed
    JScrollPane scroll = new JScrollPane(new JTable(data, cols));
    With Vectors
    Vector cols = new Vector();
    cols.addElement("colone");
    cols.addElement("coltwo");
    cols.addElement("colthree");
    cols.addElement("colfour");
    cols.addElement("colfive");
    Vector numbers = new Vector();
    numbers.addElement("one");
    numbers.addElement("two");
    numbers.addElement("three");
    numbers.addElement("four");
    numbers.addElement("five");
    Vector letters = new Vector();
    numbers.addElement("A");
    numbers.addElement("B");
    numbers.addElement("C");
    numbers.addElement("E");
    numbers.addElement("F");
    Vector data = new Vector();
    data.addElement(numbers);
    data.addElement(letters);
    //make sure that the table has a scroll pane wrapped around it otherwise the header is not displayed
    JScrollPane scroll = new JScrollPane(new JTable(data, cols));The array or vector can be easily populated at runtime.
    Regards
    Riz

  • How to populate data in a JTable?????????

    hi there
    can anyone tell me how to populate data in a JTable? when a table is displayed, the table should have data retrieved from a file. thank you.

    Hi,
    it is correct, that the best way to learn about JTable is to read the online tutorial about JTable. To give you a quick guideline, where to start your implementation, I will add this:
    A JTables data is hold in a TableModel. TableModel is an interface, so if a class implements this interface correctly, you can simply populate the data hold by this TableModel by constructing a JTable this way
    JTable jt = new JTable(MyTableModel);
    where MyTableModel is your class, which implements the TableModel interface.
    When JTable has to render a cell, it will call the getValueAt(...) method of the TableModel for example.Your implementation of this method must deliver the requested data - if you prefetch a bunch of data from a file and store it internally in this TableModel or fetch it from the file just in time, is up to you.
    greetings Marsian

  • Populate New Value field in COPA for Previous periods

    Hi All,
    I have added a new value field to COPA structure and regenerated the Operating Concern. But I dont know how to populate this value field for all the exsiting records. Any help would be appreciated.
    Thanks
    MKR

    I have to manually update all the COPA tables for reporting.

  • How to populate default values for BP (FPP1 is  tcode in ECC 6.0)

    Hello ,
    I am creating BP in ECC 6.0 using Fpp1 tcode.  How to populate default values when i hit create BP person.   any badi  triggers when we are creating BP in ECC.
    guide me.

    Hi Premanand,
    To default fields, you need to do the following steps :
    1. Create a Z module e.g. : Z_DEFAULT_FIELDS_DIALOG.
    2. Enter suppose you want to default fiels Name, title, country, write code as follows  :
    DATA : ls_busdefault LIKE busdefault.     
      ls_busdefault-title = '0002'.
      ls_busdefault-mc_name1 = 'TEST'.
      ls_busdefault-mc_name2 = 'Default'.
      ls_busdefault-country = 'IN'.
        CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
        EXPORTING
          i_busdefault = ls_busdefalut.
    3. Now got to transaction BUS7, select event ISDAT, click on Event--> function modules.
    4. Register your Z module Z_DEFAULT_FIELDS_DIALOG in this list, Save.
    This should solve your problem. Please note : You can only default those fields contained in structure BUSDEFAULT.
    Cheers,
    Rishu.

  • How to populate f4 values to standard pnp selection screen fields

    Hi Experts,
    my question is how to populate f4 values to standard pnp selection screen field. i am using LDB PNP for a report , it displays several fields with f4 values, i need to remove all the stadard f4 values and want to place my  f4 values in the selection screen

    Hi Venkat,
    To put ur own values in the F4 help of any field...all u have to do is.
    1st fetch all the records that u need to display in F4 help list...in one internal table.
    and then use the function module  'F4IF_INT_TABLE_VALUE_REQUEST'
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
    retfield =
    value_org =
    tables
    value_tab =
    return_tab =
    exceptions
    parameter_error = 1
    no_values_found = 2
    others = 3.
    where retfield is the field for which u need to give the F4 help.
    and valu_tab is the internal table in which u have the list of records to be displayed.
    this would do the work...
    I dont have the system in front of me...as soon as i have...will try to send a piece of code, to make ur work easy.
    Till then hope this helps u...all the best
    Regards,
    Radhika

  • How to add new value to 'Partition by' from RPD

    HI..
    in the presentation services when queried my request.. i am getting query below like that.this time i am getting wrong values. if i include c8 in partition by for c13 then i able to get the correct values.
    Can you plz tell me how to include new value to the partion by ..from RPD.
    SAWITH0.c7 as c7,
    SAWITH0.c8 as c8,
    SAWITH0.c9 as c9,
    SAWITH0.c10 as c10,
    SAWITH0.c11 as c11,
    SAWITH0.c12 as c12,
    sum(SAWITH0.c13) over (partition by SAWITH0.c10, SAWITH0.c14, SAWITH0.c11, SAWITH0.c12) as c13,
    SAWITH0.c14 as c14
    Thank you.

    Hi,
    I guess you made a mistake in your business model. The c8 column should be coming from a separate dimension.
    Good Luck,
    Daan Bakboord
    http://obiee.nl

  • How to concatenate new values

    hi experts,
    i have query how to add new values through concatenate like
    concatenate ZCHILDDESC '->' CHILDDESC '->' test into desc.
    now this 'test' value is increase as new value is added.
    how to write the code for this.
    thanks
    vipul

    I think i understood the question though not exactly sure.
    As  the value of test increases, he may want to add additional nodes with -> based on the value of test.
    For Ex,
    If the value of test is 2,
    concatenate ZCHILDDESC '->' CHILDDESC '->' test1 -> test2 into desc.
    similarly if its 3,
    concatenate ZCHILDDESC '->' CHILDDESC '->' test1 '->' test2 '->' test3 into desc.
    @ Vipul: Kindly confirm if this is what your question is else please explain it clearly
    Vikranth

  • How to populate column value from a sequence in adv table

    Hi Everyone,
    This is my requirement. When a user clicks on add another row button of advance table a new row should appear with ID column populated as a sequence value. For eg: When the page renders for the first time, no records are shown in the advance table. when user clicks on add another row button a new row should be added with the ID column poplulated as 1. When the user clicks on add another row button for the 2nd time, the ID coulmn value should be 2 and so on.
    After user clicks on submit button data will be inserted to the data base table.
    Please tell me how to populate the column values with a sequence 1,2,3 ..so on on click of add another row button.
    Thanks in Advance
    Sunny!

    Hi Gyan,
    Below is the code I'm using in PFR.
    OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean;
    OADBTransaction Tr=amobj.getOADBTransaction();
    if ( (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM)))
    && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
    System.out.println("in if clause");
    Number lineNumber = Tr.getSequenceValue("paymentLineSequence");
    testLineEOViewImpl vobj = amobj.gettestLineEOView1();
    vobj.getCurrentRow().setAttribute("SundryRequestLineNumber",lineNumber);
    When i click on Add Another Row button its throwing an exception as below.
    oracle.apps.fnd.framework.OAException: java.lang.ClassCastException: oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean
         at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.lang.ClassCastException: oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean
         at oracle.apps.ap.payments.webui.testCO.processFormRequest(testCO.java:98)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    java.lang.ClassCastException: oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean
         at oracle.apps.ap.payments.webui.testCO.processFormRequest(testCO.java:98)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)

  • How to populate the values based on different selections in Dashboard Promp

    Hi,
    I have a group prompt, which has 2 drop downs. The DropDown1 decides the values of DropDown2.
    I have used a SQL query in the "Show" values which will populate the dropdowns.
    When a value is 'selected" from DropDown1, the selected value decided the values of DropDown2 which is again a SQL query.
    But I see that when a new value is selected from DropDown1, the values in DropDown2 will not change until I click on GO.Even after clicking GO, the previously selcted value is retained.
    As an illustration:
    animals,plants are the choices in the first drop down, which if, animal is selected would populate the dropdown2 with cow,sheep, tiger.
    Assume animal is selected. The second drop down now is populated with cow,sheep and tiger. Assume you chose sheep.This resulted in display of sheep related info on the BI page.
    Now if I go back to the first dropdown and select plants, I would expect the second drop down to be populated with fig, palm, coconut.
    However in my case I see only the proviously popluated animals in the DropDown2.
    If I click on Go, I see that the DropDown2 is populated with Sheep,,fig, palm, coconut. Ideally I should not have seen the prevously selected value in DropDown2.
    Here there are 2 problems stated for a group promt having 2 DropDowns where item chosen from one decides the values of the other dropdown
    1. On selecting an item from DropDown1, is not populating with the corresponding values in DropDown2
    2. When 'Go' is clicked, DropDown2 is populated with the corresponding values for DropDown1 + the previously selected value in DropDown2 is retained.
    Any input to get out of this problem will help
    thanks
    Shubha

    Hi
    I am using group prompt and has 4 drop downs.
    Value of one decides the other. Values for the dropdowns will be populated by SQL results.
    'Constrain' will not be available for sql results..
    How to go about this?
    thanks
    Shubha

  • How i insert the values in JTable

    Hi,
    Iam new to the swings i have a problem placing the values in JTable while retriving the values from DataBase .Anybody please suggest me..
    i can retriving the values but how i place the vlaues..
    This is My code
    package com.teamone.healthcare;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.DriverManager;
    import java.sql.Statement;
    import javax.swing.JButton;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableModel;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.ResultSet;
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo is being used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    public class ClientList extends javax.swing.JFrame {
         private static final long serialVersionUID = 1L;
         private JScrollPane list;
         private JButton view;
         private JButton close;
         private JTable jTable1;
         Connection con = null;
        Statement st = null;
        ResultSet rs = null;
         * Auto-generated main method to display this JFrame
         /*public static void main(String[] args) {
              ClientList inst = new ClientList();
              inst.setVisible(true);
         public ClientList() {
              super();
              initGUI();
              this.setVisible(true);
         private void initGUI() {
              try {
                        list.setBounds(161, 133, 371, 98);
                        list.getHorizontalScrollBar().setPreferredSize(new java.awt.Dimension(10, 59));
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   getContentPane().setLayout(null);
              try {
                    Class.forName("com.mysql.jdbc.Driver").newInstance();
                    con = (Connection) DriverManager.getConnection("jdbc:mysql:///healthcare","yenmad","yenmad");
                    st = con.createStatement();
                    rs = (ResultSet) st.executeQuery("SELECT User_id, Username, Citizen_ID, First_Name, Phone FROM register_users");
                    while(rs.next()) {
                      int Userid = rs.getInt(1);
                      String Username = rs.getString(2);
                      String ClientId = rs.getString(3);
                      String ClientName = rs.getString(4);
                      //String Last_Name = rs.getString(5);
                      String ContactNumber = rs.getString(5);
                      System.out.println(Userid + ", " + Username + ", " +ClientId  + "," + ClientName +","+ContactNumber);
                  } catch (Exception e) {
                       System.out.println("Exception: " + e.getMessage());
                        list = new JScrollPane();
                        getContentPane().add(list);
                        list.setBounds(0, 0, 644, 217);
                             TableModel jTable1Model = new DefaultTableModel(
                                  new String[][] { { "", "", "","", "" } },
                                  new String[]{ "UserId", "UserName", "ClientId", "ClientName", "ContactNumber"});
                             jTable1 = new JTable();
                             list.setViewportView(jTable1);
                             jTable1.setModel(jTable1Model);
                        close = new JButton();
                        getContentPane().add(close);
                        close.setText("Close");
                        close.setBounds(518, 231, 63, 28);
                        view = new JButton();
                        getContentPane().add(view);
                        view.setText("View");
                        view.setBounds(441, 231, 63, 28);
                        view.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  viewActionPerformed(evt);
                   pack();
                   this.setSize(652, 300);
              } catch (Exception e) {
                   e.printStackTrace();
         private void viewActionPerformed(ActionEvent evt) {
              System.out.println("view.actionPerformed, event=" + evt);
              new ViewClient();
    }

    can i display this table values in vertical .. if yes how can i do that.. please suggest me..
    this is the code iam using but it is displa in horizontally...
    package com.teamone.healthcare;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.DriverManager;
    import java.util.Vector;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.WindowConstants;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.ResultSet;
    import com.mysql.jdbc.ResultSetMetaData;
    import com.mysql.jdbc.Statement;
    public class ClientList extends javax.swing.JFrame {
         private static final long serialVersionUID = 1L;
         /*public static void main(String[] args) {
              ClientList inst = new ClientList();
              inst.setVisible(true);
         public ClientList() {
              super();
              initGUI();
              this.setVisible(true);
         private void initGUI() {
              try {
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   pack();
                   setSize(600, 500);
                   Vector columnNames = new Vector();
                Vector data = new Vector();
                try
                          this.setSize(500, 400);
                      //  Connect to the Database
                      Class.forName("com.mysql.jdbc.Driver");
                      Connection connection = (Connection) DriverManager.getConnection("jdbc:mysql:///healthcare","yenmad","yenmad" );
                      //  Read data from a table
                      String sql = "Select User_id, Username, Citizen_ID, First_Name, Last_Name, Phone from register_users";
                      Statement stmt = (Statement) connection.createStatement();
                      ResultSet rs = (ResultSet) stmt.executeQuery( sql );
                      ResultSetMetaData md = (ResultSetMetaData) rs.getMetaData();
                      int columns = md.getColumnCount();
                      //  Get column names
                      for (int i = 1; i <= columns; i++)
                       columnNames.addElement( md.getColumnName(i) );
                      //  Get row data
                      while (rs.next())
                            Vector row = new Vector(columns);
                            for (int i = 1; i <= columns; i++)
                                  row.addElement( rs.getObject(i) );
                            data.addElement( row );
                      rs.close();
                      stmt.close();
                catch(Exception e)
                      System.out.println( e );
                //  Create table with database data
                JTable table = new JTable(data, columnNames);
                JScrollPane scrollPane = new JScrollPane( table );
                getContentPane().add( scrollPane );
                JPanel buttonPanel = new JPanel();
                getContentPane().add( buttonPanel, BorderLayout.SOUTH );
                buttonPanel.setPreferredSize(new java.awt.Dimension(200, 66));
                        JButton View = new JButton();
                        buttonPanel.add(View);
                        View.setText("View");
                        View.setLayout(null);
                        View.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  ViewActionPerformed(evt);
                        JButton Close = new JButton();
                        buttonPanel.add(Close);
                        Close.setText("Close");
                        Close.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  CloseActionPerformed(evt);
                        } catch (Exception e) {
                   e.printStackTrace();
         private void CloseActionPerformed(ActionEvent evt) {
              System.out.println("Close.actionPerformed, event=" + evt);
              this.setVisible(false);
         private void ViewActionPerformed(ActionEvent evt) {
              System.out.println("View.actionPerformed, event=" + evt);
              new ViewClient();
    }

  • How to Populate Database values in OIM user form

    Hi friends,
    I have created some groups in OIM and I have created a new field in OIM user form. Now i want the group values visible as new field values.
    How the database table values can be made visible in OIM field ..?
    please help me in doing it
    Regards
    sri

    Just follow this document and from fig 13 select LOV type as query.
    http://docs.oracle.com/cd/E21764_01/doc.1111/e14308/conf_mangmnt.htm
    Regards
    Shashank

  • How to Populate the Values in Custom Ztable

    Hello, I created the table In SE11 ZPRP, now how to populate this table with data ,
    like
    <b>1. i want to make entries in table please help how to do that.</b>
    <b>2.</b> I want to know if there is any way I can link this table ZPRP to pick up all enties from anoth custom table which has entries since both tables have exact similar structure.
    Thanks
    Regards
    Soniya Kapoor

    Hi,
    1) In SE11 -> Delivery and Maintenance tab, select 'X', Display/maintenanace allowed...
    Activate the table..
    Then in the menu bar , Utilities->Table contents -> create entries...
    Using this u can create new entries into ur table..
    2) Use an ABAP code to download the table data.. and then upload the same to   other table..
    Select * from Z*** into table g_itab.
    if sy-subrc =0.
    Insert ZPRP from g_itab..
    endif..
    Thanks
    Rajiv

  • Changing open() flag  FNDELAY via fcntl(). How to know new value?

    When driver executes open (man -s9e open) entry program it knows open mode
    "flags" such as FEXCL, FNDELAY, FREAD, WRITE. But after open was made these
    parameters can be changed by user application via fcntl() (man -s2 fcntl)
    call.
    How to know from driver the new values of these parameters? How to know
    the moment of changing?
    Thank you.

    Just I found that current mode is in uio_fmode field of uio structure (man -s9s uio).
    But how to obtain the moment of changing?
    Thank you.

  • How to populate various values in a text item

    Hi
    I have a simple form based on a single tables containing name, address, city, state, zip1, zip2 and country fields. On form I am only displaying the zip field which captures value from zip1. Now my delimma is to populate zip2 values when country changes from USA to some other country. What trigger I need to place and soem hints please.
    Thanks
    Zahir

    Hai, Zahir
    u can use Post-Query on Block and set Zip accodingly from Zip1 or Zip2
    Check it .
    i think u will solve u r problem
    do reply.
    Bye
    Raj.
    mail : [email protected]

Maybe you are looking for

  • Useless Map in Photoshop Elements 7, 8, and 9

    I use Windows 7, and have 4 GB RAM, a 2 GHz dual-core processor, and lots of hard drive space.  In Photoshop Elements 7, 8, and 9 the mapping function is completely useless.  Sometimes the pins on the map just flash at me.  When I try to magnify a ce

  • Transfer from old iMac Blueberry 266 to MacBook

    A shiny new MacBook is about to arrive, replacing my 2nd Mac in the household, an older iMac 266 Rev C. The older iMac does not have a firewire port, so I can not use the SetUp/Migration Asssitant to transfer files/info. I do have a Crossover cable,

  • Visa Write go slow

    I have a LabVIEW program which uses a duplicate session to write stuff to an Arduino and read stuff from an Arduino.  After running for some time, occasionally some of the VIs "freeze".  This was on an executable so I haven't investigated what's goin

  • Really annoying search function

    Is anyone else having my problems: 1. I open iTunes and constantly the box pops up "accessing iTunes Store"... so I have to wait each time before doing anything because otherwise iTunes just becomes non-functional. 2. When I use the search function a

  • Kernel installation

    Hi all! I must recompile my kernel because I have a problem with a wireless usb pen. http://www.archlinux.it/wiki/index.php? - 7_wireless To build my kernel I have followed this guide: http://www.archlinux.it/wiki/index.php? - rom_Source The building