Which listener should be used for JTextArea

Hi,
I need to add a listener for JTextArea particualy when
the text in the jtextarea is changed. I don't think
mouse listener is enough, since the user can use tab to
get to the jtextarea and edit the text. In this case,
which listener should I use. Sample code would be
helpful.
In addition, I have a problem with the jtextarea that
when user uses tab to go to different gui components,
such as jtextfield, jcombobox, jtextarea, jlist, etc, the
tab stays in the jtextarea and keeps appending to it. It does
not go to next component, such as jlist. How can I make it
work?
Thanks in advance,
Pin

It doesn't work. Are you using 1.4 or 1.3? I am using
1.4.
In the 1.4 API, it says that isManagingFocus is
"Deprecated".
Here is what I have:
JTextArea descrptArea = new JTextArea() {
public boolean isManagingFocus() {
return false;
descrptArea.setRows(3);
descrptArea.setLineWrap(true);
descrptArea.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
// DO SOMETHING
I found the following code which says it will do it.
However, I got the exeception:
java.lang.ClassCastException:
n: javax.swing.KeyStroke
at java.util.TreeMap.compare(TreeMap.java:1081)
at java.util.TreeMap.put(TreeMap.java:459)
at java.util.TreeSet.add(TreeSet.java:205)
Set forwardTraversalKeys = new TreeSet();
forwardTraversalKeys.add(KeyStroke.getKeyStroke('\t'));
forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEven
.VK_TAB,
InputEvent.CTRL_MASK));
textArea.setFocusTraversalKeys
(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
forwardTraversalKeys);
Set backwardTraversalKeys = new TreeSet();
backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEve
t.VK_TAB,
InputEvent.SHIFT_MASK));
backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEve
t.VK_TAB,
InputEvent.SHIFT_MASK |InputEvent.CTRL_MASK));
textArea.setFocusTraversalKeys(
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
backwardTraversalKeys);
Any idea???
PinI'm not using 1.4 but the class cast exceptions look like they come from : Set forwardTraversalKeys=new TreeSet() etc
try : TreeSet forwardTraversalKeys=new TreeSet()
you cant cast from a Set to a TreeSet because a TreeSet is a Set but a Set is NOT a TreeSet.
hope this helps.

