Want jtable  to be refreshed...on change of the textfield change..

The code is below and question follows the code :
import java.sql.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import java.io.*;
import java.util.*;
import javax.swing.event.*;
public class sample extends JFrame
     JTable tableFindsymbol;
     JFrame FindSymbolFrame;
     JTextField symbolText = new JTextField(35);
    private String getsymbolTextfieldtext;
    private int columns;
     Vector columnNames = new Vector();
    Vector data = new Vector();
    private String query;
     public sample()
               FindSymbolFrame = new JFrame("sample");
              FindSymbolFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Container myPane = FindSymbolFrame.getContentPane();
              myPane.setLayout(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              setMyConstraints(c,0,0,GridBagConstraints.CENTER);myPane.add(getFieldPanel(),c);
              setMyConstraints(c,0,1,GridBagConstraints.CENTER);myPane.add(getTable(),c);
              FindSymbolFrame.pack();
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              Dimension frameSize = FindSymbolFrame.getSize();
              FindSymbolFrame.setLocation(new Point((screenSize.width - frameSize.width) / 2 , (screenSize.height - frameSize.width) / 2));
              FindSymbolFrame.setVisible(true);
     public JPanel getFieldPanel()
          JPanel p = new JPanel(new GridBagLayout());
          p.setBorder(BorderFactory.createTitledBorder("Enter Details"));
          GridBagConstraints c = new GridBagConstraints();
          setMyConstraints(c,0,0,GridBagConstraints.CENTER);p.add(symbolText,c);
          symbolText.addKeyListener(listener);
          return p;
     KeyListener listener = new KeyListener()
                public void keyPressed(KeyEvent e) {}
                public void keyReleased(KeyEvent e)
                          getsymbolTextfieldtext = symbolText.getText();
                          getTable();
               public void keyTyped(KeyEvent e){}
     public JPanel getTable()
          try{
                    query =  "SELECT SYMBOL, CO_NAME FROM CO_DB_WITH_NAME where CO_NAME LIKE '"+ getsymbolTextfieldtext +"'";
                    JOptionPane.showMessageDialog(null,query);
                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                    Connection con = DriverManager.getConnection("jdbc:odbc:sdb","scott","tiger");
                    final Statement st = con.createStatement();
                    ResultSet rs = st.executeQuery(query);
                    ResultSetMetaData md = rs.getMetaData();
                    int columns = md.getColumnCount();
                    for (int i = 1; i <= columns; i++)
                           columnNames.addElement( md.getColumnName(i) );
                   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();
          }catch(Exception e)
                           System.out.println( e );
                    JPanel tablePane = new JPanel(new GridBagLayout());
                    DefaultTableModel model = new DefaultTableModel(data,columnNames);
                    tableFindsymbol = new JTable(model);
                    tablePane.add(tableFindsymbol);
                     JScrollPane scrollPane = new JScrollPane(tableFindsymbol);     
                     getContentPane().add(scrollPane);
                    tablePane.add(getContentPane());
                    tableFindsymbol.setRowSelectionAllowed(true);
                    tableFindsymbol.setColumnSelectionAllowed(false);
                    tablePane.setVisible(true);
                  return tablePane;
     private  void setMyConstraints(GridBagConstraints c, int gridx, int gridy, int anchor)
          c.gridx = gridx;
          c.gridy = gridy;
          c.anchor = anchor;
     public static void main(String[] args)
          sample fsymf=new sample();
}what i want to do is: make the jtable get updated as soon the text in the text field changes..
how do i call the jtable panel so it updates the table or any jtable update method
Thanks for reply in advance..

