Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-26-2008, 09:59 AM
Member
 
Join Date: Mar 2008
Posts: 1
pmcastillo is on a distinguished road
My Simple Refresh Problem
I'm using Netbeans 6.0.1. I've created a generic Java Desktop Application - Database Application from our library. Then added a little searchbar on the top. It looks like this:



My objectives is:

* The user will type something on the JTextField.
* Then the user will click the "SEARCH" button.
* Upon clicking, the query will be updated from: SELECT b FROM Books b
* Into: SELECT b FROM Books b WHERE b.title LIKE \"%" + jTextField1.getText () + "%\"
* Then call the "refresh" method (just like how the refresh booton work) to refresh the table


I tried:

Code:
private void jButton1MouseReleased(java.awt.event.MouseEvent evt) { query = entityManager.createQuery ( "SELECT b FROM Books b WHERE b.title LIKE \"%" + jTextField1.getText () + "%\"" ); refresh(); // This ain't working }
But nothing happens, I made some breakpoints and follow-through what is happening. And this is the code that is concerned with the "refresh" button:

Code:
@Action public Task refresh () { return new RefreshTask ( getApplication () ); } private class RefreshTask extends Task { RefreshTask ( org.jdesktop.application.Application app ) { super ( app ); } @Override protected Void doInBackground () { try { setProgress ( 0 , 0 , 4 ); setMessage ( "Rolling back the current changes..." ); setProgress ( 1 , 0 , 4 ); entityManager.getTransaction ().rollback (); Thread.sleep ( 1000L ); // remove for real app setProgress ( 2 , 0 , 4 ); setMessage ( "Starting a new transaction..." ); entityManager.getTransaction ().begin (); Thread.sleep ( 500L ); // remove for real app setProgress ( 3 , 0 , 4 ); setMessage ( "Fetching new data..." ); java.util.Collection data = query.getResultList (); Thread.sleep ( 1300L ); // remove for real app setProgress ( 4 , 0 , 4 ); Thread.sleep ( 150L ); // remove for real app list.clear (); list.addAll ( data ); } catch ( InterruptedException ignore ) { } return null; } @Override protected void finished () { setMessage ( "Done." ); setSaveNeeded ( false ); } }
But simply calling "refresh();" would simply ends in the "super(app);" statment. I made some quick lookup how the "refresh" button was setup, and all I could see is this:

Code:
refreshButton.setAction(actionMap.get("refresh")); // NOI18N refreshButton.setName("refreshButton"); // NOI18N
And I have no idea, how to call it. I'm really new to Java, I wish you could help me.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
refresh JPanel olesja AWT / Swing 1 04-16-2008 05:58 PM
Refresh Button p_dev_anand Java Blogs 1 01-07-2008 12:25 PM
New to JSF, simple problem with Eclispe and Tomcat nibeck JavaServer Pages (JSP) and JSTL 0 12-16-2007 07:53 PM
simple problem - code wont compile dirtycash New To Java 1 11-20-2007 07:49 PM
problem with a simple java code boy22 New To Java 2 08-03-2007 04:46 AM


All times are GMT +3. The time now is 04:53 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org