What event should i use to make code execute whenever I type a letter?

This is what I'm trying and it makes an empty file, so I know that the code is executed at least once, but since the file is always empty, I don't think that I'm using the right method to get text out of the text pane.
private void jTextPane1PropertyChange(java.awt.event.InputMethodEvent evt)
String words;
FileOutputStream out;
PrintStream p;
try
words = new String(jTextPane1.getText());
out = new FileOutputStream("myfile.txt");
p = new PrintStream( out );
p.println (words);
p.close();
catch (Exception e)
System.err.println ("Error writing to file");
Edited by: hansbig on Jan 13, 2008 12:41 PM

PrintStream doesn't like the FileWriter, it's all squiggly. Oh, and I found the right event so that it updates every time i type a letter. So, what is this you say about making a FileOutputStream an attribute? I don't know what that means. I'm also not sure what you mean by listener, is that the PrintStream?
private void jTextPane1KeyTyped(java.awt.event.KeyEvent evt) {
FileWriter out;
PrintStream p;
try
out = new FileWriter("myfile.txt");
p = new PrintStream(out);
p.println (jTextPane1.getText());
p.close();
catch (Exception e)
System.err.println ("Error writing to file");}
}

Similar Messages

  • What setting should be used to make the smallest size quicktime video file.

    What setting should I use to make a small sized movie for my family that lives 1200 miles away. I am using the iSight with QT Pro 7.0.4 and will be emailing them via Apple Mail to my mom that uses the most current version of AOL for PC with a 1 Meg DSL connection. The reason I am emailing them is she does not have a camera to live chat.
    The first movie I tried was over 4 meg and these files have to go over the internet. It bounced back saying it was to big. It was only a minute long.
    Mac Mini 1.42 8X DVD+-RW Dual Layer 24X CD-RW 250 Gig Ministack Version 2   Mac OS X (10.4.6)   Apple Bluetooth keyboard 19" Nec VGA CRT Flat Screen 1 Gig Memory iSight

    Make your recordings and then open the QuickTime movie.
    Use the Share menu and choose the email small setting. You'll get an estimated file size in the dialog window.
    Your viewers must have QuickTime 7 installed to view these files.

  • What programs should I use to make an interactive ebook for ipad?

    What programs should I use to make an interactive children's ebook for ipad?

    Adobe has a DPS add-on for InDesign (http://www.adobe.com/products/digital-publishing-suite-single.html) and it handles all the page transitions as well as swapping between portait and landscape. I think the way most people work is the pages are built in inDesign and regions of animation from EA are added second. But if every page had full screen animation, I suppose you may want to build your pages in Edge first.

  • Quick question! What tool should I use to make this logo?

    I would like to know how to make the following image 1 to turn to image 2 ? What tool should I use? Thank you very much !

    Probably the quickest way would be to use Offset Path, that is if the original file is vector artwork.  Your two screen shot images do not match.  If your assignment is to recreate the "CNN" logo, you'd be best to start with the internal Stroke ( White ).  Use the existing artwork as a template Layer.  Draw on a separate Layer going by the existing artwork.  Simple Pen tool operation consisting of around eight anchor points.  Once you've established the most accurate Stroke rendition, copy the file using a different name ( CNN02.ai or similar ).  Outline the copy.  Then, use Offset Path for the outer Red ( save that as CNN03.ai ). Copying in sequential steps allows you to go back just in case something does not look right.  If accuracy is important, you'll have to resolve the "C" deviation you have right now.

  • What event should I use to grab the record count of a DataGrid?

    I have a "Go" button on a search form.  It works correctly, fetching records from a CF data service into a data bound DataGrid.  However, using the code shown below, the record count always shows zero.  I've tried putting the "..Provider.length" line shown below, into various events on the grid, so that it will always update the count at the correct time, but I get "null" object errors at run time. There seems to be no event that fires "AfterDataLoad".
                protected function btnGo_clickHandler(event:MouseEvent):void
                     getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);
                     tabSbjs.label = 'Subjects: ' + grdSBJs.dataProvider.length;    //  This always returns zero.  Why?

    For example, this doesn't work.  The grid is told to loaded data on line 1, but this must just be only a message send to the Flash Player 10, because the processing doesn't stop and wait for the loading of data to complete, it just continues on to line 2, at which point '...Provider.length' is always zero the first time through.   So... the NEXT time the user clicks the Go button, line 2 is processed for the DataGrid which is holding data from the PREVIOUS search, so it updates the tabSbjs.label with the count from the previous search, not the current search.  The count of records is always for the previous data set.
                protected function btnGo_clickHandler(event:MouseEvent):void
    1               getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);  // edtSrch.text
    2               tabSbjs.label = 'Subjects: ' + grdSBJs.dataProvider.length;                                                                            
    All I'm trying to do is (which seems like a very difficult thing to do in FB4):
    -Display a DataGrid popluated with data records
    -Display a count of how many records are in the data grid
    If I rely on CF9 functions, which can only return a single value, then I have to make two CF9  functions, with the exact same SQL, one that returns data, and one that returns a count of the records.... which is non-sensicle.
    There must be a simple way to do this, but I'm going around in circles.

  • What event should I use to remotely monitor a 2010 DAG failover occurence

    I have a 2 Exchange 2010 servers installed on Server 2008 r2. Both have all roles, one is used as the primary server and the second is a passive back up. My question is about how to monitor when a database fails over to my passive server. It seems like there
    should be an event logged, probably on the server that is taking the active copy since in theory the other one is non responsive for one reason or another. I've dug through the logs and I've found some events that seem to occur around that time, but nothing
    that definitely says that a failover has occurred. Can anybody point me towards a reliable method of monitoring this?
    Thank you in advance, Joel

    A number of event logs can fire when there is a failover, but the most commons ones are: 
    Alternatively, test in the lab and grab the events as you bounce servers.
    Log Name: Application 
    Source: MSExchangeIS 
    Date: 
    Event ID: 9796 
    Task Category: General 
    Level: Warning 
    Keywords: Classic 
    User: N/A 
    Computer: 
    Description: 
    Database "<Database" has been subject to a lossy failover. The database may be patched if the Information Store detects it is necessary.
    and 
    Log Name:      Application 
    Source:        MSExchangeRepl 
    Date:          
    Event ID:      2099 
    Task Category: Service 
    Level:         Information 
    Keywords:      Classic 
    User:          N/A 
    Computer:      
    Description: 
    The Microsoft Exchange Replication Service requested that Hub Transport server ...
    and
    Event ID: 2153
    Source: MSExchangeRepl
    The log copier was unable to communicate with server ''. The copy of database ' is in a disconnected state. The communication error was: An error occurred while communicating with server ''. Error: Unable to read data from the transport connection: An established
    connection was aborted by the software in your host machine. The copier will automatically retry after a short delay. 
    Event ID: 4082
    Source: MSExchangeRepl
    The replication network manager encountered an error while monitoring events. Error: Microsoft.Exchange.Cluster.Replay.AmClusterApiException: An Active Manager operation failed. Error: An error occurred while attempting a cluster operation. Error: Cluster API
    '"OpenCluster() failed with 0x6d9. Error: There are no more endpoints available from the 
    Twitter!:

  • We love apple email, but it does not play wall with other venders when you want to use your own domain (lags, disconnections, etc.)?   What vendor should we use to make it push and work well?  We want to stay with Apple Mail.

    Help, our AppleMail does not play well with other Vendord to use our own domain.   iCloud mail works great, but so far others we have tried lag, disconnec, etc. not nearly as good as icloud mail.   Should we try exchange or office 365 plans with Apple Mail/  a lot more expensive?

    Microsoft Exchange is the best business solution, Office 365 will give a hosted version that works well, as you noted it is not the cheapest. You should also look at Zimbra, an excellent service.

  • What software do I use to make cd/dvd labels?

    I enjoyed using iDVD to put together a slideshow for an 80th birthday party.  Now I want to share the slideshow on dvd's, but what software should I use to make dvd labels and jewel case covers?

    I agree 100% with Klaus1. You don't want to use stick on labels. If you have an Epson R series printer you can print directly to discs with it. 
    For printing on discs or making case inserts/covers one application that I like is Discus.  Here are some of the designs I've created and used with it:
    Click to view full size
    OT

  • What t_code should be used for migration?

    Hello there,
    our user wants to  migrate  "output vat" account after being audited.
    actually , they start using SAP from 1st. January.2009 but now needs to migrate for reconciliation purpose.
    Journal should be 40) output VAT   /      50) Beginning Balance-BS.
    Since this output VAT does not need any tax code and base amount, i think normal FI transaction like F-02 is not an answer.
    Furthermore, LSMW is not strongly recommended at this time, considering line item to be created.
    Could you let me know what t_code should be used for this case?
    BR.
    J.
    Edited by: Jimmy Choi on Jun 30, 2009 5:41 PM

    Hi
    Note down the G/L accounts you are posting.
    Option 1 :In OBD4 see the account group. change the tax category mandatory to optional field for running the lsmw. afte completion, set the status as earlier.
    Option 2: goto fs00-> see the field status group.-> double click on the FSG-> see the taxes -> make the fields optional.
    with regards
    siva
    Edited by: Siva Rama Krishna Yanamandra on Jul 2, 2009 1:12 AM

  • Azure and Unity Master Server What Service Should I Use?

    Hi all!
    This is a noob question. I never buy cloud service before. I want to know, if I want to host my own Unity Master Server (an exe file as server) what service should I use? (Virtual Server? Mobile Services? Cloud Services?)
    Really glad if someone can give a little explanation what they differ from each other in the simplest and practical way.
    Thank you before.

    Hi Sir,
    Thanks for your posting!
    Form your description, Would you want to deploy your exe file on Azure call it as a service on client? In your scenarios, I think VM and cloud service could meet your requirement.
    Please see this code sample about host exe file on azure cloud service :
    http://www.codeproject.com/Articles/331425/Running-an-EXE-in-a-WebRole-on-Windows-Azure
    For hosting on VM, You could see this post:
    http://stackoverflow.com/a/12385238
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • What time should I use clone method?

    Hi everyone:
    There is a problem puzzled me all the time. You know,If I want to use a object I could use the code:
    Class A=new Class(); I get a object A so I can use it. But there is a method called "clone".It's function is copy a object.But Why jdk have this method.Is there any useful ?
    I mean that what situation should I use the "clone " method?
    Thks!

    a regular clone copies all members of an object by reference. You can implement the Clonable interface to provide a clone which makes a 1:1 copy of your object, so no references are copied over. This ensures that the objects don't share the same objects, but do have the exact same content.

  • I feel I must move beyond iMovie, what program should I use ?

    I have been happily using iMovie and iDVD from versions 1 through 6.  iMovie 08 was so bad that Apple made iMovie 06 available as a free download for buyers of iMovie 08. The newer iMovies were better, but they seemed “dumbed down” (even for me).  Now, I am shocked and horrified to learn that the latest iMovie does not even set chapter markers!
    So, I have continued to use iMovie 06 and iDVD 08 (they seem to work fine under OS 10.9.4).   iMovie 06 is now 8 years old!  I feel compelled to move forward. A lot of my work is DV.    In the past, most of my source material came out of S-Video.   I used a Canopus ADVC300 analog-to-digital converter that gave good results.   Going forward, I will have more video utilizing Component Video, or HDMI.
    I am looking into 2 possibilities,  Adobe Premiere elements 12, or.........Final Cut Pro X.
    The final result of my work is almost always a DVD.   It is hard for me to move from iMovie and iDVD.  I never read the manuals for either program, yet,  I was able to produce DVDs with nice menus and overall quality close to Hollywood.
    It looks like Final Cut Pro X 'can' make a DVD directly without other software.  However, from what I have seen on YouTube the result is primitive compared to what iDVD was doing 10 years ago.
    Adobe Premiere elements 12 can make nice DVDs and Blu-ray's directly.  I have no problem with using a separate program to make DVDs but I haven't got a clue how to do that with Final Cut Pro X.   I suppose I can still use iDVD, but now I'm back to using discontinued software.
    I do not need any of the high-powered affects capability that Final Cut Pro X  possesses.  My “movie-making” is mostly confined to simple editing (the old iMovie 06 did all I needed).
    Frankly, one motivation for choosing Final Cut Pro X, is the excellent, compassionate and understanding support that the kind people on this very forum provide.  So, what program should I use?

    Ziatron wrote:
    ...  I am shocked and horrified to learn that the latest iMovie does not even set chapter markers!
    .. I am looking into 2 possibilities,  Adobe Premiere elements 12, or.........Final Cut Pro X.
    The final result of my work is almost always a DVD. ...
    ... I do not need any of the high-powered affects capability that Final Cut Pro X  possesses.  My “movie-making” is mostly confined to simple editing (the old iMovie 06 did all I needed).
    to turn perspective for a second by 180°:
    Why do you want to switch to a new editor anyhow?
    • iM-a never did discs - that was iDVDs job = no big change in your workflow
    • iDVD is still working, and aside obsolete, complex and $$$$ DVDSP (part of obsolete FC/p) or Encore (part of Adobes CC rent package) your only option left to create disks on MacOS is indeed iDVD (...ok, there's Toast and Burn and some weird 'shareware'-stuff...)..
    • iMovie-b supports the new HDef formats (AVCHD) - you mentioned converters and DVDs = no HDef in use, in your habitat, correct?
    • if you don't need FCPX' bling-bling (I can't imagine that ) - why not using FCPX-lite = iMovie? 15$ ...
    • chapters could be done in iDVD - just to mention that ............
    • AP and FCPX are following very different concepts in usage - my personal preference is 200% on FCPX, … I was one of the loudest nay-sayers, when iM08 araised, meanwhile, FCPX is my dream!! AP (tested it) is way too complex, crowded, 'optionalized' and did I mention 'complex' for me. A bit like Windows vs. MacOS: 'everything goes' (incl. getting lost) vs. 'convenience' (incl. restrictions) ... After 2y of practice, I'm editing my weekly hobby-projects with 6-cam-Multicam, incl. tons of  custom graphics, slow-mow, effects (soccer games) in less than 2h ... awesome!
    summary:
    • why switching?
    • use iMovie10 + iDVD
    • Premiere (or Premiere Elements!) and FCPX are both avail as fee trial ... test  it - but you need iDVD anyhow
    • 'disks'  is a dwindling niché, for years!- consider to switch to 'other' distribution options
    ... what are 'chapters' anyhow??... (kid din'!)

  • What query should I use to find all versions of Office 2013 64-bit installed on client computers?

    What query should I use to find all versions of Office 2013 64-bit installed on client computers? Could someone create a custom query? I need all of the client computers names and which ones have any Office 64-bit components. Thank you so much! I really
    appreciate it!

    Hi,
    You could edit the following query to meet your requirement.
    SELECT     dbo.v_R_System.Name0, dbo.v_GS_OPERATING_SYSTEM.Caption0 AS [Operating System],
                          dbo.v_GS_OPERATING_SYSTEM.CSDVersion0 AS [OS Service Pack], arp.DisplayName0,
                          CASE WHEN arp.version0 LIKE '11.0.6361.0' THEN 'SP1' WHEN arp.version0 LIKE '11.0.7969.0' THEN 'SP2' WHEN arp.version0 LIKE '11.0.8173.0'
    THEN 'SP3' WHEN
                           arp.version0 LIKE '12.0.6215.1000' THEN 'SP1' WHEN arp.version0 LIKE '12.0.6425.1000' THEN 'SP2' WHEN arp.version0 LIKE '14.0.6029.1000'
    THEN 'SP1' ELSE '' END
                           AS 'Service Pack', arp.Version0
    FROM         dbo.v_Add_Remove_Programs AS arp INNER JOIN
                          dbo.v_R_System ON arp.ResourceID = dbo.v_R_System.ResourceID INNER JOIN
                          dbo.v_RA_System_SMSInstalledSites AS ASSG ON dbo.v_R_System.ResourceID = ASSG.ResourceID INNER JOIN
                          dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID = dbo.v_GS_OPERATING_SYSTEM.ResourceID
    WHERE     (arp.DisplayName0 LIKE '%Microsoft Office%edition%' OR
                          arp.DisplayName0 LIKE '%Microsoft Office Standard 2007%' OR
                          arp.DisplayName0 LIKE '%Microsoft Office Enterprise 2007%' OR
                          arp.DisplayName0 LIKE '%Microsoft Office Professional%2007%' OR
                          arp.DisplayName0 LIKE '%Microsoft Office Standard 2010%' OR
                          arp.DisplayName0 LIKE '%Microsoft Office Enterprise 2010%' OR
                          arp.DisplayName0 LIKE '%Microsoft Office Professional%2010%' OR
                          arp.DisplayName0 LIKE 'Microsoft Office 2000%' OR
                          arp.DisplayName0 LIKE 'Microsoft Office XP%') AND (arp.DisplayName0 NOT LIKE '%update%') AND
                          (arp.DisplayName0 NOT LIKE '%Microsoft Office XP Web Components') AND (dbo.v_R_System.Operating_System_Name_and0 NOT LIKE '%server%')
    AND
                          (arp.InstallDate0 NOT LIKE 'NULL')
    ORDER BY dbo.v_R_System.Name0, arp.DisplayName0, arp.Version0
    Full details:http://social.technet.microsoft.com/Forums/systemcenter/en-US/7baeb348-fb63-4115-8d76-2c884d18f708/sql-query-to-check-ms-office-service-pack-level?forum=configmgrreporting
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • What component Should I use?, Jpanel doesn't work

    Hi
    I need a program that has a window that can go fullscreen and windowed (I did that with a Jframe in fullscreen mode with a jpnale and a 800x600 Jpanel and destroying them with an object that maneges them), I did it with a jframe that contained a Jpanel, I used a Jpanel to avoid the flickering on the screen but I also need to change the font type and the font size, but the setFont on the Jpanel doesn't change the font (as I have realized and also read here [http://forum.java.sun.com/thread.jspa?forumID=257&threadID=150588] ), so I'm lost, I might have to redo the whole thing, but I just wanted to know what component should I use for a window that is going to have custom graphics and need diffrent fonts and diffrent font sizes and work in fullscreen without flickering
    Thank you for your attention, I would aprecciate any help given

    for example:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JSlider;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class JPanelFont extends JPanel
      private Font font = getFont();
      private String myString = "Fubars Rule";
      private int fontSize = font.getSize();
      private JSlider slider = new JSlider(0, 100, fontSize);
      public JPanelFont()
        setPreferredSize(new Dimension(620, 250));
        setLayout(new BorderLayout());
        JPanel inputPanel = createInputPanel();
        add(inputPanel, BorderLayout.SOUTH);
      private JPanel createInputPanel()
        JPanel ip = new JPanel();
        slider.setMajorTickSpacing(20);
        slider.setMinorTickSpacing(5);
        slider.setPaintTicks(true);
        slider.setPaintLabels(true);
        ip.add(slider);
        slider.addChangeListener(new ChangeListener()
          public void stateChanged(ChangeEvent evt)
            fontSize = (Integer)slider.getValue();
            repaint();
        return ip;
      @Override
      protected void paintComponent(Graphics g)
        Graphics2D g2 = (Graphics2D)g;
        Object originalHint = g2.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        super.paintComponent(g2);
        myPaint(g2);
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, originalHint);
      private void myPaint(Graphics2D g2)
        font = font.deriveFont(Font.BOLD, fontSize);
        g2.setFont(font);
        g2.drawString(myString, 20, 100);
      private static void createAndShowUI()
        JFrame frame = new JFrame("Dynamic JPanel Font");
        frame.getContentPane().add(new JPanelFont());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowUI();
    }Edited by: Encephalopathic on May 21, 2008 9:18 PM

  • What program do I use to make mailing labels?

    I can no longer use Apple works for my mailing list.  What program should I get to make mailing labels, and how can I convert my old .cws databases to create mailing labels?
    Extremely frustrated with OpenOffice!!!

    I could not convert the database file from Appleworks, but I did get LibreOffice which is a free program, and it does open the old Appleworks files, and will convert them to .csv which can then be imported into "Contacts".  (create your new group in Contacts first, and import it into that)  LibreOffice might be able to convert into mailing labels, but I sure couldn't figure it out.  So I had to pull the .csv file into "Contacts".  Then from the print window, I can choose the options to print labels and it works. 

Maybe you are looking for