Help using find dialog box with JTextArea

Hi i am using JTextField and getting a file read and then displayed in JTextField. Now i have used a dialog box for finding string within that file displayed in JTextField. I want to make it such that it ignores cases while finding the string and also want to make find next available in Find dialog box.
My code is: -
* @author Administrator
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import javax.swing.*;
public class TextAreaEx extends JPanel implements ActionListener {
static JFrame fr;
JButton button1;
JTextArea tx;
TextAreaEx()
super(new BorderLayout());
tx=new JTextArea();
FileInputStream fis=null;
StringBuffer sb=new StringBuffer();
try{
fis=new FileInputStream("C:/customers.xml");
BufferedReader br=new BufferedReader(new InputStreamReader(fis));
String h="";
while((h = br.readLine()) != null) {
sb.append(h + "\n");
catch(Exception e)
{ e.printStackTrace();}
tx.setText(sb.toString());
button1=new JButton("Find");
button1.addActionListener(this);
add(button1,BorderLayout.PAGE_START);
button1.setFocusable(false);
JScrollPane p1=new JScrollPane(tx);
add(p1);
public static void createShow()
JFrame.setDefaultLookAndFeelDecorated(true);
fr=new JFrame("My Frame");
TextAreaEx ob=new TextAreaEx();
ob.setOpaque(true);
fr.setContentPane( ob);
fr.setSize(400,400);
// fr.pack();
fr.setVisible(true);
public static void main(String s[])
createShow();
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
public void actionPerformed(ActionEvent e) {
if(e.getSource()==button1)
String s=(String)JOptionPane.showInputDialog(fr,"FIND:\n","Find",JOptionPane.INFORMATION_MESSAGE,
null,null,null);
System.out.println(s);
String text=tx.getText();
int offset=text.indexOf(s);
System.out.println(offset);
tx.setFocusable(true );
tx.select(offset,s.length()+offset );

Sorry its not JTextField its JTextArea as mentioned in first line of first post.

Similar Messages

  • When I try to add an RSS or Atom feed, I get a dialog box with Open or Save instead of adding the feed to NewsFox like it used to do.

    With Firefox 4.x, when I added a feed, it would open NewsFox in a new tab, and bring up a dialog box with info about that feed. I would click on "test this feed" and it would put all available items into NewsFox. Now, I get this dialog box with Open or Save. If I click on Open (declaring Firefox as the preferred app), then it opens the feed itself, it doesn't add it to NewsFox. I've tried going into Options and about:config but don't see anything to change that would fix this problem. I tried Search in Firefox Help but no relevant threads came up.

    Thanks Cor-El. I already have it set to "Use NewsFox." I'm stumped.

  • How can i invoke a file chooser dialog box with out using input type=file

    how can i invoke a file chooser dialog box with out using <input type=file> can any one help me mail me to [email protected]

    You could use an applet...
    Or maybe Javascript has some way to do it.

  • Blank Dialog Boxes with PUSH ME blue buttons

    Greetings All,
    I'm a fairly experienced Mac User and have been a bit surprised recently to be getting blank dialog boxes with buttons. Could it be some sort of spyware hoping I'll just push the blue buttons?
    It seems to come up once my Mac has been on for a while.
    Today I clicked a link at a website I frequently visit. I did so in FIREFOX and it's one of the few sites I allow for pop up windows. The link doesn't lead to a popup, but it did in this case: a blank window with blank buttons.
    http://www.screenplayhouse.com/temp/blank.jpg
    I quit FIREFOX and won another such window. I logged out, logged in, and it's gone.
    Is there some utility I can open-- like Activity monitor-- and find out what these windows are attached to?
    Just curious,
    Me
    (I have two similar Macs but only this one seems to do it.)

    I would look in Console and see if anything is being reported as you're experiencing this. (Console is in the /Applications/Utilities/ folder). If something is, post it here.
    When the window is visible, switch to the Finder by clicking on its icon in the Dock. Then click onto the dialog to activate its window. See if the application name in the upper left corner changes when the dialog window comes forward. If it does, then it would most likely be the name of the application that's created the dialog. If it doesn't change, then it could be created by either the Finder or by an invisible background application whose LSUIElement is set to 1 so that it doesn't appear in the Dock or in the Force quit window (it should show in Activity Monitor though). To determine which one it is, do the following. Switch to another application, like TextEdit, by clicking on its icon in the Dock. Then click on the dialog window again to bring it forward. If the application name shown in the upper left still says TextEdit, then you know that the dialog is being created by a background application.
    If it is, Open Activity Monitor and change the scope to All Processes. Quit as many open applications as possible, and then bring the dialog forward again. A pulsating button should use a small amount of CPU usage, try to use that to help narrow down what process might be causing it. Also, most likely any application that's drawing a button will have the "/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/
    HIToolbox.framework/Versions/A/Resources/Extras.rsrc" file listed as an open file in the Open Files and Ports tab of an info window of Activity Monitor. (You can open an info window for an application by double-clicking on it in Activity Monitor).
    Hope this helps....
    Dual 2.7GHz PowerPC G5 w/ 2.5 GB RAM; 17" MacBook Pro w/ 2 GB RAM -   Mac OS X (10.4.6)  

  • Creating a dialog box with OK and Cancel buttons without OADialogPage

    Hi Experts,
    i want to create a dialog box for Delete Confirmation means after clicking on delete it should pop up a small dialog box with OK/Cancel buttons
    and need code for the same to handle the buttons.
    i have created with OADialogPage but its showing in a complete page but i want to show those buttons in a small box.
    Plz help.
    THANKS IN ADVANCE.
    Thanks
    Raja.

    Hi,
    I have not tried using javascript in destination URI as suggested by Mukul.
    I have tried the below code for opening a page as dialog box.
    You can try it for your requirement by creating a dialog page of your own, say XXDialogPage (with OK and Cancel button)
    StringBuffer l_buffer = new StringBuffer();
    l_buffer.append("javascript:mywin = openWindow(top, '");
    String url = "/OA_HTML/OA.jsp?page=/xx/oracle/apps/fnd/dialog/webui/OADialogPG";
    OAUrl popupUrl = new OAUrl(url, OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE );
    String strUrl = popupUrl.createURL(pageContext);
    l_buffer.append(strUrl.toString());
    l_buffer.append("', 'lovWindow', {width:500, height:500},false,'dialog',null);");
    pageContext.putJavaScriptFunction("SomeName",l_buffer.toString());
    In dialog page's controller, you can forward it to the page onc ethe user selects OK or Cancel.
    Pass the selected value back to the main page and further you can use it for deleting.
    Regards.

  • Move an application "pop-up" (dialog box) with keyboard possible?

    Is there a way to move an application's pop up (dialog box) with a keyboard command/shortcut? I had a situation where I was not connected to my 2nd monitor and an application popup box was opening on that 2nd (*not connected*) monitor.
    I hate to say this; but on a PeeCee, a user can move a window via the keyboard. Is this possible on a Mac? Thanks!

    no, it's not possible on a mac. if the popup open on the other monitor connect the second monitor and move the popup with a mouse. it should open on the main monitor form now on.
    If you don't have a second monitor at all do the following.
    1) goto System Prefs - universal access - enable access for assistive devices.
    Paste the following into Script Editor and press run. This will move all offscreen windows currently open on the second monitor to the main screen.
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 335px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    –– Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
    property processesToIgnore : {}
    –– Get the size of the Display(s), only useful if there is one display
    –– otherwise it will grab the total size of both displays
    tell application "Finder"
    set _b to bounds of window of desktop
    set screen_width to item 3 of _b
    set screen_height to item 4 of _b
    end tell
    tell application "System Events"
    set allProcesses to application processes
    set _results to ""
    repeat with i from 1 to count allProcesses
    set doIt to 1
    repeat with z from 1 to count processesToIgnore
    if process i = process (item z of processesToIgnore) then
    set doIt to 0
    end if
    end repeat
    if doIt = 1 then
    tell process i
    repeat with x from 1 to (count windows)
    set winPos to position of window x
    set _x to item 1 of winPos
    set _y to item 2 of winPos
    if (_x < 0 or _y < 0 or _x > screen_width or _y > screen_height) then
    set position of window x to {0, 22}
    end if
    end repeat
    end tell
    end if
    end repeat
    end tell
    </pre>

  • I've developed the problem that when I click on something I get a dialog box with a mess of stuff such as: Back,re;oad page ,Open in dashboard ,print page, etc. It's quite annoying!

    I have a problem that when I click on something I get a dialog box with Back,Reload page, Open in Dashboard,View Source Save page as ETC. I don't get the normal or expected respose to a simple "click". Another problem. For some reason the back and forth arrows it the tool bar of Safari have shifted from the upper left hand cornor to the uuuer rihht hand cornor.

    Something is seriously wrong then.  Did you move it?  There are several Library folders.  One of them should be inside your HOME folder.
    If WZZZ suggestion does not work, re-install your OS by using Mac OS X 10.6.8 Update Combo.  When done, repair permissions and restart your computer.

  • I get a dialog box with a copy of firefox is open and only one copy of firefox can be open at one time.

    I get a dialog box with the following: "a copy of firefox is open and only one copy of firefox can be opened at one time."
    I do not see where firefox is open.
    How do get back into firefox so that i can read the links that are in my emails?
    Thank you.

    Sometimes when FF is closing, not all of it shuts down properly.
    On Windows, start the '''Task Manager''' (Other systems may have
    different names and / or commands). Select '''Processes'''.
    Look down the list for Firefox. Right click and select '''End Task'''.
    If this problem keeps coming up, ask for more help.

  • Safari crashes when using the dialog box to import/save files, in facebook under windows 7

    I've encountered the following errors in some PCs, running Safari 5.1.7 in MS-Windows 7 Pro:
    Safari crashes when using the dialog box to import/save files. One doesn't have to actually upload or download any file, the mere invocation of the relevant dialog box brings down all open Safari windows after a couple of seconds.
    Errors displayed in the Event Log are:
    Όνομα ελαττωματικής εφαρμογής Safari.exe, έκδοση 5.34.57.2, χρονική σήμανση 0x4f982b5e
    Όνομα ελαττωματικής λειτουργικής μονάδας CoreGraphics.dll, έκδοση 1.87.0.0, χρονική σήμανση 0x4f9739a0
    Κωδικός εξαίρεσης: 0x40000015
    Μετατόπιση σφάλματος: 0x0013a762
    Αναγνωριστικό ελαττωματικής διεργασίας: 0x17f4
    Χρόνος έναρξης ελαττωματικής εφαρμογής: 0x01cded6b09576023
    Διαδρομή ελαττωματικής εφαρμογής: C:\Program Files\Safari\Safari.exe
    Διαδρομή ελλατωματικής λειτουργικής μονάδας:C:\Program Files\Safari\Apple Application Support\CoreGraphics.dll
    Αναγνωριστικό αναφοράς:ebe64ac9-595e-11e2-a977-0016356671d1
    System
    Provider
    [ Name]
    Application Error
    EventID
    1000
    [ Qualifiers]
    0
    Level
    2
    Task
    100
    Keywords
    0x80000000000000
    TimeCreated
    [ SystemTime]
    2013-01-08T06:45:00.000000000Z
    EventRecordID
    95609
    Channel
    Application
    Computer
    computername
    Security
    EventData
    Safari.exe
    5.34.57.2
    4f982b5e
    CoreGraphics.dll
    1.87.0.0
    4f9739a0
    40000015
    0013a762
    17f4
    01cded6b09576023
    C:\Program Files\Safari\Safari.exe
    C:\Program Files\Safari\Apple Application Support\CoreGraphics.dll
    ebe64ac9-595e-11e2-a977-0016356671d1
    and
    Ελαττωματικός κάδος (bucket) 2970527469, τύπος 1
    Όνομα συμβάντος: APPCRASH
    Απόκριση: Δεν υπάρχει
    Αναγνωριστικό Cab: 0
    Υπογραφή προβλήματος:
    P1: Safari.exe
    P2: 5.34.57.2
    P3: 4f982b5e
    P4: CoreGraphics.dll
    P5: 1.87.0.0
    P6: 4f9739a0
    P7: 40000015
    P8: 0013a762
    P9:
    P10:
    Συνημμένα αρχεία:
    C:\Users\username\AppData\Local\Temp\WER51A.tmp.WERInternalMetadata.xml
    Αυτά τα αρχεία μπορεί να είναι διαθέσιμα εδώ:
    C:\Users\username\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_Saf ari.exe_e273f639ef3d86d52c9d8e15dd2b42dce3e78061_1f86213d
    Σύμβολο ανάλυσης:
    Επανέλεγχος για λύση: 0
    Αναγνωριστικό αναφοράς: ebe64ac9-595e-11e2-a977-0016356671d1
    Κατάσταση αναφοράς: 0
    +
    System
    Provider
    [ Name]
    Windows Error Reporting
    EventID
    1001
    [ Qualifiers]
    0
    Level
    4
    Task
    0
    Keywords
    0x80000000000000
    TimeCreated
    [ SystemTime]
    2013-01-08T06:45:10.000000000Z
    EventRecordID
    95610
    Channel
    Application
    Computer
    computername
    Security
    EventData
    2970527469
    1
    APPCRASH
    Δεν υπάρχει
    0
    Safari.exe
    5.34.57.2
    4f982b5e
    CoreGraphics.dll
    1.87.0.0
    4f9739a0
    40000015
    0013a762
    C:\Users\username\AppData\Local\Temp\WER51A.tmp.WERInternalMetadata.xml
    C:\Users\username\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_Saf ari.exe_e273f639ef3d86d52c9d8e15dd2b42dce3e78061_1f86213d
    0
    ebe64ac9-595e-11e2-a977-0016356671d1
    0
    I have tried in-installing safari but it seems not to help. I have tried installing it to a third, newly installed pc and come to the same result.
    All PCs are fully up-to-date as it regards Microsoft and Apple patches. Any ideas as to why this might happen?

    Still having the same problem. Ever the optimist, I submit the following info.
    Error window screenshot can be found here: https://dl.dropboxusercontent.com/u/22465174/safari/safari_fail_01.JPG
    Enent log entry can be found here: https://dl.dropboxusercontent.com/u/22465174/safari/safari_fail_02.txt
    Version info can be found here: https://dl.dropboxusercontent.com/u/22465174/safari/safari_fail_03.JPG

  • Why I could not use "find my iPhone" with my Mac.?

    I can not open the icon of "find my iPhone" on my Mac..

    yes, I just can open a moment ago, thank you, but why let lost trace my iPhone while it stolen? any other way let me can find back the trace record? thanks!
    Apple Support Communities Updates <[email protected]> 於 2014年12月15日 下午10:12 寫道:
    You received a reply
    Barry Hemphill <https://discussions.apple.com/people/Barry+Hemphill?ac_cid=op123456> has replied to your question. You can view the full discussion <https://discussions.apple.com/message/27291392?ac_cid=op123456#27291392> in Apple Support Communities.
    why I could not use "find my iPhone" with my Mac.? <https://discussions.apple.com/message/27291392?ac_cid=op123456#27291392>
    Sign in to iCloud:
    https://www.icloud.com <https://www.icloud.com/>
    Then click on "find my." Find my iPhone must be turned on on the phone.
    Barry
    Correct Answer <https://discussions.apple.com/email/thread/6725298/correct/27291392> Helpful Answer <https://discussions.apple.com/email/thread/6725298/helpful/27291392>
    Use the buttons above to tell Barry Hemphill and the rest of the community if this reply solved your question or helped you get closer to finding a solution.
    To reply to Barry Hemphill, go to the discussion <https://discussions.apple.com/message/27291392?ac_cid=op123456#27291392> in Apple Support Communities.
    You are receiving this email from Apple Support Communities. You can change your email preferences in your Apple Support Communities Profile <https://discussions.apple.com/user-preferences!input.jspa>.
    TM and copyright © 2014 Apple Inc. 1 Infinite Loop, MS 96-DM. Cupertino, CA 95014.
    All Rights Reserved <http://www.apple.com/legal/> | Privacy Policy <http://www.apple.com/legal/privacy/> | Terms of Use <https://discussions.apple.com/docs/DOC-5952> | Apple Support <http://www.apple.com/support/>

  • How to Use Open Dialog Box, & Save Dialog Box

    Hi Frens,
    Can You tell me how can i use open dialog box, and save
    dialog box using Flex. Because there is no such components are
    given here.
    Also How can i Do when I click on some button, or some event
    Please tell me abt this, Thks in advance frens
    Ashish Mishra

    for input requested try this
    String ar = JOptionPane.showInputDialog("Please, enter artist name");for any sort of message box try this
    int answer = JOptionPane.showConfirmDialog(null, "Enter another record?",
                                "???",JOptionPane.YES_NO_OPTION);This might help you buddy.

  • Opening print dialog box with "Selection" printing enabled

    Hi all,
    I have a JTable in which I wan to print only selected rows. When I open the Print dialog box using printDialog() method of PrinterJob, the dialog opens with "Selection" option disabled.
    How can I enable this option ?
    How can I print my selection using the standard Print Dialog ?

    This I know.
    Let me refrase my question:
    I have a table with selected cells (Rows Cols
    whatever ...) I wish to open the print dialog box
    with Selection radio button enabled, such that when I
    will check it and click print, the selected table
    cell get printed.This I had understood.
    Let me refrase my reply:
    If you simply print a new table containing the selected data
    then you don't need to have the Selection radio button enabled
    in the print dialog box.

  • How to print a dialog box with all its components ?

    Hi !
    I've written an application.It has a dialog box [JDialog] containing following components:
    1) 2 JLabels.
    1) A JTextField.
    3) A JTable with some values.
    4) A JProgressBar.
    5) A JButton.
    6) An animated gif image.
    I want to print the dialog box with all its components exactly as the are [ Except the button & animated gif ].
    Would anybody please help me?
    My Operating System: Windows XP

    The article over at http://java.sun.com/developer/technicalArticles/Printing/Java2DPrinting/ has some helpful information on printing Swing components.
    It suggests creating a subclass of the JComponent that you want to print, and have it implement Printable interface.
    So, something like (note, uncompiled / untested code alert) :
    import java.awt.Frame;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.HeadlessException;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import javax.swing.JDialog;
    public class PrintableDialog extends JDialog implements Printable {
          * Or whichever constructor you need...
         public PrintableDialog(Frame owner, String title, boolean modal) throws HeadlessException {
              super(owner, title, modal);
          * Implementation of the Printable interface.
           public int print(Graphics g, PageFormat pf, int pageIndex) {
              if (pageIndex != 0) return NO_SUCH_PAGE;
              Graphics2D g2 = (Graphics2D) g;
              g2.translate(pf.getImageableX(), pf.getImageableY());
              getContentPane().paint(g2);
              return PAGE_EXISTS;
    }Cheers,
    John

  • Dreamweaver Help | Manage Sites dialog box options

    strJiveDescriptionhttp://helpx.adobe.com/dreamweaver/using/sites-dialog-box-options.html

    I haven't used IIS for a long time, so I can't give you a definitive answer  about virtual directories. I use Apache virtual hosts, and they work without problem in Dreamweaver, but that's been true for as long as I can remember. There was definitely nothing new added to Dreamweaver CS6 with regard to server-side integration.
    As for default documents, I've just checked Dreamweaver's Check Links Sitewide command. It doesn't support that type of link. However, it's an excellent suggestion for a future improvement. Why not file a feature request through the form at https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform ?

  • Can I use Find My iPhone with my Apple Watch?

    Can I use Find My iPhone with my Apple Watch? Is there an app for it on Apple Watch? Can I add my Apple Watch to my Find My iPhone Account?

    No. No. And No.
    You can 'ping' your phone and have it play a sound (even if it's muted) from the watch, but it must be in range... That's intended to help you locate it if it's nearby but you forgot where you put it, or it slipped behind a couch cushion or something.

Maybe you are looking for