Problem with gettin text from a new window

Hi
I have been trying to for sometime to work out why i cant get this to work...I open a main window which opens a new window when a button is pressed. This window has a text field where data can be typed, it has a button called "Send" which then allows the data to be send. However, when "Send" is pressed, a NullPointerException is throwen in the ActionListener because it is unable to get the text from the text field.
Anyone got any idea why, have done a small mock up just to give an example :
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
public class TwoWindows implements ActionListener{
     private JTextField chatLine;
     public volatile boolean start = false;
     //******************************GUI Production******************************
     public TwoWindows() {
          JFrame frame = new JFrame("Multicast Discovery");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JPanel connectpanel = new JPanel();
          JButton button3 = new JButton("Open New Window");
          button3.setActionCommand("connect");
          button3.addActionListener(this);
          connectpanel.add(button3);
          frame.getContentPane().add(connectpanel, BorderLayout.PAGE_END);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
     //*****************************action listener******************************
     public void actionPerformed(ActionEvent ae)
          //get what button was pressed
          String button = ae.getActionCommand();
          if (button.equals("search"))
               System.out.println("\n Do Something!");     
          else if (button.equals("cancel"))
               System.out.println("\n Do Something else!");     
          //start new window here
          else if (button.equals("connect"))
               setupChat();
          if (button.equals("send"))
                if (start)
                          //try to get the data from the new window
                          String s = chatLine.getText();
                          System.out.println("This has been inputted : " + s);
     //*****************************setup new window*****************************
     public void setupChat()
          JFrame frame01 = new JFrame("TCP Chat Window");
          frame01.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          // Set up the chat pane
             JPanel chatPane = new JPanel(new BorderLayout());
            JTextArea chatText = new JTextArea(10, 20);
        chatText.setLineWrap(true);
        chatText.setEditable(false);
        chatText.setForeground(Color.blue);
        JScrollPane chatTextPane = new JScrollPane(chatText,
        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        JTextField chatLine = new JTextField("Type Here!");
        JButton button4 = new JButton("Send");
          button4.setActionCommand("send");
          button4.addActionListener(this);
          chatPane.add(chatLine, BorderLayout.CENTER);
          chatPane.add(button4, BorderLayout.SOUTH);
         chatPane.add(chatTextPane, BorderLayout.NORTH);
          chatPane.setPreferredSize(new Dimension(200, 215));
          frame01.getContentPane().add(chatPane);
          frame01.pack();
          frame01.setLocationRelativeTo(null);
          frame01.setVisible(true);          
          start = true;
     public static void main(String[] args)
     new TwoWindows();
}

public class TwoWindows implements ActionListener{
     private JTextField chatLine;
     public volatile boolean start = false;
     public void setupChat()
JTextField chatLine = new JTextField("Type
ld("Type Here!");
You have two variables called chatLine. One is a class field the other is a local object in setupChat.
Change
JTextField chatLine = new ...
to
chatLine = new ...

Similar Messages

  • A problem with copying text from english pdf to a word file

    i have a problem with copying text from english pdf to a word file. the english text of pdf turns to be unknown signs when i copy them to word file .
    i illustrated what i mean in the picture i attached . note that i have adobe acrobat reader 9 . so please help cause i need to copy text to translate it .

    Is this an e-book? Does it allow for copying? It is possible that the pdf file is a scan of a book?

  • Problem with the text from previous year in current year appraisal (PPR)

    Hi Gurus,
    I have some problem with the text from the PPR of the previous year in the PPR current year.
    The text from the previous year have not the same displaying in the tab "previous year" of  the current year PPR.
    EXAMPLE :
    this is write in the PPR of year 2009 in Individual Targets without Incentives (tab My S-imple) :
    -Aufrechterhaltung der MA motivation, in dieser Zeit der Neuorientierung.
    -G1 Unterstüzung
    -Fachübergreifende Teamarbeit ausbauen
    Gefährdungsbeurteilung weiter führen
    -tragen von PSA einfordern
    -VI Opt.(Intervalle)
    -Azubi und Praktikanten AUsbildung unterstüzen
    and this is what I have in the PPR of 2010 in Individual Targets without Incentives (tab Previous Year's Targets):
    -Aufrechterhaltung der MA motivation, in dieser Zeit der-Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    -Aufrechterhaltung der MA motivation, in dieser Zeit der
    there is the error, all the end of the text isn't displayed and the begin of the text is repeated.
    I think that this issue is created at the creation of the PPR.
    If someone have a idea he is welcom.
    thanks and regards

    Hi,
    Please follow the note:425601,
    Go to Tcode: OBA5 change the error messge into warning message. carry out the settlement and roll abck the warning message into the error message after sucessfull settlement.
    Reward points if found useful.
    Thanks!

  • Problem with reading text from .DOC files through java and POI

    I have used a jar file "poi-scratchpad-3.2-FINAL-20081019.jar" and "poi-3.2-FINAL.jar" to read text from a .DOC file. I used the "getParagraphText()" function of the class "org.apache.poi.hwpf.extractor.WordExtractor" to get the text.
    I am able to get the text in the .DOC file but along with that i am getting the following messages/warnings
    Current policy properties
    *     thread.thread_num_limited: true*
    *     file.write.state: disabled*
    *     net.connect_ex_dom_list:*
    *     mmc.sess_cab_act.block_unsigned: false*
    *     mmc.sess_cab_act.action: validate*
    *     mmc.sess_pe_act.block_blacklisted: false*
    *     mmc.sess_pe_act.block_invalid: true*
    *     jscan.sess_applet_act.stub_out_blocked_applet: true*
    *     file.destructive.in_list:*
    *     jscan.sess_applet_act.block_all: false*
    *     file.write.in_list:*
    *     file.nondestructive.in_list:*
    *     window.num_limited: true*
    *     file.read.state: disabled*
    *     jscan.session.origin_uri: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/poi/poi/3.2-FINAL/poi-3.2-FINAL.jar*
    *     file.nondestructive.state: disabled*
    *     jscan.session.user_ipaddr: 10.136.64.153*
    *     net.connect_other: false*
    *     thread.thread_num_max: 8*
    *     file.destructive.ex_list:*
    *     file.nondestructive.ex_list:*
    *     file.write.ex_list:*
    *     jscan.sess_applet_act.sig_invalid: block*
    *     file.read.in_list:*
    *     mmc.sess_cab_act.block_invalid: true*
    *     jscan.session.policyname: TU1DIERlZmF1bHQgUG9saWN5*
    *     mmc.sess_pe_act.action: validate*
    *     thread.threadgroup_create: false*
    *     net.connect_in_dom_list:*
    *     net.bind_enable: false*
    *     jscan.sess_applet_act.sig_trusted: pass*
    *     jscan.session.user_name: 10.166.64.201*
    *     jscan.session.user_hostname:*
    *     file.read.ex_list:*
    *     jscan.sess_applet_act.sig_blacklisted: block*
    *     jscan.session.daemon_protocol: http*
    *     net.connect_src: true*
    *     jscan.sess_applet_act.unsigned: instrument*
    *     mmc.sess_pe_act.block_unsigned: false*
    *     file.destructive.state: disabled*
    *     mmc.sess_cab_act.block_blacklisted: true*
    *     window.num_max: 5*
    Below the above messages/warnings the data is getting printed. Only the text part of the data is retrieved not the fonts, styles and bullets etc.
    Can anyone explain me why I am getting above warnings and how can I remove them. Is it possible to fetch the text depending on delimiters.
    Thanks in advance,
    Tiijnar
    Edited by: tiijnar on May 21, 2009 2:45 AM

    The jar files which were used are downloaded from http://jarfinder.com. Those jars created the problem of displaying those messages on console. I downloaded APIs from apache.org and used them in my application. Now my application is running good.
    Tiijnar

  • Problems with displaying text from gtk+-2.0 with Cairo

    I've got a 64-bit app that uses gtk+-2.0 (2.8.17 with Cairo). I had to build my own libraries since the gtk+-2.0 libraries Solaris 10 ships with is 32-bit only (and does not contain Cairo support). The app is statically linked so that our customers don't have to do any more than just install the app.
    I've got a customer who's using a Sun Ray 2fs to run our app from a Sun Ray server. The problem is that none of the text in the UI is readable (including the menubar). He sent a screenshot and I can tell it's rendering the glyphs, just not correctly. The best way of describing the text rendering problem is to take a bitmap of antialised text drawn with a black pen color. Now remove all non solid black pixels. You only see pieces of the glyphs (typically, just the vertical and horizontal parts).
    We don't have a Sun Ray client to test with but for testing purposes, I installed our app on freshly built Solaris 10 (5/09) and Open Solaris systems with no modifications to the virgin systems. I could run our app on both Solaris systems and display the app on a remote X display just fine. I asked the customer to try a real X display and he ran X-Win32 on a Windows XP guest using VirtualBox on the Sun Ray server and our app appeared just fine on his Sun Ray client. I told him if our app displays just fine on a real X display, then the problem must be with the Sun Ray server.
    Has anyone encountered this problem? I'm going to try building the latest gtk+-2.0 libraries but I'm not convinced it's going to do any good. I don't think it's a Fontconfig configuration problem because our app worked out of the box on freshly installed systems (unless perhaps Sun has made changes to /etc/fonts/fonts.conf since the version on his system versus ours).
    PS. We actually need the Cairo graphics support. It just happens that the version of Pango that's in 2.8 (and all versions of gtk+-2.0 since) also uses it for text rendering in the widgets.

    Garrett Cobarr wrote:
    > I have been attempting to import text from Illustrator
    CS2 into Flash 8. I
    > would like to retain the layers if possible.
    >
    > I am having many different problems as I have
    experiemented at the AI side.
    > One is having the text come in with the outline offset
    and no longer alligned.
    > When I drag and drop, the outline completly dissappers.
    The text when it does
    > come in is converted to a png and longer has the layers
    seperated.
    >
    > I am also getting a message in the report window, on
    some of my tries, that it
    > is an improper PDF.
    >
    > The bottom line question is: What is the recommended
    method of importing text
    > from AI CS 2?
    You have to remember that both programs are totally different
    animals and simply
    some of the option used by you in AI won't be working or
    can't be translated into
    flash's environment. You will never get editable content,
    just an image.
    Export to SWF from AI and import that SWF to flash. Should be
    as close as possible
    to original file tho I can't assure your layers will
    maintain.
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Flash CC Air iOS: Problems with loading text from an external xml located on a server.

    So I have this code allowing me to load text from an xml located on a server. Everything works fine on the Air for Android. The app even works in the ios emulator, but once I export my app to my ios device with ios 7, I don't see any text. The app is developed with Air sdk 3.9. What could be the reason? Do I need any special permissions like on Android? Does ios even allow to load xml from an external server?
    Any clues?

    It was my bad. I linked to a php file to avoid any connection lags, which was absolutely fine on the android, but didn't seem to work on the ios 7. So all I did is change the php extension to xml and it worked without any problems.

  • TS1717 are there problems with iTunes upgrading from Vista to Windows 7?

    are ther problems upgrading iTunes from Vista to Windows 7?

    The best method is to use Windows Easy Transfer first to backup all your data, and do custom clean install. And install all your apps and drivers afterwards.
    Yes it should work. Make sure you are ready, and have all the latest drivers and applications ahead of time.
    There are some "gottchas" with the upgrade from Vista.

  • Problem with a navigation from a Popup Window in an other Window

    Hi Experts,
    i have a problem with a popup window. I explain my problem. I have a DC Component in which there are two different Windows (MainWindow and PopupWindow) and one of this Window is a popup Window. I desire to navigate from the popup window to the main window of the component. Is there a way to accomplish that ?
    I have created the popupWindow and it works very good.
    Thanks a lot for your help.
    Gregorio Perillo
    Edited by: GregorioPerillo on May 28, 2010 5:45 PM

    Hi ,
    By using this code you have to Open Popup Window
    public void popup( )
    //@@begin popup()
    poplink=wdComponentAPI.getWindowManager().createModalWindow(wdComponentAPI.getComponentInfo().findInWindows("Wd_POPupwindow"));
    poplink.setWindowPosition(500,30);
    poplink.open();
    //@@end
    Wd_POPupwindow-- This is Window Name Under this window you can create in View that view having OK and Close Buttion.
    When click on Submit button that time you call the popup method. that time you will get popup window
    Regards
    Vijay Kalluri

  • Installation problem with CS5.5 on my new Windows 8.1 laptop

    I downloaded CS 5.5 Design Premium to my new Windows 8.1 laptop. When launching the Set-up.exe file I get the error message "Installer Failed to Initialize. One or more files could be missing."  I downloaded the Adobe Support diagnostic tool but it did not help. I think the new IE version could have disabled or blocked some files? Please help.

    I'm having the same issue as BioTrak - I'm also not sure if I downloaded from the correct option, as it looked different from a previous download. But when I try to install, it says the same error message, and the Adobe Support tool does not provide a solution.
    I know that doesn't answer your question, but yeah... this is what the file looks like, and I try to open the setup file.

  • Problem with imported text from quark

    Hi everyone
    I have imported files from quark version 4 off a mac to Indesign cs4 on a windows PC. everything is fine apart from the text being a little messed up so i am happy enough with that. The problem is that when i drag and drop or copy and paste into a new document all the images will move over but new text will not work with the images.
    By this i mean that when i try to type something over or near the graphics the graphics just vanish! you can drag them over the image and they vanish, then when you drag them away again them reappear!
    Also the shapes that i move over have a thin white border on them where as the shapes that i create directly do not have this boarder.
    Any help that you cold give me on this would be great!
    Thanks in advance!!
    Sam

    Thats it thank you!
    There was a text wrap applied to all the graphics. its working perfectly now!!
    Thank you again!!!
    Sam

  • How can I solve the problem with copying text from Google Documents?

    Ctrl+C and Ctrl+X are not always working in Google Document opened with Mozilla Firefox 30. This problem first occurred 2 days ago. No changes to the software were made.
    The problem is not stable and permanent. I can successfully copy several lines from document and paste them somewhere else. And suddenly the next one is not copied using ctrl+c. Even ctrl+x is not working until I change the selection of the lines. Sometimes it begin to work after changing the selection, sometimes not.
    I'm using Google Documents for a long time. I always use Firefox to work with them. And I've never had this problem before.

    This problem happens for me as well. I can copy/paste from Firefox initially, but then after pasting elsewhere the Firefox page has to be refreshed in order to copy something else....

  • E71 problem with recieving text from international...

    I have purchased a nokia e71 10 days back.everytime someone tries to send me a message from india or any other country i dont recieve it.any body any ideas how to fix it?

    The jar files which were used are downloaded from http://jarfinder.com. Those jars created the problem of displaying those messages on console. I downloaded APIs from apache.org and used them in my application. Now my application is running good.
    Tiijnar

  • Solution Center problem with HP Office Jet J4550 and windows 7 (64bit)

    Hello All,
    I have a problem. I have the Solution Center and a HP Office Jet J4550 and windows 7 (64bit). When ever I open the solution center, the solution center says " HP office jet J4550 series disconnected" When I open HP document manager, I can access the printer.  Additionally, when I run the HP Print Diagnostic Utility 4.0, it sees the printer, no issues. I can print test pages. No issues. I downloaded the latest driver from the HP site (OJJ4500_Full_13, 299,359KB) Your insight is appreciated.
    Thank you
    Roy B

    I have a similar problem with the J4580 and my new Windows 7 64-bit laptop.  HP Solution Center says that the printer is disconnected.  Furthermore, it can print some documents (short ones), but it was unable to print a 1-page 5MB pdf file.  The printer truncated the page after printing just the top 10%.   The printer is OK with my wife's Windows 7 32-bit laptop.
    I've seen many other people complain about similar problems in this and other forums.  Apparently the driver for J4500 printers is not compatible with Windows 7 64-bit.  Can HP please provide an updated driver or patch?

  • Indesign CS3-JS - Problem in reading text from a text file

    Can anyone help me...
    I have an problem with reading text from an txt file. By "readln" methot I can read only the first line of the text, is there any method to read the consecutive lines from the text file.
    Currently I am using Indesign CS3 with Java Script (for PC).
    My Java Script is as follows........
    var myNewLinksFile = myFindFile("/Links/NewLinks.txt")
    var myNewLinks = File(myNewLinksFile);
    var a = myNewLinks.open("r", undefined, undefined);
    myLine = myNewLinks.readln();
    alert(myLine);
    function myFindFile(myFilePath){
    var myScriptFile = myGetScriptPath();
    var myScriptFile = File(myScriptFile);
    var myScriptFolder = myScriptFile.path;
    myFilePath = myScriptFolder + myFilePath;
    if(File(myFilePath).exists == false){
    //Display a dialog.
    myFilePath = File.openDialog("Choose the file containing your find/change list");
    return myFilePath;
    function myGetScriptPath(){
    try{
    myFile = app.activeScript;
    catch(myError){
    myFile = myError.fileName;
    return myFile;
    Thanks,
    Bharath Raja G

    Hi Bharath Raja G,
    If you want to use readln, you'll have to iterate. I don't see a for loop in your example, so you're not iterating. To see how it works, take a closer look at FindChangeByList.jsx--you'll see that that script iterates to read the text file line by line (until it reaches the end of the file).
    Thanks,
    Ole

  • Problems with importing text messages from PC Suit...

    Problems with importing text messages from PC Suit 7.1.18.0 to my Nokia 5800
     I am trying to import a csv file that contains text messages (Note that this file was created using PC Suit 7.1.18.0) to a subfolder that I have created to My Folders but PC Suits only imports the text messages to the Draft folder. Note that initially it shows that the messages are import in the correct folder but after a refresh it shows them in the Draft Folder. Is their any setting that I should change in the PC Suit or the phone? My computer runs on Windows XP Service Pack 3 and the Nokia 5800 was upgraded to the latest firmware v20.0.012
     Thanks for your help

    Most phones only allows importing of draft and archived box for SMS.
    To do a restoring, you need to backup the SMS as a .nbu file using PC Suite and restore later.
    If you got an SD card, you can also do a backup on the SD Card (backup.arc) then restore later (reset and restore: backup.arc and mmc).
    What's the law of the jungle?

Maybe you are looking for

  • Can not view video in email

    Does anyone have any idea why i cant view a video sent from a email the link doesnt even show up , i know you cant view a video in a instant message which is crazy the cheapest phones out there do it but apple dont Iphone 3g Thanks joe

  • Audio Configuration!! helppp

    ok so i already posted but i cannot find my post... but i'm getting the popup saying my itunes cannot play cause there's a problem in audio configuration. i've restarted my computer... i've uninstalled and reinstalled both quicktime AND itunes... i'm

  • Want to know the table names as well as number of rows

    hi...every one.....i want to explain more in detail to previous thread i have posted. actually i need to display all the table names and number of rows for each, in a schema(like AP,HR,....) it's must that i should do it by using a stored procedure.

  • ABAP RFC WebService

    Hi I have a RFC with a different name space for example /TESTNM/Z_RFC_TEST . WSDL generates an operation as below -TESTNM-Z_RFC_TEST Because of the "-" the Java Client proxies giving compilation problems . Does any one encountered this problem before

  • I AM SICK OF IT!!!

    Hi all, I am running Safari 4.05 on Snow Leopard. Every web site i go on, i get a certificate pop up. for example if i go on facebook i get a certificate from Equifax. if i go on sky i get one from doubleclick. every web page i go on i get a certific