ActionListeners and scope

Hello,
I have been trying to get my action listener to work so that it outputs the volume that is passed into. I want to limit the volume between 0 and 15 or there abouts. I have been reading books upon books to try and figure out where i have gone wrong but i just can't seem to figure it.
Here is my code below. any help would be appreciated
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
* Gareth Leah
class volumeControl extends JFrame {
public class VolumeSensor {
private int lowVolume;
private int maxVolume;
private int volume;
//CONSTRUCTORS
public VolumeSensor() {
this(null,0, 15, 10);
public VolumeSensor(String n, int lowVolume, int maxVolume, int volume) {
this.lowVolume = lowVolume;
this.maxVolume = maxVolume;
this.volume = volume;
//methods
public int getlowVolume() {
return lowVolume;
public void setlowVolume(int lowVolume) {
this.lowVolume = lowVolume;
public int getmaxVolume() {
return maxVolume;
public void setmaxVolume(int maxVolume) {
this.maxVolume = maxVolume;
public int getVolume() {
return volume;
public void setVolume(int volume) {
this.volume = volume;
public boolean Mute(){
return true;
public volumeControl() {
this.setTitle("Volume Controller");     
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel p = new JPanel();
//--------Volume Label------------------------------
JLabel Label = new JLabel("Volume");
Label.setForeground(Color.black);
Font font = new Font("Serif", Font.PLAIN, 15);
Label.setFont(font);
//--------Mute------------------------------
JCheckBox Mute = new JCheckBox("Mute");
Mute.setSelected(false);
p = new JPanel();
p.add(Mute);
this.add(p, BorderLayout.SOUTH);
//--------Volume------------------------------
final JSlider volume = new JSlider(0,15,7);
volume.setOrientation(SwingConstants.VERTICAL);
volume.setToolTipText("Volume Control");
volume.setPaintTicks(true);
volume.setPaintLabels(true);
//------------------Set it out---------------
p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
p.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
p.add(Box.createHorizontalGlue());
p.add(Label);
p.add(volume,BorderLayout.CENTER);
p.add(Box.createRigidArea(new Dimension(10, 0)));
p.add(Mute);
//actionlistener
volume.addChangeListener(new ChangeListener() {
+public void stateChanged(ChangeEvent slider) {+
JSlider volume = (JSlider)slider.getVolume() ;
if (slider.volume>15)
System.out.println(volume);
+ +//int volume = (int)volume.getVolume();++
++// if (volume == 0) {++
++// if (lowVolume) Mute(false);++
+} else {+
System.out.println(volume);
+}+
+});+
this.pack();
this.setVisible(true);
/* Test */
public static void main(String[] arg) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
volumeControl v = new volumeControl();

Thanks again! i feel like im starting to get the hang of this. I have changed my program to:
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
* Gareth Leah
class volumeControl extends JFrame {
public class VolumeSensor {
    public boolean Mute(){
        return true;
        public volumeControl() {
        this.setTitle("Volume Controller");     
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel p = new JPanel();
         //--------Volume Label------------------------------
        JLabel Label = new JLabel("Volume");
        Label.setForeground(Color.black);
        Font font = new Font("Serif", Font.PLAIN, 15);
        Label.setFont(font);
         //--------Mute------------------------------
        JCheckBox Mute = new JCheckBox("Mute");
        Mute.setSelected(false);
        p = new JPanel();
        p.add(Mute);
        this.add(p, BorderLayout.SOUTH);
        //--------Volume------------------------------
        final JSlider volume = new JSlider(0,15,7);
        volume.setOrientation(SwingConstants.VERTICAL);
        volume.setToolTipText("Volume Control");
        volume.setPaintTicks(true);
        volume.setPaintLabels(true);
        //------------------Set it out---------------
        p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
        p.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
        p.add(Box.createHorizontalGlue());
        p.add(Label);
        p.add(volume,BorderLayout.CENTER);
        p.add(Box.createRigidArea(new Dimension(10, 0)));
        p.add(Mute);
        //actionlistener
       volume.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
        int volumeLevel = volume.getValue();
        if (volumeLevel<=15 || volumeLevel>=1)
            System.out.println(volumeLevel);
        this.pack();
        this.setVisible(true);
    /* Test */
    public static void main(String[] arg) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                volumeControl v = new volumeControl();         
and i keep getting this compile error:
compile:
run:
2009-07-28 13:14:24.975 java[23021] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0xe903, name = 'java.ServiceProvider'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2009-07-28 13:14:24.975 java[23021] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)
i'm really not sure how to fix the compile error but i think im getting this jbox ok!

Similar Messages

  • ActionListeners and ItemListener

    Hi
    I'm using some ItemListener to detect when things are selected from a list but require a button to open a new GUI window. However, when i try and compile, the compiler says i can't use ActionListeners and ItemListeners in the same class. Is this true? Any ways i can get around it?
    Cheers

    implements ItemListener and ActionListener
    gives the following error messages:
    ListTest.java:6: '{' expected
    public class ListTest extends GUIFrame implements ItemListener and ActionListener
    ^
    ListTest.java:100: '}' expected
    ^
    ListTest.java:6: ListTest should be declared abstract; it does not define itemStateChanged(java.awt.event.ItemEvent) in ListTest
    public class ListTest extends GUIFrame implements ItemListener and ActionListener
    anymore ideas?

  • ActionListeners and ActionEvents

    Alright guys I am building myself a GUI and am using ActionListeners and ActionEvents however I'm not exactly sure what these 2 things do. I know they are used for buttons seeing as all of my buttons implement them but what specifically do they do. How does the ActionListener link to the ActionEvent???

    Check this out:
    http://java.sun.com/docs/books/tutorial/uiswing/learn/index.html
    You definitely need an overview of event-based programming to get a start with Swing. Also, make sure you understand anonymous classes (a type of inner class), as they are used extensively throughout Swing (especially in sample code), and are quite confusing if you don't know what they are!
    Nick

  • Automating table header and scope assignment?

    Is there any way to automate the process of assigning headers and scope in a table in a pdf document?
    We regularly produce large volumes of pdf documents for our clients, that include among other things tables.  We have recently been informed that our documents need to be Accessible (508 compliant).  Being able to produce these in an automated fashion is required due to our volume.  For example, our current project involves producing 4,300 4 page documents that include a total of  six tables each.  While the layout is uniform for these, the data in the tables is unique for each one.
    We produce the documents using SAS and are using adobe action scripts to automate the process of tagging the documents, adding properties and doing a full accessibility check.  We have also used commonlook to verify that we are meeting the additional accessibility requirements that the full accessibility check does not cover.  The one part that we have not been able to figure out is how to automate the tagging of header cells in the document as headers and set the scope. 
    SAS does not natively tag the PDF documents, which is why we tag them with an Acrobat action.  For an alternative approach, I have tried converting an html document with a properly formatted table (headers and scope assigned) from html to pdf to see if headers and scope could be assigned that way, but the header and scope assignment was lost in the conversion.
    If there is no way to automate this through Acrobat somehow, is there a PDF authoring tool that can produce PDF documents with properly tagged and scoped tables in an automated fashion from a data source?  Preferably one that can use a SAS dataset or Oracle for the source data.

    Thank you for replying.  I understand that header rows and columns need to be properly tagged and scoped to be accessible (508 compliant) which is why I am looking for a tool or plugin that I can set up to properly tag them in an automated fashion. 
    You mention using a plug-in.  Do you know of a plug-in that can be set up to properly tag the table headers and scope without manual intervention?
    If I tag the tables in these documents manually, it takes me about 10 minutes per document.  for 4,300 documents, at 40 hours per week, it will take about 4 1/2 months to tag all of them.  That is just one of many projects.  That is not an option.
    Can anyone suggest a PDF authoring tool that can produce properly tagged PDF's, including table headers and scope, in a productionalized fashion using SAS or Oracle or SQL Server or Access, or Excel as a data source?
    Or an Acrobat plug-in that can be set up to properly tag the table headers and scope without manual intervention?

  • What is the proper way to run a DMM and Scope back and forth continuously?

    I am running a list of tests from an Excel file that could be a DMM or Scope test or neither. I am creating a session of each at the beginning, setting up the device before measurement and disabling them after making a reading then set up the device before next reading.  I thought this would be quicker than closing and initializing around each test.  Is this an efficient way or is there a better way?

    Execute tests runs the list of tests.  Call Required Test Steps runs through each individual test.  Device is called to initialize all devices before Execute tests is called.  Then they are not closed until all tests have been ran.
    Maybe to clarify my question.   
    Here is what I do with the DMM and scope
    init DMM, init Scope 
    setup DMM or scope
    measure
    disable
    setup DMM or scope
    measure
    disable
    //(repeat these three steps as many times as needed)
    Close DMM and Scope.
    I disable so that the DMM isn't still reading Ohms when a voltage is connected, etc
    I am just wondering if this is efficient
    Attachments:
    Call Required Test Steps.vi ‏36 KB
    Execute Tests.vi ‏347 KB
    Device.vi ‏53 KB

  • Significance and scope of STO & STR

    Folks
    I am trying to understand the Significance and scope of STO & STR.
    1. Are STO & STRu2019s primarily used to transport the stock between
           a). Plants within same company or
           b). Plants within different company or
    2. At what point in the logistics/SCM process does STR/STO get created?
    3. Are STR/STO created manually or through MRP / SNP?
    4. Whatu2019s the standard approach to convert STR to STO.
    Thanks

    How do you differentiate STO and PO?  Both are pruchase orders that are created with ME21N and changed in ME22N.
    if the plants are in the same company then you use order document type UB.
    if the plants are in different company codes then you either stay with the standard and use NB as document type (or you still want differentiate between real external orders and purchase orders made to a partner company, then you can create an extra document type like IC for intercompany)
    MRP creates planned order or requisitions only, based on settings made in MRP parameters and indicators set in material master, but never an external document like purchase order or STO.
    The main difference between UB and NB stock transport orders is that in UB orders you just  mention a plant instead of a vendor number. further in NB orders you need to have an price because there is  a billing requirement  between two legal entities while UB orders do not have price conditions (except for freight costs with external carriers).
    The setting from which SAP knows whether it has to create a NB or UB  is made in purchasing customizing of stock transports. Further SAP will know from enterprise customizing if the plants involved belong to same or different company codes.
    In case of different company codes, you need to create vendor master data for each plant,  and the vendor needs to be linked to a plant. (table T001W)

  • Significance and scope of backorder processing

    Folks
    I am trying to understand the Significance and scope of backorder processing.
    Is backorder processing a standard process that is run in every company frequently or is there a special need that drives this process ?
    Thanks

    Hi Sree
    In simple term Back order Processing is more of a manipulation.
    The quantity already assured to other customers earlier are being manipulated/changed here.
    Back order is created in two scenarios.
    1. If the order quantity is not totally confirmed.
    2. If the requested delivery date can not be kept.
    I will give you a simple example.
    Suppose ,you have a material M1.
    Your sales closing is 30th Oct.
    As of to-day your stock is 1000 units, out of which suppose 200,300 and 400 units are already assured/promised to customer A,B and C respectively.
    You are not going to receive any stock before 1st Nov.
    In this scenario, suppose one of the biggest institution (your most important customer) has palced an order for 400 units and to be delivered before 30th Oct.,whereas you have only 100 units left open with you.
    You have been trying for this order since last few months as this business is very lucrative, every year grows by atleast 30%,payment is very good, profit is very good, it is a prestigious institute where all compititors are active.
    If you will not serve this order, then in future you will loose the business permanently which you can not afford.
    In this situation what you will do ?
    Obviously, You will change the already promised quantity earlier to other customer and find out 500 units for this order, and this process is called Back Order Processing.
    Back order processing is of 2 types.
    1. Manually (Here ATP quantities are reassigned manually as for confirmation and manage the required stock for the important customer)
    Here t.code CO06 is used.
    2. Automatic or via Rescheduling ( Here system does automatically taking the "Delivery priority" from the customer master into consideration). Here t.code V_V2 is used.

  • Dynamic View Object Creation and Scope Question

    I'm trying to come up with a way to load up an SQL statement into a view object, execute it, process the results, then keep looping, populating the view object with a new statement, etc. I also need to handle any bad SQL statement and just keep going. I'm running into a problem that is split between the way java scopes objects and the available methods of a view object. Here's some psuedo code:
    while (more queries)
    ViewObject myView = am.createViewObjectFromQueryStmt("myView",query); //fails if previous query was bad
    myView.executeQuery();
    Row myRow = myView.first();
    int rc = myView.getRowCount();
    int x = 1;
    myView.first();
    outStr = "";
    int cc = 0;
    while (x <= rc) //get query output
    Object[] result = myRow.getAttributeValues();
    while (cc < result.length)
    outStr = outStr+result[cc].toString();
    cc = cc+1;
    x = x+1;
    myView.remove();
    catch (Exception sql)
    sql.printStackTrace(); myView.remove(); //won't compile, out of scope
    finally
    myView.remove(); //won't compile, out of scope
    //do something with query output
    Basically, if the queries are all perfect, everything works fine, but if a query fails, I can't execute a myView.remove in an exception handler. Nor can I clean it up in a finally block. The only other way I can think of to handle this would be to re-use the same view object and just change the SQL being passed to it, but there's no methods to set the SQL directly on the view object, only at creation time as a method call from the application module.
    Can anyone offer any suggestions as to how to deal with this?

    I figured this out. You can pass a null name to the createViewObjectFromQueryStmt method, which apparently creates a unqiue name for you. I got around my variable scoping issue by re-thinking my loop logic.

  • Is there an idiots guide to JSF and scope somewhere?

    I am getting very confused with scope and JSF.
    I have a page that just displays customer details (from CustomerBean extends Customer) with a button that should allow the user to change the customer details. Both pages use the same backing bean (is that recommended?).
    customerDetail.jsp --> editCustomer.jsp
    If I set the scope of CustomerBean to session, editCustomer sees the same customer as customerDetail. It seems to me that I shouldn't really be using session scope as I don't want a particular customer to hang around once I have finished with him. So what should I be doing?
    Should customerBean be request scoped? If so how does editCustomer see it?
    Or should I somehow destroy the session scoped customerBean when I have finished with it?
    I also notice that some example jsps out there have a hidden field for the ID - should I simply look up the customer again from the database in editCustomer?
    I also tried to add a <h:inputHidden value="#{customerBean}"/> but that broke my jsp.
    I have bought and read the J2EE tutorial but I am still confused as to what the recommended way to drag the same Object through two jsp pages.
    It's probably very simple but it's doing my head in ;-)
    - David

    Yeah, forming a model in your head to explain something can be painful, sometimes. This question has come up before, including where I work, and I've never really seen a comprehensive answer, so I'll just write one. :)
    This is kind of a basic servlet concept, so I'll talk mostly about servlets. JSF is just flavor on top of this.
    The lifetime of the request is: from the time the user hits "submit" until the time the response is fully rendered, whatever page that is.
    So, you have a form the user has filled out and he/she hits "submit".
    The HTTP POST request goes to the server (open port 80, write some "key: value" headers to satisfy the HTTP protocol requirements, followed by a stream of text that represents the users' form field values, wait for a response) which then proceeds to process it by parsing the incoming data and making a bunch of subroutine calls. The last set of subroutine calls basically involves a bunch of println() calls to write HTML into an output stream, which is the response the requesting browser is listening for. When that stream is done, the browser displays the html.
    There's nothing that says the html that's displayed is the same as the html that originally held the form the user submitted. The first page is essentially garbage that somehow generated some form fields. The server could care less what it was, all it wants is the key=value pairs.
    You could, if you were so inclined, code all those println()s yourself. That's straight servlet programming. It's totally under your control. You could code println( "<html><body>Hi, Mom!</body></html>"); and be done.
    Or, you could write a JSP that, when compiled, turns into essentially a subroutine chock full o' println()s, and you could call that subroutine.
    You do that with RequestDispatcher.forward(). It's just a subroutine call. (But don't do any more scribbling on the output stream after it returns, 'cause the stream's essentially been closed.)
    It's all a big call tree with one thread of execution, single entry, single exit. One of the nice things about servlets is that the infrastructure makes available to you, in a contextual sorta way, the original request parameters plus whatever attributes you choose to attach to the request as your proceed w/your processing, kind of like charms on a charm bracelet (via ServletRequest.setAttribute()). (When I say "contextual", I mean the ServletRequest is passed in as a parameter to Servlet.service() so you can sling it around in your call tree.) Attributes you choose to attach while processing incoming form data are available later (for instance... in the subroutine that has all those println()s you so carefully coded up or allowed the JSP compiler to generate for you).
    When the call tree is done (you've finally printed "</html>", marked the output stream "done" somehow and shipped all that HTML back out to the browser), the ServletRequest object that held the incoming form parameters plus whatever attribute cruft it accumulated is garbage collected. (I could write something poetic about Elysium and gamboling among daisies, but... nah.) So, the lifetime of that data associated w/the ServletRequest is the duration of that request-processing call tree.
    JSF gives you a nice bunch of automatically-generated request attributes, corresponding to your request-scoped managed beans. It even very kindly transfers (via the value bindings) incoming form parameters into properties of beans which are attributed onto your ServletRequest, automagically.
    So, if, in your JSP, you bind your form data to request-scoped bean properties (not the bean itself, but the bean's properties), those exact same bean properties will be visible on whatever JSP you eventually wind up on and it will be available to whatever intervening logic you code up ("Invoke Application" phase), and when the request is done, it all vanishes into thin air.
    To be more specific to your question: yes, I believe it is recommended to have the same bean between pages. That's kind of the whole point. If you find yourself at the end of a request trying to destroy session data that was created at the beginning of that request, you should probably be using request scoping, not session.
    I could be wrong, but I don't think you can bind an entire bean to an html element value. You bind bean properties. Of course, there's nothing to say that a bean property couldn't be... another bean!
    In your particular case, I guess you have a bunch of display-only strings that come from your customer bean, plus a hidden "key" field somewhere. You could bind that hidden field to the customer.key property and Customer.setKey() would do whatever's necessary to get the rest of the data into the bean. That could be a d/b lookup or a map or array (cache) fetch. Or you could have a "current customer" in your session (that would have to be session-scoped, because you paint the detail screen w/one request and then paint the "edit" screen w/the same customer but in a different request). That "current customer" concept might cause you some problems later when you go multi-window or multi-frame in your webapp (truuuuuuuust me).
    Also, I'm not sure why you need a CustomerBean separate from Customer. Can you just make Customer a bean and be done with it?
    Holy cow, what an essay this turned out to be.
    John Lusk.

  • DHCP Scopes and Scope Options Import & Export

    I need to adjust lease times for over one hundred scopes spread across multiple servers (about half of them are on one server, though). There will be 2 or 3 different lease times used. What is the best way to do this?
    I know I can use netsh to change the option for each scope. But I would like to script the collection of the list of scopes, rather than typing the list manually. Is there a way to export a list that contains just scopes and descriptions?
    Thanks

    Hi,
    Actually, it can be exported as txt file.
    netsh dhcp server export c:\DHCP\myscopes.txt
    Export-DhcpServer
    And you can also manage it via powershell
    Use the PowerShell DHCP Module to Simplify DHCP Management
    http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/14/use-the-powershell-dhcp-module-to-simplify-dhcp-management.aspx
    Hope this helps.

  • 5122 and scope show video signal in bad resolution

    i'm using the 5122 digitizer trying to show a nice clear scope (ni scope front panel) image of an entire video frame (all lines).  some of my settings are 2.0ms/div, 50.0 MS/s; TV trigger; a record length of 1,000,000.
    what i see on the scope is far from a million points plotted.  where the points are concentrated it is just solid white.  I know the scope is recorded a million points because i've exported the data and analyzed elsewhere but the issue isn't data analysis, the people i'm working on this for need to be able to view the scope image and determine whether it is a good signal (by eye).
    if there are any alternate methods to do this then please elaborate. thanks
    Jeff Padham
    HBE
    [email protected]

    You are being limited by the resolution of your monitor.  A nice monitor has about 2000 pixels of horizontal resolution.  If you expanded the NI-SCOPE Soft Front Panel to be the full width of such a monitor, you would get a plot area about 1700 pixels wide.  You are collecting 1 million points.  There is almost three orders of magnitude difference between these two numbers.  The soft front panel is doing the best it can.  Unfortunately, it does not support zoom, which would help with this issue.  You have several options:
    Take ten or twenty lines of data at once and cycle through the frame, using the Line Number event and changing the Line # to change your position in the frame.  This will only work if your signal is repetitive.  This essentially does what a zoom would do.
    Set up your computer with multiple monitors and stretch the soft front panel window across all of them to give yourself more horizontal resolution.  Two monitors is probably fairly easy, since most modern video cards support that many.  More than that can get expensive, since it will require another video card and probably a new motherboard to support an extra video card (although Matrox has a nice external solution, as well).  I am not sure this will give you enough resolution.
    Export the data to NI-HWS and create a viewer to zoom and view all of it at high resolution.  This is fairly easy in LabVIEW.  Let us know if want to pursue this and we can give you some pointers (see the tutorial Managing Large Data Sets in LabVIEW, which has an example which almost does what you need - you would need to add the file I/O to replace the waveform generate code).
    Write your own application in LabVIEW to take a frame and allow zoom on the final result.  Once again, this is fairly easy in LabVIEW.  The NI-SCOPE examples and the previously mentioned tutorial should give you the info you need.
    Let us know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Companies using labview in India and scope of labview in india

    HI
    This is hari krishna have 1+years experience in labview application development.
    I like to know how many companies using labview in India and jobs scope/future of labview developers.
    Regards,
    Hari Krishna.k
    R&D Engineer.

    Hi Hari,
    The scope of LabVIEW in India is indeed very bright.
    You may find the below link useful:
    http://forums.ni.com/t5/LabVIEW-Job-Openings/Scope-of-LabVIEW-job-in-India/td-p/1017671
    Regards,
    Rohan Sood
    Applications Engineer
    National Instruments
    Regards,
    Rohan Sood
    Applications Engineer
    National Instruments

  • Switch abap to bi and scope  for current year

    Hi Gurus,
    i have 1+ year exp in abap in reputed company. I want to switch carrier in ABAP to BI. I have gone thro. all related foram..just i want to knw as current date scope of BI. If i have exp. of abap. Certification is required is yes then should i get job immediately or within 2-4 months. or can i go to any other module(less coding but more functioning).
    Regards,
    Amol
    Use spell-check to correct your spellings and gramatical mistakes before posting. A good question always invites good answers
    Edited by: kishan P on Jan 23, 2012 11:04 AM

    The scope for BI or any job depends on you. If you can excel in BI, then no one can deny you a job.
    pk

  • I need to test NI-Switch card and Scope Card

    I have a PXI-2509 NI-Switch Card and PXI-5112 Scope card,i want to test both the cards.

    Hi Murali
    The easiest way to test your boards without programming, is to use the Soft Front Panels. The SFP is installed with the driver. You have one for Switches and one for the Digitizer. You can find them in MAX (Tools>>Soft Front Panels) or under Start>>National Instruments>>NI-DMM or NI-Switch
    Hope this helps.
    Luca
    Regards,
    Luca

  • Query Close and Scope

    Hi,
    Can I assume that a local query object will release its resources if it
    goes
    out of scope without an explicit query.closeAll or is an explicit closeAll
    always required to release resources and memory?
    I'm using an old Kodo at present (2.4.2 with fixed serp.jar).
    If an explicit closeAll is required what would the design pattern be for a
    method
    that carries out a query and wants to return the collection of found
    objects. Obviously,
    a closeAll will render the collection useless. Surely one doesn't have to
    copy all the
    object references to a new collection, do a closeAll of the query and return
    the new collection?
    Thanks for any advice,
    Clive Cox

    You either have to copy the collection or not close the results. DB
    resources are always reclaimed when the result collection is garbage
    collected. Or if you set com.solarmetric.kodo.DefaultFetchThreshold to
    -1, you can be sure that results are released immediately after
    execution (the entire result set is eagerly loaded). This is the best
    solution if you're going to be iterating the entire collection anyway.

Maybe you are looking for