Similar Messages

  • Which listener should I use?

    Now I want to listen the JFrame's location changing event. Which listener should i use?

    Add a ComponentListener to the JFrame

  • HT3669 which driver should i use for the epson LX300 matrix-dot printer??

    which driver should i use for the epson LX300 matrix-dot printer??? I dowloaded all drivers for epson but i didn't find the driver for the LX300.
    I bought an i mac not so long ago, can anyone help me about this?

    i use parallels desktop 7 because i use a program for work with windows XP. Is there really no solution?

  • Which operator  should i used for loading not matched records

    HI ALL,
    I am just evluate OWB tools.
    and i met a question.
    I need to join two tables A and B with Condition A.id=B.id
    For example,
    A has 1000 records, and B has 100 records,
    what i need to do is
    (1) to get matched 100 record from B to a new table C,
    (2)to get the not matched 900 records from A to another table D.
    By the requirement like above, which operator could i use for?
    I tried to use joined but can not get the record of (2).
    Thanks for your attention.
    Regards

    Hi,Sutirtha
    Thanks for your attention.
    because joiner has only one output group.
    so what you mean is use joiner operator twice?
    One joiner userd to get the matched records,
    and the other used to get unmatched records?
    Thanks
    Rachel

  • Which listener should be used in a standalone grid infrastructure env?

    gurus:
    I installed a 11.2.0.2 standalone grid infrastructure on a linux box and created a database manually. I then used netca to create my listener which created 2 listener files:
    a. under my DB home:
    aml6:/u00/app/oracle/product/11.2.0/dbhome_1/network/admin > cat listener.ora
    # listener.ora Network Configuration File: /u00/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    LISTENER_ETL =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = aml6.lynk.lynksystems.com)(PORT = 1521))
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    ADR_BASE_LISTENER_ETL = /u00/app/oracle
    b. under my grid home:
    aml6:/u00/app/11.2.0/grid/network/admin > cat listener.ora
    LISTENER_ETL=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ETL)))) # line added by Agent
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_ETL=ON # line added by Agent
    I observed that the one under my DB home was the one that really got used when I tried to logon to a database.
    Here are my questions:
    1. what is the use for the listener under my DB home?
    2. what is the use for the listener under my grid home?
    3. the grid infrastructure document says that the default home for listener and tnsnames files are grid home, however, it seemed that I have to use the listener under my db home directory.
    4. which listener is the ASM instance use?
    Thanks a lot for your help.
    dz

    Raj Mareddi wrote:
    Thanks Levi and Sebastian.
    We have separate listeners in DB homes for Stand Alone grids.
    Cluster Grids have got the listeners (SCAN..etc) running out of Grid Home. Still, we have exceptions for the Cluster grid for EBS databases where SCAN is not supported yet and still have a separate listeners for the databases.
    This OTN doc also describes a listener in the DB home: http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r2/prod/install/gridinstss/gridinstss.htm
    Hi Raj,
    In this OBE, the author explains why he is setting a new Listener for ASM.
    To Configure EM Database Control to manage ASM, perform the following steps:
    To manage the ASM instance in Enterprise Manager Database Control. you must configure the ASM Instance as a target.
    When you configure the ASM target, you must provide the port for the ASM listener.
    The Grid Infrastructure installs a listener by default on port 1521, and configures the ASM instance to use this listener.
    In this tutorial the database is already installed and has a listener configured on port 1521, the Grid Infrastructure places a listener on port 1522 and the ASM instance is registered with the grid listener.Before Install Grid Infrastructure he already had a database running with the Listener configured and running.
    To ensure that the service of ASM will be registered in the Listener of same release he set a new Listener using GUI HOME.
    This procedure is correct because the Grid Infrastructure (ASM) is the highest release (So, it's necessary configure Listener in same release), to not use a Listener with prior to release of the Grid Infrastructure(ASM) he created new Listener.
    He also could deconfigure the Listener of Oracle Home (database) and configure in the GUI Home. It's a matter of choice.
    Observing requirement of the paragraph below, we can set listener from anywhere there is no restriction, it is a matter of best practices only.
    The release of the listener must be the same as or later than the latest release of all Oracle databases being serviced through the listener.Cheers,
    Levi Pereira
    Edited by: Levi Pereira on Nov 8, 2011 4:23 PM

  • Which EBO should be used for employee absence data.

    Hi,
    We have the employee absences records in oracle ebiz which should be polled and send to a file.We have to implement this using AIA.Can anyone please tell me which EBO is used for this purpose.
    Thanks.

    Hi,
    I have the same requirement. Can you suggest which EBO did you use finally?
    Regards,
    Neeraj Sehgal

  • Which ID should I use for Family Sharing?

    My family has  the same iTunes ID (is this now called an iCloud ID??) so that we were able to share music. We logged into iTunes on our computers and our iphones with all the same iTunes ID.    We all have different Apple IDs and logged into our computers and iPhones with that ID.   How do I implement Family Sharing so that we still have the OLD music and shared app??  And which email address do I send the invitation?

    Hi gottalovemymac,
    When you join a family, you'll be asked to confirm the Apple ID that you regularly use for making iTunes, iBooks, and App Store purchases. Purchases from this account will be shared with your family members.
    That from 
    Sharing purchased content with Family Sharing
    It has more details too on setting up Family Sharing.
    You might also want to see
    Family Sharing
    Best Regards,
    Nubz

  • Difference between PDS and PPM and which one should be used for SNP /ppds?

    Hi Gurus,
                 Just wanted to know what are the difference between PDS and PPM ?
    1. For what industrial products we use PDS and PPM in SNP and PPDS?
    2. which one can be refered to clients?
    Please let me know it will be really great if anyone let me know the answers
    Thanks & Regards,
    Raj

    Hi Rajkumar,
    I have given below the detailed comparative account of PDS Vs PPM. Please copy and put it in an excel sheet in different columns and then read which is easy to understand.
    PDS
    1. Production Data Structure (PDS) in APO 3.1 & Run Time Object (RTO) in 4.0 and above versions
    2. Master Data Object
    3. Useful for scenarios where the compoenent has got different validity periods
    4. Used as Master data Basis for Planning in SAP-APO
    5. Contains active Master data from iPPE (Integrated Product and Process Engineering) generated from a production version
    6. PPDS PDS & SNP PDS can be used as master data for planning
    7. Change Management, variant configuration & Phantom assemplies are supported in PDS
    8. Sub-contracting in SNP is fully integrated with R/3 is supported in PDS
    9. Direct transfer of SNP PDS from R/3 is possible
    10.Rapid Planning Matrix can be generated
    11. Not possible to maintain PDS directly in APO and can be used only in combination with R/3
    12. The transfer of data changes is simpler
    13. Not possible to create alternate SNP-PDS in std system for different mode combinations
    14. PDS can be automatically generated from two sources ie R/3 and iPPE
    PPM:-
    1. Production Process Model
    2. Master Data Object
    3. Cannot be used for scenarios where the component has got different validity period
    4. Used as Master data Basis for Planning in SAP-APO
    5. Contains active Master data generated from the combination of routing (BoM & receipe) and production versions
    6. PPDS PPM & SNP PPM's can be used as master data for planning
    7. Not supported by PPM
    8. Not supported by PPM
    9. Not possible here. SNP PPMs will be generated via PPDS PPMs
    10. Not possible
    11. PPMs can be directly created in APO and can be modified without R/3 also.
    12. Little Complex when compared to PDS
    13. Alternate SNP-PPMs can be easily created
    14. PPM can be generated automatically generated only from R/3
    PDS is used in industries wherein there are multiple components or assemblies having diffeent production versions whose validity periods are different.  PPM is being used typically in process industries, chemical industries.  PPM is very simple in its usage and very flexible in operations in terms of modifications at APO level and can be referred to client depending on the business requirement
    Regards
    R. Senthil Mareeswaran.

  • Which software should I use for my Mac system

    I Am ready to purchase new software for my video production company and need to speak to someone to make the correct decisions...
    my questions entail, which products, which plugins which product is best suited for my Mac Maverick OS?

    A good place to start would be to ask a question on the Premiere Pro forum here:
    AdobePremiere Pro®

  • Which driver should I use for Oracle RAC .....

    We are using Weblogic 8.1 sp2 and Oracle RAC (9.x). Which driver , I should
    use : i.e.
    type 2 Orcle thin driver
    or
    type 2 Oracle OCI driver
    or
    type 4 oracle thin driver
    or
    Jdrivers
    or other which is best for this configuration .
    Sanjeev

    Thanks. I was unaware of that forum.
    Joe
    Galen Boyer wrote:
    On Tue, 06 Jul 2004, [email protected] wrote:
    Galen Boyer wrote:
    Joe, I have always suggested that people use the OCI driver
    unless it won't suffice based on distribution requirements.
    How come you choose the thin driver? Oracle will generally
    fix the OCI driver before the thin and the OCI driver will
    give far superior performance when dealing with LOBs.We have actually had faster response getting thin driver fixes
    than OCI-based fixes. Thats interesting. I'll take note of it.
    The 10g driver works with RAC, is much faster than previous
    drivers, and is easier to install etc. OCI users are often
    hopeful about TAF, which is broken and less-than-useless for
    active complicated JDBC applications. OCI problems can bring
    down the whole JVM and are harder to debug.
    These are from reading the results and recommendations of
    Oracle Corporation, Tom Kyte and other Oracle professionals.
    Have you research to say different? I'd like to see it,
    because up until now, I've always suggested OCI first unless
    the client doesn't have an oracle client installation
    available.Tom does an excellent job from the DBMS perspective, but I
    don't see him often in the jdbc arena.His Q&A site is littered with jdbc examples. He also will call
    on people in specific expertise to help him answer questions.
    Here an example of that where he show the OCI driver to be much
    more performant.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:9561536906412728184::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1004630777647,

  • Which cable should I use for a MacBook to external VGA monitor

    Hello everyone
    Having just come back to Apple, last having used a Apple 2E way back in the 70's, I've got to get used to non-IBM compatible stuff!
    Please advise which cable is needed to hook up to a standard IBM compatible VGA screen/cable.
    Also, will the same cable do for an overhead projector with a VGA input port.
    Thank you

    Hi and welcome to Discussions and welcome back to the Apple world,
    this are the tech specs of your MacBook http://support.apple.com/kb/SP579 so you need a MiniDisplayPort to VGA adapter like this one http://store.apple.com/us/product/MB572Z/A?fnode=MTY1NDA5OQ&mco=MTA4MzU1NDg for connecting your IBm display and your projector.
    Regards
    Stefan

  • Which Function Should i use for static values for a an array[] in BPM 11g.

    Hi Experts,
    Please throw some light on this..
    I've a requirement which is bugging me..
    How do i assign a static value to a array in BPM11g in script activity. What exactly function do i need to use to assign a Static value for an Array []
    I been doing like taking the business object as a Array thats fine. But how can i set a static value in BPM 11g.
    Iam using BPM 11.1.1.6 version..
    Regards,
    Pavan

    Hi Pavan,
    Here's one approach, but it assumes you're comfortable with XSDs and XML.
    Know this is light on detail, but without knowing what your array looks like it's the best I can do. Here's what you'd do from a high level:
    1. Create an XSD that defines the structure of your array.
    2. Create the XML that represents the static item you want to add to the array.
    3. Create a process variable based on the XSD that defined the array.
    4. Add a Script activity.
    5. Open the "Implementation" tab -> click "Data Associations".
    6. On the right, expand the folder under your process -> drag the XML icon in the upper right corner on the array variable -> paste your XML into the XML literal panel.
    Hope this gets you going,
    Dan

  • Which setting should i use for battery threshold.

    After reading almost everything regarding this topic, i still having hard time to decide.
    I'm using my W520 95% of the time on AC adapter,
    I should let the power manager "Maximum lifespan mode" decide or should i set the battery threshold on some specific percentage ?
    Thanks.
    W520 427637u

    Hi OrElm!
    Check these Knowledgebase articles:
    "How can I increase battery life?"
    "Why did my battery lose capacity?"
    "Why did my battery die?"
    "Should I run with my battery in or out?"
    Hope they help! Ask if more questions.
    I don't work for Lenovo. I'm a crazy volunteer!

  • Which codec should I use for web cam capture?

    I've got my new Live! Cam Voice up and running with my PC. It captures audio and video fine but when I load the video into Adobe Premiere for further editting, Premiere doesn't seem to like the codec I'm using (WMV-Window Media Video). Inside Premiere the video does not seem to play at full frame rate and when I render out an export (to an QuickTime .mov for example) also seems to be having trouble converting the WMV input to that format or any format for that matter.
    Any suggestions? Thanks.
    Message Edited by Castaa on 07-16-2006 05:34 PM
    Message Edited by Castaa on 07-16-2006 05:36 PM

    solace wrote:
    Hi...
    Which recording quality setting was used? Best quality? or any of the preset options listed? Alternati'vely, you might want to try the I420 color format. This can be selected within movie maker.
    Hi,
    I'm capturing video using the Windows Media Video (.wmv) using the high quality setting (640x480). I think pixel capture problem I discribed above might be releated to hard drive access while the camera is capturing. Compression is set to I420. Same problem with the other option (RGB 24).
    Here is a picture my corruption problem:
    *** http://home.pacbell.net/jcortel/corruption.JPG ***
    This problem happens randomly about every minute (on average) of captured video and only for a frame. The discolored line appears at different heights in the frame and it sometimes thinker than this example.

  • Which infocube should I use for Controlling and Inventory?

    Hi all,
    I have several questions regarding Controlling and Supply chain management infocubes:
    1. We need cost reports for the material ledger in order to meet the Brazilian compliance. I have found two infocubes:
    •CO-PC: Cost Object Controlling (0PC_C01)
    •CO-PC: Actual Costing / Material Ledger – Costs (0COPC_C02)
    What Infocube will help me to create a query that will meet our requirements? Which one is better?
    2.  We need a cost Center summary report, Expenses analysis, by product, cost center, business unit, region, plant, etc. and Expenses period comparison report. Which infocube will provide me that information for those reports, the CO-OM-CCA: Statistical Key Figures (0CCA_C03) or CO-OM-CCA: Costs and Allocations (0CCA_C11)?
    3. What infocube will be needed to generate an inventory report (raw material, semi and finished goods)? Is it the Material Stocks/Movements (as of 3.0B) 0IC_C03?
    Can I get an inventory report from the Purchasing data (0PUR_C01) infocube?
    Thanks a lot
    Vic

    Hi
    1)you need to check the requiered characteristics are available or not from these data sources which supply data to the above said cubes,,2
    2)0CCA_C11
    3)0IC_C03
    You cann't get the inventory report from the purchasing data(purchasing data always talks about the vendor supplying inventory,it never talks about the production inventory)
    Hope it helps
    Thanks
    Teja

Maybe you are looking for