Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Java coding question (https://www.askmehelpdesk.com/showthread.php?t=655766)

  • Apr 29, 2012, 09:18 PM
    ganeshuit
    Java coding question
    Suppose I have a text field in java (like in gmail home page you have username field )
    So I want to fill that field automatically by taking record from the database so is there any mechanism in java to handle this problem??
  • Sep 16, 2012, 07:51 AM
    ayesha_b
    I want to invoke webpage to get its html. What is the best html parser for this in java?
  • Aug 6, 2013, 10:11 AM
    Karlphoon
    Will java heap size setting work if I put the parameter at the end of the java call
  • Oct 13, 2013, 03:15 AM
    karuppu
    Hello there, I need source code for "Implementation of various locking and synchronization mechanisms for concurrent
    linked lists, concurrent queues, and concurrent stacks".
  • Jan 14, 2014, 10:33 PM
    shanaka1992
    I think you might be aware with creating a DataBase Connection class and calling that class form your Text Field implemented class.. I not going to revise you those staff again.. :)
    add a jlist right below your text field and enclose it inside a jPanel .So that will load your database fields on it.Text field name is jTextField .List name is JList here is a code example (make changes as you require) :

    private void jTextFieldKeyReleased(KeyEvent evt) {
    try {
    String compareString = jTextField.getText();


    String sql = "SET YOUR SELECT QUERY HERE ";
    ps = conn.prepareStatement(sql);
    rs = ps.executeQuery();

    DefaultListModel dlm = new DefaultListModel();
    while (rs.next()) {
    String s = rs.getString("SET YOUR DATABASE TABLE COLUMN NAME HERE");

    if (s.substring(0, compareString.length()).equalsIgnoreCase(compareSt ring)) {
    jPanel.setVisible(true);
    dlm.addElement(s);
    jList.setModel(dlm);


    }}

    } catch (Exception ex) {}}

  • All times are GMT -7. The time now is 02:47 PM.