Having problem in Displaying Text in textarea through a Thread.

Hi freinds,
I am not able to get the Text displayed in Textarea at the same time when it is appended to textarea from a thread.... all the text is displayed at a single go after the program finishes the execution.
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.awt.event.*;
public class BaseFrame extends JFrame implements ActionListener
     JComboBox Jbx = new JComboBox();
     JButton Bn1 = new JButton("Start");
     JButton Bn2 = new JButton("Restart");
     JButton Bn3 = new JButton("Stop");
     JTextArea Tx = new JTextArea();
     public BaseFrame()
          initProp();
          contents();
     protected void initProp()
          setSize(550,350);
          setVisible(true);
          setLocationRelativeTo(null);
          setResizable(false);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          getContentPane().setLayout(new SpringLayout());
     protected void contents()
          JLabel lbl= new JLabel("Select the Server : ");
          JScrollPane Js = new JScrollPane();
          JScrollPane Js1 = new JScrollPane();
          JPanel pn= new JPanel();
          Jbx.addItem(" ausserver");
          Jbx.addItem(" Inc2Server");
          Jbx.addItem(" Inc2NZL");
          pn.setLayout(new SpringLayout());
          pn.add(lbl,new SpringLayout.Constraints(
               Spring.constant(20),
               Spring.constant(20),
               Spring.constant(130),
               Spring.constant(25)));
          pn.add(Jbx,new SpringLayout.Constraints(
               Spring.constant(130),
               Spring.constant(20),
               Spring.constant(200),
               Spring.constant(22)));
          pn.add(Bn1,new SpringLayout.Constraints(
               Spring.constant(20),
               Spring.constant(50),
               Spring.constant(100),
               Spring.constant(22)));
          pn.add(Bn2,new SpringLayout.Constraints(
               Spring.constant(140),
               Spring.constant(50),
               Spring.constant(100),
               Spring.constant(22)));
          pn.add(Bn3,new SpringLayout.Constraints(
               Spring.constant(260),
               Spring.constant(50),
               Spring.constant(100),
               Spring.constant(22)));
          Js1.getViewport().add(Tx);
          pn.add(Js1,new SpringLayout.Constraints(
               Spring.constant(3),
               Spring.constant(80),
               Spring.constant(535),
               Spring.constant(238)));
          Js.getViewport().add(pn);
          getContentPane().add(Js,new SpringLayout.Constraints(
               Spring.constant(0),
               Spring.constant(0),
               Spring.constant(544),
               Spring.constant(324)));
          Bn1.addActionListener(this);
          Bn2.addActionListener(this);
          Bn3.addActionListener(this);
     public void actionPerformed(ActionEvent ae)
          if(ae.getActionCommand() == "Start")
               try{
                         Start();
               catch(IOException ie)
                    Tx.append("Cannot find File\n");
          if(ae.getActionCommand() == "Stop")
               try{
                         Stop();
               catch(IOException ie)
                    Tx.append("Cannot find File\n");
          if(ae.getActionCommand() == "Restart")
               try{
                         Stop();
                         Start();
               catch(IOException ie)
                    Tx.append("Cannot find File\n");
     void Start() throws IOException
          FileWriter wr = new FileWriter("dk.bat");
          wr.write("@echo off\n");
          wr.write("\"C:/Program Files/WebSphere/AppServer/bin/startserver\"" + Jbx.getSelectedItem());
          wr.close();
          Tx.append("\nStarting Server" + Jbx.getSelectedItem() +"\n");
          RunCmd rn = new RunCmd();
          rn.runComm("dk.bat");
          Tx.append("\nServer Restarted");
     void Stop() throws IOException
          char[] buf={1,2,3,4};
          String str=(String)Jbx.getSelectedItem();
          FileReader fr= new FileReader("C:/Progra~1/WebSphere/AppServer/logs/"
                                        + str.trim() +"/"+str.trim()+".pid");
          fr.read(buf,0,4);
          fr.close();
          System.out.println(buf);
          String str1=new String(buf);
          FileWriter wr = new FileWriter("dk.bat");
          wr.write("@echo off\n");
          wr.write("taskkill /pid " + str1 + " /f");
          wr.close();
          Tx.append("\nStopping Server" + str +" with Process Id " str1 "\n");
          RunCmd rn = new RunCmd();
          rn.runComm("dk.bat");
          Tx.append("\nStopped the Server");
     class StreamGobbler extends Thread
          InputStream is;
          String type;
          OutputStream os;
          StreamGobbler(InputStream is, String type)
               this.is = is;
               this.type = type;
          public void run()
               try
                    InputStreamReader isr = new InputStreamReader(is);
                    BufferedReader br = new BufferedReader(isr);
                    String line=null;
                    while ( (line = br.readLine()) != null)
                         Tx.append(line + "\n");
               } catch (IOException ioe)
                         ioe.printStackTrace();
     public class RunCmd
          public int runComm(String str)
               int exitVal = 0;
               try
                    Runtime rt = Runtime.getRuntime();
                    Process proc = rt.exec(str);
                    StreamGobbler errorGobbler = new
                         StreamGobbler(proc.getErrorStream(), "ERROR");
                    StreamGobbler outputGobbler = new
                         StreamGobbler(proc.getInputStream(), "OUTPUT");
                    errorGobbler.start();
                    outputGobbler.start();
                    exitVal = proc.waitFor();
                    System.out.println("ExitValue: " + exitVal );
               } catch (Throwable t)
                    t.printStackTrace();
               return exitVal;
Kindly look into this ..if someone has a clue what is going wrong where....plz inform me...thanks in advance.

Use the "code" formatting tags when posting code so the code retains its original formatting.
I didn't really look at your code but this type of problem is usually caused by executing a long running task in the Event Thread. Therefore the GUI can't repaint itself until the long running task is finished. Solution is to create a separate thread for the long running task.
Something like this:
http://forum.java.sun.com/thread.jspa?forumID=257&threadID=437592

Similar Messages

  • Problem in Displaying text Variable

    Hi All,
    I have problem in Displaying text Variable in the column header.
    My requirement is as follows.
    Column Level:
    0Calmonth/Year
    Key figures
    Keyfigure1 - Current Month  - Text Variable1
    Keyfigure2 - Previous Month - Text Variable2
    Keyfigure3 - Previous Month - Same as Text Variable2 - Display same month
    So based on each 0Calmonth/year these three keygirues should display in Header section like.
    Selection screen
    0Calmonth/Year - 03.2005 - 06.2005
    Result should be for each month.
    0Calmonth/Year
    03.2005                                04.2005                              05.2005
    03.2005 | 02.2005 | 02.20005  04.2005 | 03.2005 | 03.2005 05.2005 | 04.2005 | 04.2005.
    I have created two text variable with Customer exit.But not able to show exact months in the header section.
    For first three columns months are coming exactly, but from fourth columns it should display next month, but it is not coming.
    I have tried to code, but not successfull.
    Please help me how to go about this.
    Will assign full points.
    Regards,
    Vijay

    hi
    Check here........
    Re: Customer Exist for "From Current Date To Month End"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Cal month
    it might helpful for you
    assign points if helpful

  • Hi I am having problem connecting my mac and iphone6 through AirDrop

    HI I am having problem connecting my mac and iphone6 through Air Drop

    You don't give any information about your Mac but note the quote below which states that it must be a 2012 or later model with Yosemite installed. The quote is from Mac Basics: AirDrop lets you send files from your Mac to nearby Macs and iOS devices - Apple Support which also contains some other things that may help.
    In order to transfer files between a Mac and and an iPhone, iPad or iPod touch
    your iOS device needs to include a lightning connector
    your iOS device needs iOS 7 or later installed
    your Mac needs to be a 2012 or later model with OS X Yosemite installed
    Your Mac and iOS device both need bluetooth and Wi-Fi turned on. You do not have to be connected to a specific Wi-Fi network.

  • Having problem at displaying RSS Feed

    Hi,
    I am having problem in displaying the RSS feeds at the Global homepage applet in Single tenant Pod. Are there any special settings required/ or could there be any restrictions? I tested the same in one of the multi-tenant pods and is working fine at the same network. However facing issue in displaying the same at Single tenant pod.
    Sample feed that I am trying to check: http://feeds.bbci.co.uk/news/rss.xml

    It doesn't show me any error message, it just displays the blank screen. Waited until the complete page loads, however still the same blank screen. When I access the same link in different tab (Not in OnDemand), can see the screen. What could be the problem?

  • Problem with displaying text in flash player

    I have flash player 10.2.152.26 and opera 11.01  installed.
    The problem is that text in flash is diplayed in an awful way like this:
    http://img651.imageshack.us/img651/6918/alljo.png
    And when i choose "settings" the window appears, but it doesn't react when I click on it.
    Can anyone help, please?

    Thanks for answering
    So you have IE8 and the hardware acceleration was able to be UNchecked and FP(Flash Player) is working properly with IE.
    In IE flash works fine with any settings.
    When I unchecked "Hardware acceleration" checbox in IE it also became unchecked in opera, but nothing changed in opera's behavior.
    When you don't use the Aero it's displayed correctly but the settings do not work. What settings are you referring to?
    It's about flash settings in Opera
    With aero: http://img443.imageshack.us/i/settingsh.png/
    Without aero: http://img816.imageshack.us/i/settingswoaero.png/
    In both cases the settings dialog is displayed like in the screenshots above, but when I click on checkbox/tabs/'close' button in it nothing happens. I can't change any settings or close it (dialog disappers only after reloading page)
    Just to sum up everything mentioned above:
    - In IE flash works fine regardless of any settings
    - In Opera text is displayed wrong when using windows aero, and without aero theme it's displayed correct
    - I didn't manage to make settings dialog work in Opera
    - When I change some flash settings in IE, they are also changed in Opera
    Now Flash Player works thru the browser, do you have perhaps have an addon that is conflicting? What Anti-Virus do you have Installed? Any addons of that?
    I have 7 extensions installed in Opera, I've disabled all of them, but nothing changed.
    I use Kaspersky Internet Security 2011, disabling it also gives nothing.

  • Problem in displaying text inside the item label - JFREECHART

    Hi All,
    I dont know whether this is the right place or not to post the queries related to jfreechart here .
    I am facing a problem in displaying the text inside the item label in jfreeChart. I am trying to print the text in 2 lines one below the other at the top of each bar in waterfall chart.
    Please find the code below in next post. The problem i am facing is it is neglecting the new line character . If any one knows how to display the text one below the other please help me out .
    Thanks in advance .
    Regards,
    Diw

    i am facing the problem in pasting the complete code as its exceeds the message text limitiation, please find the link below for the code .
    http://www.java-forums.org/java-2d/12087-problem-displaying-text-inside-item-label-jfreechart.html#post36648
    Early response will be appreciated . Thanks in advance
    Regards,
    Diw
    Edited by: Diw on Sep 30, 2008 11:15 AM
    Edited by: Diw on Sep 30, 2008 11:16 AM

  • I am having problems with small text size on AOL mail, and am using the latest version of Firefox.

    I am having problems with text size when using AOL Mail. I am using version 25.0 of Firefox. I did not have this problem in the past, but I suspect a change occurred with one of the Firefox upgrades. I do not have the same problem when using Internet Explorer.

    Could you start by resetting the zoom level on the page? To do that, you can either:
    * Press Ctrl+0 (that's a zero) on the keyboard
    * View menu > Zoom > Reset
    You also can use zoom to increase/decrease the size from there. This article describes the various mouse, keyboard, and menu methods: [[Font size and zoom - increase the size of web pages]].
    Any luck?

  • I am having problem with my imessages not going through

    I am having problems with my tx messages not going through.  some do and some don't

    Do you mean after a phone update? Do you mean just at home? Does it happen everywhere?  Do you have wifi turned on? If its on and your not connecting just clear out the connections (forget) then reset up the connections and see if that helps.  Did you get a Jelly Bean update? Many people have had wifi connections issues because your router is either outdated and not supported with the new os, or it needs a firmware update.  Post back with more information.

  • 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>

  • Smartform - problem in displaying text in a page

    Hi experts,
         I am developing an invoice printing in smartforms.Here i am facing one problem.
    i am displaying line items in a table in the footer window.In that table footer i am displaying some text (text contains 8 lines).
          Here if the number of line items are below 3 the text in the footer of the table printing correctly in the 2nd page.
         But if the number of line items are above 3 the text in the footer of the table in footer window is not printing correctly (4 lines in the text is printing in 2nd page remaining 4 lines are not moving to 3rd page).
    Regards,
    Navaneeth.

    Hi
    Generally we use MAIN WINDOW for printing the line itesm data which is not constant.
    Depending on lines it moves to next page.
    You are saying that you are using footer window. It seems that you have taken the height of that window as 3 Lines
    where you wants to print the lines if it is more than 3 ? naturally it goes to next page.
    So you increase the footer window height to a max of the line items, or reduce font.but even if it is not a constant data naturally it goes to next page.
    You have to use the footer window for printing some constant data in the footer like Signature, and address etc.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • X3 02 Having problem with display

    I tried to download a file from nokia website and all of a sudden my X3 02 is having display problem. it is flickering and very hazy. Can someone help me out.
    Regards
    Feroz Khan
    Moderator note:
    e-mail address removd - it is unwise to publish personal contact information on a public forum

    Do you mean an application from the OVI Store ? If so did you install it after downloading ?  Un-install that application    in that case and see if the problem goes away..
    --------------------------------------------------​--------------------------------------------------------​--------------------------------------------------​--If you find this helpful, pl. hit the White Star in Green Box...

  • Having problem in displaying the word doc

    Hi
    i am searching for text in local files by taking as inpt.i am getting the result like in 1st line requested srtring
    2nd line whre it occured in text and
    3rd line with hyper link
    when i click hyper link here i am able see the text file. so i have placed word doc too in my input.here i a getting first and 2nd line fine. when click the 3rd line (hyper link) it is not showing the out put properley.it is not displaying tables and screens.can we open the word file directley?
    i am using code here like this
    fis = new FileInputStream(aFile );
              byte[] contents = new byte[(int)aFile.length() ];
              fis.read( contents );
              String document = new String(contents, "UTF-8"); is this byte is problem here do i need to write diff code here
    any help from u guys

    HI thank u for u r reply
    my real problem is i am doing search using uima.i have been sending the text files as input.and i am getting result here. with the same code i am trying it for word doc also.
    here do i need to download this java 6 then use that desktop.open or can i use it directley. if u want i will post my entire code here

  • Having problem while connecting to SQL Server through a application

    hi guys ,
    having one problem while connecting to the SQL SERVER 2008 R2 through a application (Dynamics NAV), by using the concept of Linked Server.
    But one more thing , i am able to access that very SQL server through my app , when i am working locally , i mean to say that when i am working on the machine itself on which the server is installed then its working fine .
    But when i am working on another system the query doesn't work.

    by using the concept of Linked Server.
    Why through a linked server and not directly as a simple remote connection? I don't think you app is aware of linked server.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Problem in displaying text in smartform

    Hi,
    In my smartform, In a text element I have written a text like below.
    Reference Number ,,,, &v_ref& ,,,, Date Received ,,,,&v_date&
    Now v_ref can be max of 23 characters. When it is of 23 characters, it is showing fine in output.
    But when it is <23 i.e.10 or 11 characters, the allignment is misplaced. So I am thinking in that case
    I will append blank space after the value upto 23 characters. I have tried several ways to add blank
    spaces but in the output it is not considering the space and still the problem remains.
    I want you guys help to resolve my problem.
    Mainak

    Hi,
    For this there is Two solutions :
    1. Create One paragraph format in smart Styles by providing required Tab Spaces and assign it to Text node.
    2.Use a Template that contain two columns with required length.
    Better is Use Template for future modifications.

  • Since I upgraded FireFox to 3.6 the majority of my websites are having problems correctly displaying information. This is not happening in Chrome, Safari or IE8.

    The new version of Firefox appears to have display problems on both input fields and control button fields. The wording and button are completely out of alignment

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    See also:
    * http://kb.mozillazine.org/Website_colors_are_wrong
    * http://kb.mozillazine.org/Websites_look_wrong

Maybe you are looking for

  • Multiple Domains in a Single Server

    Hi: I have a requirement where two domains (at this time) need to be set-up in single server. Each domain need to have a Admin Server , OSB, SOA, OSR and OER as managed servers and each runs in different port. Each domain has it own schema, but share

  • Help on using Creditial Mapping

    i m using default credential provider, i need to test the working of it could any one plz tell the step by step procedure to assign mapping between WLS user and EIS user and check how it is working

  • Weird search bug

    This has only happened recently. I search for songs in my itunes library, search finds them but I'm not able to paly them once they've been found. if I want to play a specific song I need to select it manually. Anybody have this issue too?

  • FCP 6.02 keep crashing

    Does anybody have similar experiences on FCP 6.02 (of Final Cut Studio 2). We encounter very often crashing. When we were using FCP 5, everything works fine, until we upgraded to FCP 6.0. We have tried using OS X tiger (10.4.x) and Leopard (10.5.1) w

  • Garnishment Refund throu 3rd party

    Hello all, We are in ECC 6.0 We are processing the Garnishments through the 3rd party processing.  Every thing works fine. When a employee got a refund set through IT 216, (MG60/MG70), does this WT processed through the 3rd party process.