Quit multi-posting questions.
You where already given the answer to this question in your last posting:
[http://forum.java.sun.com/thread.jspa?threadID=5270240]
Also, in the future don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

Similar Messages

  • Why do filler colors change when the orientation changes?

    Hi, I'm working with a template but don't like the colors of the fill boxes, so I have manually changed them.  I've noticed, however, at least when look at a proof that when I change the orientation of the iPad, the filler color reverts to the original.  The color change screws with the styles.  Anyone else have this problem?  Any fixes?

    Thanks for your reply.  I was fuzting with the "book" again.  It was the simplest -- and therefore easiest to modify stylistically -- template, which was supposed to work in both orientations.  I created it in landscape.  Last night I reallized that when I changed the orientation when working in iBook, if I applied the color change to the boxes [again], the color change stayed when viewed in either orientation. 
    BUT I also saw that the box placement in the portrait view is "wrong."  It covers part of one of the headlines.  While I have changed the headline font manually [not via paragraph styles, which I am finding difficult to manipulate], I have not moved the text.  It is where the template placed it but simply using a different font. 
    Thanks for any insight you might have.

  • What changed in the Find/Change Object behavior?

    In Indesign CS4 all graphics in a document could be centered through the Find/Change feature (Object tab) by leaving the Find field blank and setting the Change field to "Fitting Reference Point: Center" (clicking the center button). This no longer works in CS5. The feedback is of x number of objects changed, but none have.
    It was handy, now it's gone.

    No objects locked.
    Actually, it seems stranger.
    (BTW- The CS4 version is running on a Power Mac G5, pre-intel, Tiger.
    The CS5 Version is on a  Power Mac G5, Intel, Snow Leopard.)
    If a single graphic is dragged or placed in the document, the Find/Change, as described, does nothing. When a second one is added, it works as expected, unless they are both jpegs or PSDs. In that case, they sometimes, disappear completly and are shown to be (in the links panel) on the pasteboard but not visible there. But, get this, add a pdf or AI file to the doc, and run it again and it works fine again. The revese order also applies. If I delete all but one graphic it stops working again.
    In all cases the fitting commands work fine.
    It seems as if there is some confusion in how the document object model is being addressed and filetype is in the mix.

  • Plot area width changes as the precision changes !?

    need help to understand following thing:
    If I increase the precision of a graph manually, the plot area size decreases and vice versa.
    Otherwise there is an example posted demonstrating prcision change by property node which does not change plot area size.
    I've attached an example to demonstrate both.
    What I want is to change the precision manually with the default graph tools without decrease or increase plot area width.
    Is this possible in LV 6.02 ?
    Attachments:
    MyScaleProblem.vi ‏60 KB

    Hi.
    Resizing of the graph is the default behavior. The Graph resizes in LabVIEW 7 in both cases. I woud suggest building a text indicator with a transparent background and reading the properties of the graph to display the correct values to the side. This should give the desired response.
    -Erik

  • About the focus changing of jlist

    I am using a jlist to show note types and a jtable to show all the notes of the current types,and I can edit the notes in the jtable.Before I change the selection of the item of the types,I need to determine if the notes have changed ,if the data changes a confirm dialog to prompt you to save will be shown,if I select cancel the selection of the item of the types should keep original for the app querys db and displays related data when types selection changing.I want to know how to show the saving confirm dialog before the item selection change and if I select cancel,the selection won't be changed,it will be changed only if I select yes or no ,cause if the item change another query will be done.I am looking for such a listener in javadoc but failed.
    thanks.
    Edited by: fxbird on Jul 17, 2008 7:18 AM

    this is so brittle, if you breathe on it, it'll break.
    anyway, it might give you something to play around with
    (when opened, click any item for selection, then click another item)
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      public void buildGUI()
        String[] cities = {"London","Madrid","New York","Rome","Sydney","Toronto","Washington"};
        final DefaultListModel listModel = new DefaultListModel();
        final JList list = new JList(listModel);
        for(int x = 0; x < cities.length; x++) listModel.addElement(cities[x]);
        JScrollPane sp = new JScrollPane(list);
        JFrame f = new JFrame();
        f.getContentPane().add(sp);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
        final int rowHeight = list.getCellBounds(0,0).height;
        MouseListener[] listeners = list.getMouseListeners();
        for(int x = 0, y = listeners.length; x < y; x++) list.removeMouseListener(listeners[x]);
        list.addMouseListener(new MouseAdapter(){
          public void mousePressed(MouseEvent me){
            int oldSelection = list.getSelectedIndex();
            int selection = me.getY()/rowHeight;
            int maxSelection = listModel.size()-1;
            if(selection > maxSelection) selection = maxSelection;
            if(oldSelection > -1)
              int response = JOptionPane.showConfirmDialog(null,"Changes not saved!!\n\nContinue?","Danger Will Robinson",
                                                JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
              if(response != JOptionPane.YES_OPTION) return;
            list.setSelectedIndex(selection);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • Have the external buttons/speaker/camera changed on the new iPad mini?

    Easy question, I suspect. But I can't find the answer online. I'll buy a "retina" mini as soon as it becomes available. I'm thinking of going ahead and ordering a case. The case manufacturer assures me the current case will fit. I want to be sure.
    Has any of the hardware changed on the new mini? Enough to necessitate a redesigned case? This would include, for example, different button placements, different speaker sizes, different camera placement, or grossly different iPad dimensions. Maybe the case consultant didn't know his/her [insert proper expletive].
    I thank you, in advance, for your advice on this simple question. (Perhaps you may give me a link to a page containing the answer, showing me how my online search failed!)

    There is a comparison here : http://www.apple.com/ipad/compare/
    The Mini Retina is 0.3 mm thicker, but the height and width are the same
    As far as I can see (going on the images from the below pages) the buttons, speakers, cameras are in the same place
    iPad Mini : http://www.apple.com/ipad-mini/specs/first-generation/
    Mini Retina : http://www.apple.com/ipad-mini/specs/

  • How to track DDL Changes and source code changes

    How can I track the DDL Changes and the Source code (Functions,Procedures,Packages & views) changes made for selective schemas?.
    I mean I want to maintain the history of DDL changes and the sourcecode change history. How to do that? Please provide your guideline with some example...

    Hi,
    you could use a DDL trigger (before create)
    to maybe capture the code and do the audit as well?
    Try this:
    SQL>create table old_code
    2 as
    3 select user username, 0 version, sysdate date_changed, user_source.*
    4 from user_source
    5 where 1=0
    6 /
    Table created.
    SQL>create sequence version_seq;
    Sequence created.
    SQL> create or replace trigger create_trigger
    2 before create on schema
    3 declare
    4 l_date date := sysdate;
    5 l_ver number;
    6 begin
    7 if (ora_dict_obj_type in ( 'PACKAGE', 'PACKAGE BODY', 'PROCEDURE',
    'FUNCTION' ) )
    8 then
    9 select version_seq.nextval into l_ver from dual;
    10
    11 insert into old_code
    12 select user, l_ver, l_date, user_source.*
    13 from user_source
    14 where name = ora_dict_obj_name
    15 and type = ora_dict_obj_type;
    16 end if;
    17 end;
    18 /
    Trigger created.
    SQL> create or replace function f return number
    2 as
    3 begin
    4 return 0;
    5 end;
    6 /
    Function created.
    SQL> select * from old_code;
    no rows selected
    SQL> create or replace function f return date
    2 as
    3 begin
    4 return sysdate;
    5 end;
    6 /
    Function created.
    ops$[email protected]> select * from old_code;
    USERNAME VERSION DATE_CHAN NAME TYPE LINE TEXT
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 1 function f return number
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 2 as
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 3 begin
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 4 return 0;
    aaaaaaaaaaa 2 17-OCT-02 F FUNCTION 5 end;

  • HT1296 I have a problem synching calendar data between my iPhone 3GS iOS 5.1 & Outlook 2007 on MS7.  The basic calendar is OK but the birthdays (little box icon) are a day early & cannot be changed to the correct date. How can I fix this?

    I have a problem synching calendar data between my iPhone 3GS iOS 5.1 & Outlook 2007 on MS7.  The basic calendar data transfer is OK but the birthdays (little box icon) are a day early & cannot be changed to the correct date. The birthday entries in my Outlook contacts have correct dates.How can I fix this?

    The following peocess corrects the calendar entry:
    edit the contact & change the birthday, save the change; edit the contact & change the birthday to the correct value, save the change again. The calendar entry then displays on the correct date.  Alternatively as a temp solution I can just de-select the "birthdays" calendar which stops the icon being displayed.
    Thanks for your advice, I think that it's n going to be a slow process to fix all the entries for not much return.

  • The date changed for unlocking my iPhone from July to October

    For some change reason the date changed on which I was able to unlock my phone. I was July but suddenly it changed to Oct 2012. I have a German provider (T-Mobile) but they are not able to help me. Does anyone know waht happend. I found more people with the same question in other forums but no answers.

    Don't know what to tell you. Yours is the first post of its kind regarding a "delay" in authorizing an official unlock I've seen, and quite frankly I can't imagine any reason for such on Apple's end. All that Apple does is add your phone's IMEI number to a data base of officially unlocked iPhones. Something seems fishy to me regarding what your carrier told you. At any rate, there is no one from Apple here, thus nothing anyone here can do to help you. You could always call AppleCare & verify the veracity of what you were told, and if not true confront your carrier.
    Good luck.

  • Will "Value change" events fire when changed via ActiveX?

    I have a VI with an Event Structure defining several Value Changed events. These events are associated with various buttons on the control panel. When I work through the panel and press the buttons, the events fire correctly. However, if I connect via the COM/ActiveX control and change the control values, the button indicator light changes, but the Value Change event does not fire. Can we trigger value changed events remotely or must they be triggered via a mouse-click on the button?

    Hi Cyle,
    Please take a look at the document below. It explains why the events are not being fired.
    Event Structure Does Not Capture the Value Changed Event for Indicator Wired to Iteration Terminal
    I hope this helps.
    Sincerely,
    Feroz
    National Instruments

  • Song changes when iPod orientation changes

    Hoping someone can help me fix this issue. For some reason when I turn my iPod on its side the song I'm listening to will suddenly change. The display changes to a list of album covers and I need to straighten my iPod and press the Menu button and then Play to start the song again. Is there a way to "lock" a setting so when the iPod's orientation changes it doesn't start playing another song or switch to a display of album covers?
    Thanks in advance.

    Hello Kyle,
    A shot in the dark, but have you checked to make sure you don't have the *Shake to Shuffle* option enabled on the iPod? To check, head to *Settings > Playback*, choose Shake, and then make sure you have it set to Off.
    B-rock

  • Weblogic console - the button "change & lock" is missing

    I just installed weblogic 10.3.5 server in my PC, and found in weblogic console, on the left pane – Change center, the button “change & lock” is missing. How could I get the button back?
    Thank you very much!

    Click in the admin console on Preferences, User Preferences and uncheck Automatically Acquire Lock and Activate Changes.
    Than the Lock&Edit button will appear.

  • JTable will not refresh with new data from database

    Hi,
    I have a JTable that does not recoginzed when the data has changed. The table is dynmaically populated with data from the database using a table model.
    Please help!!
    public JTable getUpdateContractTable() {
    QueryTableModel model;
    String [] dlrs = getSelectedDealers();
    String [] stats = getSelectedStatuses();
    String sql = buildContractQuery(dlrs, stats);
    try {
    if(isContractSet) {
    model = new QueryTableModel();
    model.setQuery(sql);
    table.setModel(model);
    table.setColumnModel(new UpdtCtrctColumnModel());
    table.invalidate();
    table.repaint();
    //model.fireTableChanged(new TableModelEvent(model));
    else {
    model = new QueryTableModel();
    UpdtCtrctColumnModel column = new UpdtCtrctColumnModel();
    model.setQuery(sql);
    table = new JTable(model, column);
    table.createDefaultColumnsFromModel();
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    model.fireTableChanged(null);
    isContractSet = true;
    catch (Exception e) {
    System.out.println(e.getMessage());
    //JOptionPane.show
    //.showMessageDialog("Error: " + e.getMessage(),
    // "Click Ok",
    // JOptionPane.INFORMATION_MESSAGE);
    return table;
    }

    thank you for your help. i finally got it to refresh. i have a follow-up question if you don't mind answering it. i have 2 jtables where one depends on the other. when i do a refresh i want the other table to disappear, so i call the getContentPane().remove(component), but the table doesn't disappear. what should i do.
    anthony

  • Refresh detail report when page is changed

    Hi All,
    could You help me with this problem, please?
    I have page with two reports on one page - master and detail. Master report has link column which ‘call’ the same page and fill item (P2_id) and it refresh the detail report. The problem is when I am changing the page (next x records), then is not item P2_ID changed and detail shows me data of the record from previous page :-(
    Idea is – when will page change than will ID from the first row of report copy into P2_ID... I thing there will any easy trick to solve this but I can find out it...
    Please should You help me
    Thanks a lot
    Alexej

    Alexej,
    The hard thing about what you want to do would be to populate the value of P2_ID on load. There's probably a way to do it but it would take some thought. The easy approach is simply to clear out the value of P2_ID on load and let the user select the row they want again. To get that to work the first thing you'll need to do is to disable the partial page rendering for this report's pagination as there is currently no way to handle these events well (I've done that). Next you'll need to have a process that clears out the value at the right time (I added a computation with a request condition).
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    http://sourceforge.net/projects/plrecur

  • How to refresh mx:List when the data in dataProvider is changed

    I have a mx:List that uses an ArrayCollection as a dataProvider. The ArrayCollection contains many Object, something like:
    var o:Object = new Object();
    o.label = "Apple";
    o.price = "$1.00";
    var o:Object = new Object();
    o.label = "Kiwi";
    o.price = "$0.20";
    Now the dataProvider (ArrayCollection) is updated outside the mx:List, not through the itemEditor. I want the mx:List to show the changes in the
    dataProvider (ArrayCollection), but currently it does not automatically show the changes. I could not find a refresh method in the List or dataProvider
    to force the List to reload the data. Any suggestions?

    Hi John, have you tried arrayCollection.refresh()...where arrayCollection is dataProvider for your List.
    Thanks,
    Bhasker

Maybe you are looking for

  • Broken front cover of screen

    broken  front cover of screen ( not screen) which is wrote  " Beats Audio and dv6 "  and fixed camera my sistem is --hp dv6 6000ee-- how i can fix this problem..? This question was solved. View Solution.

  • Daily Report Layout Customization

    Is it possible to customize the layout in the Daily Report - LABOR tab? I wish to rearrange the column order and the widths. It is possible at the Daily Report level but I don't see how it is possible at the Tab level...

  • IPod Touch stopped working w/2011 Honda Civic?

    I've been connecting my iPod touch to my Honda via USB port.  It's been fully compatible until recently (iOS5 update?). I've restarted the iPod, reset the cable connections, did a desktop sync with the iPod, and still nothing.  I'm getting "unsupport

  • N80 sound hearing problem

    My N80 just have a hearing problem. When I call someone or someone call me, I cannot hear the sound from the handset. But if I connect the bluetooth or use the loudspeaker, it's work. Is this the problem with the handset speaker or any problem in N80

  • How can I change and pause songs on the locked itouch with the iOS 7 update?

    With the previous update I used to be able to pause and play songs or change songs when the itouch was locked but I can't with the new update. How am I able to?