Help with displaying output of javac

Hi, I got some code from this forum that helped me
to implement buttons with Action for compiling java code. Any output or exception generated can be displayed to JTextArea.
However, just found out the code I got hangs in cases
when there seems to be lots of exception in source code. (i.e. Nothing displayed on JTextArea )
I list the code below, can someone tell me what I need to do to display output in JTextArea properly??
/* Usage
java OutputCapture javac MyClass.java
java OutputCapture java MyClass
import java.io.*;
import java.util.*;
import javax.swing.*;
public class OutputCapture {
public static void main(String[] args)
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JTextArea tArea = new JTextArea("",8,20);
tArea.setLineWrap(true);
tArea.setWrapStyleWord(true);
JScrollPane pane = new JScrollPane(tArea);
panel.add(pane);
frame.getContentPane().add(panel);
frame.setSize(300,300);
frame.setVisible(true);
String runString = "c:\\java\\bin\\"+ args[0]+ ".exe " + args[1] + "";
String output;
try
Process p = Runtime.getRuntime().exec(runString);
Vector streams = new Vector();
streams.addElement(p.getInputStream());
streams.addElement(p.getErrorStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(new SequenceInputStream(streams.elements())));
while ((output = reader.readLine()) != null)
tArea.append(output + "\n");
reader.close();
catch(Exception e) { e.printStackTrace(); }
</pre>
* Can someone please list the code for displaying
output of compiling/runnning app with Runtime.exe()
command in JTextArea properly? (this is driving me
nut)
Thanks
Okidoki

Hi
I tried your code and it still doesn't work.
It simple hangs there now without output to
screen. Can you be more specific? I have
provided your code below and a class with
bug to be compiled by your code.
Can you show me how the output of compiling can
be shown to screen or to a file through
your method?
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class Exec {
     public Exec(String app) throws Exception {
          Process process = null;
          //final OutputStream out;
          final InputStream err, out;
          process = Runtime.getRuntime().exec(app);
          //out = process.getOutputStream();
          out = process.getInputStream();
          err = process.getErrorStream();
          Runnable r = new Runnable() {
               public void run() {
                    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
                    try {
                         while(true) {
                              int i = out.available();
                              int j = err.available();
                              if(i > 0) {
                                   byte[] b = new byte;
                                   out.read(b);
                                   //System.err.write(b);
                                   System.err.println(b);
                              if (j > 0) {
                                   byte[] b = new byte[j];
                                   err.read(b);
                                   //System.err.write(b);
                                   System.err.println(b);
                         } // while
                    } catch (IOException e) {
                         System.err.println(e);     
          new Thread(r).start();
          process.destroy();
     public static void main(String[] args) {
          try {
               //String s = "c:\\JBuilder5\\jdk1.3\\bin\\javac.exe FontColorDialog.java";
               String s = "c:\\JBuilder5\\jdk1.3\\bin\\javac.exe test2.java";
               new Exec(s);
          } catch (Exception e) {
               System.err.println(e);
//==================================
// Testing class
//import javax.swing.*; // Uncommented here on purpose
public class test2 {
     public static void main( String args[] ) {
          System.out.println("Hello World!");
          JTextField jtf = new JTextField();
          System.out.println("Font: " + jtf.getFont().toString() );
Thanks

Similar Messages

  • Help with DIgital Output Array with 6062E DAQ CARD...

    Good morning, folks... I need some help with digital output of the 6062E PCMCIA card... I can output 1 line without problems... I need to control a 4066 with my digital outputs... I am doing this without greater problems... but there's something... I need that when one of my outputs is high, the others become low, unchangeably... so I tried to use an array to control my output and I couldn't do that... some errors showed up... can you help me please? Maybe there's any errors at my software, then I thank you if you help me... the vi is anexed...
    Best Regards...
    Attachments:
    Untitled 3.vi ‏20 KB

    See below for one of many methods. Change the "lines" string for your setup.
    Also, please explore the Examples that ship with LabVIEW, and read your card's manual.
    Richard

  • Help with display quality (LCD TV)

    I've hooked up my Mac mini to my Samsung 32" LCD TV via HDMI cable.
    The overall quality is just far from desireable and is taking away all of the fun from using this new mac.
    I set the resolution output to 720p, which is what the TV supports. So that's good.
    I played slightly with the Contrast and Brightness on the TV settings.
    But I must be missing something. Although the image is sharp, it's very difficult to read from 6ft away, pictures look terrible (seeing the same picture on a different computer and monitor is so much more revealing), and the display is bad for everything basically.
    Please help with any settings suggestions or perhaps a detailed guideline for my setup.
    I started to configure a color profile on the display settings but the results weren't that great and I reverted to default. Too many subtle changes. My colorblindness probably doesn't help.
    Thanks.

    Thanks for the response.
    It's the latest Mac Mini with 2.5ghz i5, AMD Radeon HD 6630M, and 8GB RAM.
    I am familiar with the "Just Scan" setting under picture size on the Samsung TV.
    I'll look for the digital noise reduction.
    Are there complete guides with recommended settings for different setups? Or maybe even general, that would help me here?
    Thanks.

  • Help with Cisco Output Interpreter tool!!

    Hi All,
    I am experiencing a problem with Cisco Output Interpreter tool.
    While the tool is working fine and displaying the "CONFIGURATION COMMAND REFERENCE  NOTIFICATIONS (if any)" very effectively but I am unable to use the hyperlink to get an understanding about a particular command.
    When I click on a particular command(hyperlink) it pops up another window and the below error is displayed.
    Not Found
    The requested URL /cgi-bin/Support/Cmdlookup/ios-command-lookup.pl was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Anyone else had/have this particular error. Could you please help me with this.
    Apologies if  this topic does not belong to this group.
    Thanks in advance
    Sam

    Noone to help me on this?

  • Help with display settings needed urgently

    Graphics and icons that are supposed to be round appear oval. For instance the Safari and App icons on the dock appear very oval. Logos on websites I've visited before and I know are round appear oval.
    I've tried all display settings and nothing helps. I'm a designer and this is causing a major hinderance. Everything appears condenced / squashed sideways. I'd be very grateful if someone could help with this.
    I've just purchased the laptop. I have been using Mac for a few years and I've always selected the "stretched" option from the Display settings which sorted out the problem completely. A circle looked a proper circle. But in this version the option is not available.
    Badly hoping someone can help with this.
    Thanks.
    Version Details - OS X Lion 10.7.4

    It sounds like you have selected an incorrect resolution.  For starters, are you talking about your Air's display or an external display?  You haven't said which Air you have.  If you have an 11" model, make sure your display resolution is set to 1366x768.  If you have a 13" model, it should be set to 1440x900.  These are the proper resolutions for the built in displays.  Chosing anything other than the referenced "native" display resolutions will result in distortions or clarity problems. 

  • Help with display of numbers

    First of all I have to say the tutorials on this site are extremely helpful. My instructor wants all our java code written as Object Oriented and when I did a search on here for Object Oriented it totally helped out. Now I just need help with the display of numbers, my code works perfectly fine except that the number has wayyyyyyyyyyy to many decimal points after it. I only wanted two.
    public class Mortgage
         double mtgAmount;
         double mtgTerm;
         double mtgRate;
         double monthPymt;
              public void Amount(double newValue)
                     mtgAmount = newValue;
              public double Amount()
                   return mtgAmount;
              public void Term(double newValue)
                     mtgTerm = newValue;
              public double Term()
                   return mtgTerm;
              public void Rate(double newValue)
                     mtgRate = newValue;
              public double Rate()
                   return mtgRate;
              public void calcmonthPymt(double newValue)                            //(LoanAmt * Rate) / (1- Math.pow(1+Rate,-Term));
                     monthPymt = (newValue);
              public void display()
              System.out.println ("The Mortgage Amount is:" +(Amount( ) * Rate( )) / (1- Math.pow(1+Rate( ),-Term( ))));
         public static void main (String[] args)
                     Mortgage Mortgage1=new Mortgage();
                     Mortgage1.Amount(200000);
                     Mortgage1.Term(360);
                     Mortgage1.Rate(.0575);
                     Mortgage1.display();
    }

    I figured it out, the math is wrong I think but I got everything to display correctly
    import java.io.*;
    import java.text.*;
    import java.text.DecimalFormat;
    public class Mortgage
         double mtgAmount;
         double mtgTerm;
         double mtgRate;
         double monthPymt;
         DecimalFormat money = new DecimalFormat("$0.00");
              public void Amount(double newValue)
                     mtgAmount = newValue;
              public double Amount()
                   return mtgAmount;
              public void Term(double newValue)
                     mtgTerm = newValue;
              public double Term()
                   return mtgTerm;
              public void Rate(double newValue)
                     mtgRate = newValue;
              public double Rate()
                   return mtgRate;
              public void calcmonthPymt(double newValue)                            //(LoanAmt * Rate) / (1- Math.pow(1+Rate,-Term));
                     monthPymt = (newValue);
              public void display()
              monthPymt = (Amount( ) * Rate( )) / (1- Math.pow(1+Rate( ),-Term( )));
              System.out.printf("The payment amount is:$%.2f", monthPymt);
              System.out.println();
         public static void main (String[] args)
                     Mortgage Mortgage1=new Mortgage();
                     Mortgage1.Amount(200000);
                     Mortgage1.Term(360);
                     Mortgage1.Rate(.0575);
                     Mortgage1.display();
    }

  • Help with displaying image received from socket on Canvas

    Dear programmers
    I know that I'm pestering you lot for a lot of help but I just got one tiny problem which I just can't get over.
    I'm developing a remote desktop application which uses an applet as it's client and I need help in displaying the image.
    When a connection is made to the server, it continuously takes screenshots, converts them to jpg and then send them to the client applet via socket communication. I've got the the server doing this in a for(;;) loop and I've tested the communication and all seems to be working fine. However the applet is causing some issues such as displaying "loading applet" until I stop the server and then the 1st screenshot is displayed. Is there a way to modify the following code so that it displays the current image onto a canvas while the next image is being downloaded and then replace the original image with the one which has just been downloaded. All this needs to be done with as little flicker as possible.
    for(;;)
        filename = dis.readUTF();
        fileSize = dis.readInt();
        fileInBuffer = new byte[fileSize];
        dis.readFully(fileInBuffer, 0, fileSize-1);
        //Create an image from the byte array
        img = Toolkit.getDefaultToolkit().createImage(fileInBuffer);
        //Create a MyCanvas object and add the canvas to the applet
        canvas = new IRDPCanvas(img, this);
        canvas.addMouseListener(this);
        canvas.addKeyListener(this);
        add(canvas);
    }

    Anyone?

  • Help with display glith using JList

    Hi, first post so bit of background - I'm teaching Java at the moment, am fine with command line but am dabbling more with Swing, despite certain glitches I always get ( e.g. the 7-segment display last year) but anyway....
    I've been trying to develop a little app that picks random boxers for a computer game. My current problem is that i am trying to add custom boxers and then update the JList and repaint the frame. When I add a boxer i can see it adding to the list, however it is unreadable and displayed too small.
    Forgive any bad coding etiquettes - its very much a work in progress from a relatively poor programmer ;)
    theBoxers is a JPanel containing the JLists, aWindow is the JFrame, customButton is a button to add a custom fighter - this gets a name from a field, and a weight from a combo box, adds it to an array and then attempts to add it to an array, then re-generate the lists
    customButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                        addCustom(customCombo.getSelectedIndex(),addCustomName.getText());
                             System.out.println(customCombo.getSelectedIndex() + addCustomName.getText());
                             theBoxers.repaint();
                             aWindow.repaint();
    public void addCustom(int theWeight, String theName)
              switch(theWeight)
                   case 0:          featherCustoms[featherCustomsSize]=theName;
                                  featherFighters = new JList(featherCustoms);
                                  featherCustomsSize++;
                                  break;
                   case 1:          lightCustoms[lightCustomsSize]=theName;
                                  lightFighters = new JList(lightCustoms);
                                  lightCustomsSize++;
                                  break;
                   case 2:          welterCustoms[welterCustomsSize]=theName;
                                  welterFighters = new JList(welterCustoms);
                                  welterCustomsSize++;
                                  break;
                   case 3:          middleCustoms[middleCustomsSize]=theName;
                                  middleFighters = new JList(middleCustoms);
                                  middleCustomsSize++;
                                  break;
                   case 4:          lightHeavyCustoms[lightHeavyCustomsSize]=theName;
                                  lightHeavyFighters = new JList(lightHeavyCustoms);
                                  lightHeavyCustomsSize++;
                                  break;
                   case 5:          heavyCustoms[featherCustomsSize]=theName;
                                  heavyFighters = new JList(heavyCustoms);
                                  heavyCustomsSize++;
                                  break;
                   default:     System.out.println("Not Added");
                                  break;
         }

    Awww, its nice that DB has someone to comeback and carry on a discussion.....long after its over.
    The problem here seems to be your lack of understanding between what a teacher or what an 'instructor' is.
    From the way you speak, an instructor appears to be someone who is technically skilled in both coding and teaching Java as a programming language, designed for people who wish to code in Java.
    A Teacher is someone who must deliver a wide range of subject knowledge to a wide range of abilities, including those who were unable to pass High-School exams. They are responsible for pitching the subject at the correct level for the student, whilst also teaching towards passing the exam, and ultimately gaining a qualification.
    The computing course i am currently teaching does not require OOP, but as Java is the language i was taught at University, and is still often used in our University's, I chose it. I don't pretend to be the best programmer in the world. But I do know that I am teaching the pupils the correct basics, at a higher level than is probably required, to give them the right approach at university. also, this is whilst teaching a large amount of theory.
    Whether you agree, or disagree, matters not to me as I think you would be unfamilier with the specification I am currently teaching to, or what area's of study need to be taught. The exam board appears happy, as do past students who are now well into their university course, as did my marker when i achieved my degree.
    The code posted in the OP (as stated earlier) had nothing to do with displaying my coding abilities, nor did it display the technique's I use when teaching students. It was a small sample of a program which included a JList which was not displaying properly. I tried to include the whole code but it was too big, therefore it was cut down.
    It was a work in progress which i now have working. So now i can look at it again in terms of programming structure. It appears I have made a mistake asking for assistance on here, as instead I got a lecture, with very little insight on your part as to my situation or the nature of the problem/solution.
    At the end of the day, each to his/her own opinion. What I will say is that when someone requests help, positive feedback/criticism is well recieved along with instructions/guidance on how the problem can be solved. I feel that I received none of this on here, but this is what I will always provide to the students I teach.
    Not everyone is a full-time Java programmer or has the time to hit the highest expectations.

  • Help with widescreen output on SD

    I'm finishing up a wedding and just wanted to make sure I understand this correctly.
    If I want a film that was filmed in Widescreen (16:9), edited in widescreen, how do I use compressor to make sure this fillm is playable on both 4:3 and widescreen TVS?
    1) Film in widescreen
    2) Edit in widescreen
    3) Send to compressor with what options?
    4) In DVD Pro, make sure what options are checked?
    This would be considered anamorphic, correct (both playable in widescreen and 4:3 formats)?
    I would like for it to automatically display the black bars for SD TVs, and not for regular widescreen TVs.
    Thanks a ton in advanced guys!

    3) Send to compressor with what options?
    Export your timeline as QuickTime Movie current settings (self contained is my favorite flavor, if you have space). That gives you a same quality movie that your timeline to use in Compressor from outside FCP.
    Use any "DVD: .... 16:9" Compressor presets, depending on your footage lenght and envode your audio to Dolby 2.0 (AC3).
    In DVDSP, set your 16:9 tracks/menus with Display Mode : 16:9 Letteerbox (never use Pan&Scan at least your movie has that information).
    That way your DVD will play automatically full screen in widescreen TVs and letterboxed in 4:3 sets.
    Remember that some weird TV & DVD player settings made by the user can override that automatic playback, but that's something you cannot take control of.
    Hope it help!
      Alberto

  • Help with query output

    Hello, I have the following query that I'm running in Oracle SQL Developer 1.2.1
    WITH group_by_4_column_results AS
    (SELECT m_atschunk.employee AS employee,
    SUM(CASE
    WHEN
    M_ATSCHUNK.rolloffDaysCount = '108545043' AND m_atschunk.infractiondate BETWEEN SYSDATE - 365 AND SYSDATE THEN 1 ELSE 0 END) as rolloffs,
    M_ATSCHUNK.INFRACTIONDATE + 365 as infractionDate
    FROM M_ATSCHUNK
    group by employee, infractionDate, rolloffDaysCount
    SELECT g4.*,
    SUM (rolloffs) OVER (PARTITION BY employee) AS total_rolloffs
    FROM group_by_4_column_results g4
    It will output the key elements of what I need. But where it sums up the 'total_rolloffs', I need to add that number back into the infractiondate column. Any help would be greatly appreciated.
    CREATE TABLE M_ATSCHUNK
    (EMPLOYEE varchar(50),
    ROLLOFFDAYSCOUNT varchar(3),
    INFRACTIONDATE date)
    INSERT INTO M_ATSCHUNK (EMPLOYEE, ROLLINGOFFDAYSCOUNT, INFRACTIONDATE)
    VALUES ('PHIL','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('PHIL','YES', (to_date('2010/01/02 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('PHIL','YES', (to_date('2010/01/03 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('PHIL','YES', (to_date('2010/01/04 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('PHIL','YES', (to_date('2010/01/05 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('PHIL','NO', (to_date('2010/02/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('PHIL','NO', (to_date('2010/03/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','YES', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss'))),
    VALUES ('NIKI','NO', (to_date('2010/01/01 08:00:00', 'yyyy/mm/dd hh24:mi:ss')))

    Phil3061 wrote:
    I need to add that number back into the infractiondate column.Well, in general you need to use UPDATE or better MERGE. Howebver, your data sample does not show any rollofs:
    SQL> SELECT * FROM M_ATSCHUNK;
    EMPLOYEE                                           ROL INFRACTIO
    PHIL                                               YES 01-JAN-10
    PHIL                                               YES 02-JAN-10
    PHIL                                               YES 03-JAN-10
    PHIL                                               YES 04-JAN-10
    PHIL                                               YES 05-JAN-10
    PHIL                                               NO  01-FEB-10
    PHIL                                               NO  01-MAR-10
    NIKI                                               YES 01-JAN-10
    NIKI                                               YES 01-JAN-10
    NIKI                                               YES 01-JAN-10
    NIKI                                               NO  01-JAN-10
    EMPLOYEE                                           ROL INFRACTIO
    NIKI                                               NO  01-JAN-10
    NIKI                                               NO  01-JAN-10
    NIKI                                               NO  01-JAN-10
    14 rows selected.
    SQL> WITH group_by_4_column_results AS
      2  (SELECT m_atschunk.employee AS employee,
      3  SUM(CASE
      4  WHEN
      5  M_ATSCHUNK.rolloffDaysCount = '108545043' AND m_atschunk.infractiondate BETWEEN SYSDATE - 365 AND SYSDATE THEN 1 ELSE 0 END) as
    rolloffs,
      6  M_ATSCHUNK.INFRACTIONDATE + 365 as infractionDate
      7  FROM M_ATSCHUNK
      8  group by employee, infractionDate, rolloffDaysCount
      9  )
    10  SELECT g4.*,
    11  SUM (rolloffs) OVER (PARTITION BY employee) AS total_rolloffs
    12  FROM group_by_4_column_results g4
    13  /
    EMPLOYEE                                             ROLLOFFS INFRACTIO TOTAL_ROLLOFFS
    NIKI                                                        0 01-JAN-11              0
    NIKI                                                        0 01-JAN-11              0
    PHIL                                                        0 01-JAN-11              0
    PHIL                                                        0 02-JAN-11              0
    PHIL                                                        0 03-JAN-11              0
    PHIL                                                        0 04-JAN-11              0
    PHIL                                                        0 05-JAN-11              0
    PHIL                                                        0 01-FEB-11              0
    PHIL                                                        0 01-MAR-11              0
    9 rows selected.
    SQL> So adjust data sample and based on it tell us what are the expected results.
    SY.

  • Help with sound output via HDMI

    My sound output via HDMI suddenly stopped worked to my TV set. I've reset the PRAM and the SMC. When I go to sound control panel for sound output, the setting is on Headphones. When I try to change it to SV420XVT1A (the tv) it immediately jumps back to headphone. I also tried a different HDMI cable to a different HDMI port on the tv. This just started after the Mac Mini had been turned off for a week. I'm using Lion and it's an 8GB Intel Core 2 Duo. Any suggestions?

    I actually discovered this answer about 5 minutes after I posted the question. Thanks a lot for your help!! Funny thing is that it had worked all along with something plugged in the headphone jack but suddenly stopped working. Again, thanks!

  • Help with displaying BLOBs in OBIEE 11g

    I am trying to get OBIEE 11g to display photographs in an Analysis report. I know BLOB fields are not supported, and I have been reading posts on this board and following examples on internet sites that try to get round this problem. But, try as I might, I cannot get those pesky photos to display.
    Below are all the steps I have followed. Sorry that there is a lot to read, but I was hoping that somebody has been successful in doing this, and may spot something in one of my steps that I am doing wrong.
    ORACLE TRANSACTIONAL SOURCE_
    Table : EMPL_PHOTO
    Fields:
    USN VARCHAR2(11) ( Unique Key )
    EMPLOYEE_PHOTO BLOB ( I think the photos are stored as 'png' )
    ORACLE WAREHOUSE SOURCE_
    Table : D_PERSON_PHOTO_LKUP
    Fields :
    PERSON_KEY     NUMBER(38,0) ( Primary Key - Surrogate )
    USN     VARCHAR2(11)
    PHOTO     CLOB
    BLOB to CLOB conversion.
    I used this function :
         create or replace function blob_to_clob_base64(p_data in blob)
         return clob
         is
         l_bufsize integer := 16386;
         l_buffer raw(16386);
         l_offset integer default 1;
         l_result clob;
         begin
         dbms_lob.createtemporary(l_result, false, dbms_lob.call);
         loop
         begin
         dbms_lob.read(p_data, l_bufsize, l_offset, l_buffer);
         exception
         when no_data_found then
         exit;
         end;
         l_offset := l_offset + l_bufsize;
         dbms_lob.append(l_result, to_clob(utl_raw.cast_to_varchar2(utl_encode.base64_encode(l_buffer))));
         end loop;
         return l_result;
         end;
         select usn, employee_photo ,
         BLOB_TO_CLOB_BASE64(employee_photo)
         from empl_photo
    IN OBIEE ADMINISTRATION TOOL_
    *1) Physical Layer*
    Added D_PERSON_PHOTO_LKUP from Connection Pool
    Left it as 'Cachable'
    Didn't join it to any tables
    Changed field PHOTO to a 'LONGVARCHAR' length 100000
    Set USN as the Key ( not the surrogate key )
    *2) BMM Layer*
    Dragged D_PERSON_PHOTO_LKUP across.
    Renamed it to 'LkUp - Photo'
    Ticked the 'lookup table' box
    Removed the surrogate key
    Kept USN as the Primary key
    The icon shows it similar to a Fact table, with a yellow key and green arrow.
    On Dimension table D_PERSON_DETAILS (Dim - P01 - Person Details) added a new logical column
    Called it 'Photo'
    Changed the column source to be derived from an expression.
    Set the expression to be :
    Lookup(DENSE
    "People"."LkUp - Photo"."PHOTO",
    "People"."Dim - P01 - Person Details"."USN" )
    Icon now shows an 'fx' against it.
    Note: This table also had it Surrogate key removed, and USN setting as primary key.
    *3) Presentation Layer*
    Dragged the new Photo field across.
    Saved Repository file, uploaded, and restarted server.
    ONLINE OBIEE_
    Created a new Analysis.
    Selected USN from 'Person Details'
    Selected Photo from 'Person Details'
    Selected a measure from the Fact table
    Under column properties of Photo ( data format ) :
    - Ticked 'Override Default Data Format' box
    - Set to Image URL
    - Custom text format changed to : @[html]"<img alt="" src=""@H"">"
    Under column properties of Photo ( edit formula ) :
    - Changed to : 'data:image/png;base64,'||"Person Details"."Photo"
    The Advanced tab shows the sql as :
         SELECT
         0 s_0,
         "People"."Person Details"."USN" s_1,
         'data:image/png;base64,'||"People"."Person Details"."Photo" s_2,
         "People"."MEASURE"."Count" s_3
         FROM "People"
         ORDER BY 1, 2 ASC NULLS LAST, 3 ASC NULLS LAST
         FETCH FIRST 65001 ROWS ONLY
    Going into the 'results' tab, get error message:
    +State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 17001] Oracle Error code: 932, message: ORA-00932: inconsistent datatypes: expected - got CLOB at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)+
    It doesn't seem to be using the Lookup table, but can't work out at which step I have gone wrong.
    Any help would be appreciated.
    Thanks

    Thanks, yes I followed http://docs.oracle.com/cd/E28280_01/bi.1111/e10540/busmodlayer.htm#BGBDBDHI, but when I get to the part of setting the LOOKUP function on th Physical source, only ONE physical source is displayed. I need TWO sources ( The Employee Table, and the Photo LookUp.
    I have raised this as an error with Oracle. We are now on OBIEE 11.1.1.7, but Oracle say BLOBS are still not supported in that release. It will be fixed in 11.1.1.8 and it will be backported into 11.1.1.6.11
    In the meantime we have abandoned showing Photo's in any of our reports.

  • Help with displaying my xml file in my jtext area

    Hi i am trying to read the data from my xml file and display it once the user clicks on the list all button.
    below is the source code for my program can someone please tell me some code to this.
    package tractorgui;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.XMLEncoder;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.beans.XMLDecoder;
    import javax.swing.*;
    import javax.swing.border.LineBorder;
    //import tractor.TextInputPrompt;
    import tractor.Tractor;
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo isbeing used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    public class NewSwingApp extends javax.swing.JFrame {
    //          //Set Look & Feel
    //          try {
    //               javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    //          } catch(Exception e) {
    //               e.printStackTrace();
              private static final long serialVersionUID = 1L;
         private JButton searchmanufacturer;
         private JButton jButton3;
         private JLabel companyname;
         private JPanel labelpannel;
         private JButton listall;
         private JPanel MenuButtons;
         private JButton archivetractor;
         private JTextArea outputscreen;
         private JButton exhibittractor;
         private JButton deletetractor;
         private JButton addtractor;
         private JButton listallexbited;
         private Tractor [ ] tractors;
         private JScrollPane jScrollPane2;
         private JScrollPane jScrollPane1;
    private int numberOfTractors;
         * Auto-generated main method to display this JFrame
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        NewSwingApp inst = new NewSwingApp();
                        inst.setLocationRelativeTo(null);
                        inst.setVisible(true);
         public NewSwingApp() {
              super();
              initGUI();
         private void initGUI() {
              try {
                   BorderLayout thisLayout = new BorderLayout();
                   getContentPane().setLayout(thisLayout);
                   this.setPreferredSize(new java.awt.Dimension(750, 700));
                        labelpannel = new JPanel();
                        BorderLayout labelpannelLayout = new BorderLayout();
                        getContentPane().add(labelpannel, BorderLayout.NORTH);
                        labelpannel.setLayout(labelpannelLayout);
                        jButton3 = new JButton();
                        getContentPane().add(getExitsystem(), BorderLayout.SOUTH);
                        jButton3.setText("Exit System");
                        jButton3.setPreferredSize(new java.awt.Dimension(609, 57));
                        jButton3.setBackground(new java.awt.Color(0,255,255));
                        jButton3.setForeground(new java.awt.Color(0,0,0));
                        jButton3.setFont(new java.awt.Font("Arial",1,24));
                        jButton3.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                            System.exit(0);
                        MenuButtons = new JPanel();
                        getContentPane().add(MenuButtons, BorderLayout.WEST);
                        GridLayout MenuButtonsLayout = new GridLayout(7, 1);
                        MenuButtonsLayout.setColumns(1);
                        MenuButtonsLayout.setRows(7);
                        MenuButtonsLayout.setHgap(5);
                        MenuButtonsLayout.setVgap(5);
                        MenuButtons.setLayout(MenuButtonsLayout);
                        MenuButtons.setPreferredSize(new java.awt.Dimension(223, 267));
                             listall = new JButton();
                             MenuButtons.add(getListall());
                             listall.setText("List All");
                             listall.setBackground(new java.awt.Color(0,255,255));
                             listall.setForeground(new java.awt.Color(0,0,0));
                             listall.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false));
                             listall.setFont(new java.awt.Font("Arial",2,14));
                             listall.addActionListener(new ActionListener() {
                                  /* (non-Javadoc)
                                  * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
                                  public void actionPerformed(ActionEvent evt) {
                                       String XMLFile = "tractor.xml-courseworkasignment/src";
                                       //** Prints the contents of my XML file
                                       try {
                                       String s;
                                       BufferedReader in = new BufferedReader( new FileReader(XMLFile)
                                       outputscreen.setText("File successfully opened");
                                       try {
                                       while ( (s=in.readLine()) !=null)
                                       outputscreen.append(s);
                                       catch(Exception e) {
                                            outputscreen.append("Error reading line: " + e.getMessage());
                                       outputscreen.append("End of Document");
                                       catch(FileNotFoundException e) {
                                            outputscreen.append("Error in opening file: " + e.getMessage());
                             listallexbited = new JButton();
                             MenuButtons.add(getListallexbited());
                             listallexbited.setText("List All Tractors On Exhibition ");
                             listallexbited.setPreferredSize(new java.awt.Dimension(157, 57));
                             listallexbited.setBackground(new java.awt.Color(0,255,255));
                             listallexbited.setForeground(new java.awt.Color(64,0,0));
                             listallexbited.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       outputscreen.repaint();
                                       String XMLFile = "C:tractor.xml";
                                  // Print contents of XML file
                                  try {
                                  String s;
                                  BufferedReader in = new BufferedReader( new FileReader(XMLFile)
                                  outputscreen.setText("File successfully opened");
                                  try {
                                  while ( (s=in.readLine()) !=null)
                                  outputscreen.append(s);
                                  catch(Exception e) {
                                       outputscreen.append("Error reading line: " + e.getMessage());
                                  outputscreen.append("End of Document");
                                  catch(FileNotFoundException e) {
                                       outputscreen.append("Error in opening file: " + e.getMessage());
                             addtractor = new JButton();
                             MenuButtons.add(getAddtractor());
                             addtractor.setText("Add Tractor ");
                             addtractor.setBackground(new java.awt.Color(0,255,255));
                             addtractor.setForeground(new java.awt.Color(64,0,0));
                             addtractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       String manufacturer =JOptionPane.showInputDialog(getComponent(0), "Enter Manufacturer of Tractor");
                                       String shp = (JOptionPane.showInputDialog(getComponent(0), "Enter Horse Power of Tractor"));
                                       int hp =Integer.parseInt(shp);
                                       int sisRare =Integer.parseInt(JOptionPane.showInputDialog(getComponent(0), "Enter If the Tractor is rare (1=Yes/2=No)"));
                                       boolean isRare;
                                       if (sisRare== 1) {
                                       isRare =true;     
                                       }else
                                            isRare =false;
                                       String yom= JOptionPane.showInputDialog(getComponent(0), "Enter Year of Manufacture");
                                       int yearOfManufacture =Integer.parseInt(yom);
                                       String yis =JOptionPane.showInputDialog(getComponent(0), "Enter Number of years the Tractor has been in service");
                                       int yearsInService =Integer.parseInt(yis);
                                       String svalue = JOptionPane.showInputDialog(getComponent(0), "Enter Tractor's Value (?Pounds)");
                                       double value = Double.parseDouble(svalue);
                                       String lastWorkPlace =JOptionPane.showInputDialog(getComponent(0), "Enter Last Workplace");
                                            if(NewSwingApp.addTractor(new Tractor(manufacturer, hp, isRare, yearOfManufacture, yearsInService, value, lastWorkPlace, false)))
                                       JOptionPane.showMessageDialog((getComponent(0)), "Tractor Added");
                                       else
                                            JOptionPane.showMessageDialog(getComponent(0), "Could not Add Tractor");
                             deletetractor = new JButton();
                             MenuButtons.add(getDeletetractor());
                             deletetractor.setText("Delete Tractor ");
                             deletetractor.setBackground(new java.awt.Color(0,255,255));
                             deletetractor.setForeground(new java.awt.Color(64,0,0));
                             deletetractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("deletetractor.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Tractor ID");
                             exhibittractor = new JButton();
                             MenuButtons.add(getExhibittractor());
                             exhibittractor.setText("Exhibit Tractor");
                             exhibittractor.setBackground(new java.awt.Color(0,255,255));
                             exhibittractor.setForeground(new java.awt.Color(0,0,0));
                             exhibittractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("exhibittractor.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Tractor I.D");
                             archivetractor = new JButton();
                             MenuButtons.add(getArchivetractor());
                             archivetractor.setText("Archive Tractor");
                             archivetractor.setBackground(new java.awt.Color(0,255,255));
                             archivetractor.setForeground(new java.awt.Color(0,0,0));
                             archivetractor.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("archivetractor.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Tractor I.D");
                             searchmanufacturer = new JButton();
                             MenuButtons.add(searchmanufacturer);
                             searchmanufacturer.setText("Search Manufacturer");
                             searchmanufacturer.setPreferredSize(new java.awt.Dimension(159, 21));
                             searchmanufacturer.setBackground(new java.awt.Color(0,255,255));
                             searchmanufacturer.setForeground(new java.awt.Color(64,0,0));
                             searchmanufacturer.addActionListener(new ActionListener() {
                                  public void actionPerformed(ActionEvent evt) {
                                       System.out.println("searchmanufacturer.actionPerformed, event="+evt);
                                       JOptionPane.showInputDialog(getComponent(0), "Enter Manufacturer Name");
                        outputscreen = new JTextArea();
                        getContentPane().add(outputscreen, BorderLayout.CENTER);
                        outputscreen
                                  .setText("");
                        outputscreen.setBorder(BorderFactory.createTitledBorder(""));
                        outputscreen.setWrapStyleWord(true);
                        outputscreen.setEditable(false);
                        outputscreen.setEnabled(true);
                        outputscreen.setBackground(new java.awt.Color(255, 255, 255));
                        outputscreen.setForeground(new java.awt.Color(64, 0, 0));
                        companyname = new JLabel();
                        getContentPane().add(companyname, BorderLayout.NORTH);
                        companyname.setText(" Wolvesville Tractor Museum");
                        companyname.setPreferredSize(new java.awt.Dimension(609, 85));
                        companyname.setBackground(new java.awt.Color(255,255,0));
                        companyname.setFont(new java.awt.Font("Arial",1,28));
                        companyname.setForeground(new java.awt.Color(0,0,0));
                        companyname.setBorder(BorderFactory.createTitledBorder(""));
                        companyname.setOpaque(true);
                   this.setSize(750, 750);
              } catch (Exception e) {
                   e.printStackTrace();
         protected static boolean addTractor(Tractor tractor) {
                   if (tractor.getManufacturer()==null) return false; else
                   if (tractor.getHp()<50||tractor.getHp()>1100) return false; else
                   if (tractor.getIsRare()==false) return false; else
                   if (tractor.getYearsInService()<1||tractor.getYearsInService()>200) return false; else
                   if (tractor.getYearOfManufacture()<1800||tractor.getYearOfManufacture()>2008) return false; else
                   if (tractor.getValue()<100||tractor.getValue()>1500) return false; else
                   if (tractor.getLastWorkPlace()==null) return false; else
              return true;
         public JPanel getMenuButtons() {
              return MenuButtons;
         public JButton getListall() {
              return listall;
         public JLabel getCompanyname() {
              return companyname;
         public JButton getExitsystem() {
              return jButton3;
         public JButton getSearchmanufacturer() {
              return searchmanufacturer;
         public JButton getListallexbited() {
              return listallexbited;
         public JButton getAddtractor() {
              return addtractor;
         public JButton getDeletetractor() {
              return deletetractor;
         public JButton getExhibittractor() {
              return exhibittractor;
         public JButton getArchivetractor() {
              return archivetractor;
         public JTextArea getOutputscreenx() {
              return outputscreen;
    public void savetractors () {
         try {
              XMLEncoder encoder = new XMLEncoder(new FileOutputStream("tractor.xml"));
              encoder.writeObject(tractors);
              encoder.close();
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    public void loadtractors () {
    try {
              XMLDecoder decoder = new XMLDecoder(new FileInputStream("tractor.xml"));
              tractors = (Tractor[]) decoder.readObject();
              decoder.close();
              for (int i=0; i<tractors.length;i++) {
                   if (tractors!=null)numberOfTractors =i;
              numberOfTractors++;
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              tractors=new Tractor[25];
              numberOfTractors=0;

    here's an example:
    http://jdj.sys-con.com/read/37550.htm
    you need to have a class Tractor with all those properties and then use readObject.Somehow you need to tell the Encoder/Decoder what Tractor means..
    hope this helps!!

  • Help with displaying a JTree

    Hi,
    I have developed a webspider that cycles through a website detecting all urls and checking for borken links. I currently have build a JTree that takes the current url that is being processed and creates a string and adds it to a JTree. The problem I have is that the urls are printed in the JTree as one long list, e.g.
    |Test
    |____url 1
    |____url 1a
    |____url 2
    |____url 2a
    I would like it to disply like this:
    |Test
    |____url 1
    |-------|____url 1a
    |____url 2
    |-------|____url 2a
    (I have had to place the dashes in so it displays properly)
    So that the strucutre of the website can be seen. I have read the JTree tutroial and my code looks like this, sorry its large i'm not too sure which bits to cut out:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class gui extends JFrame implements Runnable
          *declare variable, boolean
          *thread, a object and a center
          *pane
         protected URL urlInput;
         protected Thread bgThread;
         protected boolean run = false;
         protected WebSpider webSpider;
         public String brokenUrl;
         public String goodUrl;
         public String deadUrl;
         protected DefaultMutableTreeNode rootNode;
        protected DefaultTreeModel treeModel;
         public gui()
                *create the gui here
               setTitle("Testing Tool");
             setSize(600,600);
             //add Buttons to the tool bar
             start.setText("Start");
             start.setActionCommand("Start");
             toolBar.add(start);
             ButtonListener startListener = new ButtonListener();
                 start.addActionListener(startListener);
              cancel.setText("Cancel");
             cancel.setActionCommand("Cancel");
             toolBar.add(cancel);
             ButtonListener cancelListener = new ButtonListener();
                 cancel.addActionListener(cancelListener);
                 clear.setText("Clear");
             clear.setActionCommand("Clear");
             toolBar.add(clear);
             ButtonListener clearListener = new ButtonListener();
                 clear.addActionListener(clearListener);
                 close.setText("Close");
             close.setActionCommand("Close");
             toolBar.add(close);
             ButtonListener closeListener = new ButtonListener();
                 close.addActionListener(closeListener);
                 //creat a simple form
                 urlLabel.setText("Enter URL:");
                 urlLabel.setBounds(100,36,288,24);
                 formTab.add(urlLabel);
                 url.setBounds(170,36,288,24);
                 formTab.add(url);
                 current.setText("Currently Processing: ");
                 current.setBounds(100,80,288,24);
                 formTab.add(current);
             //add the scrol pane and text area to the error tab
             errorTab.add(errorPane);
             errorPane.setBounds(0,0,580,490);
             errorPane.getViewport().add(errorText);
             //add the scroll pane to the tree tab
             treeTab.add(treePane);
             treePane.setBounds(0,0,580,490);
             //create the JTree
             rootNode = new DefaultMutableTreeNode("Test");
             treeModel = new DefaultTreeModel(rootNode);
             treeModel.addTreeModelListener(new MyTreeModelListener());
             tree = new JTree(treeModel);
             tree.setEditable(true);
             tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setShowsRootHandles(true);
             treePane.getViewport().add(tree);
             //create the tabbed window             
            centerPane.setBorder(new javax.swing.border.EtchedBorder());
            formTab.setLayout(null);
            errorTab.setLayout(null);
            treeTab.setLayout(null);
            centerPane.addTab("Search Parameters", formTab);
            centerPane.addTab("Error Messages", errorTab);
            centerPane.addTab("Website Structure", treeTab);
              //add the tool bar and tabbed pane
              getContentPane().add(toolBar, java.awt.BorderLayout.NORTH);
            getContentPane().add(centerPane, java.awt.BorderLayout.CENTER);             
                 *create the tool bar pane, a center pane, add the buttons,
                 *labels, tabs, a text field for user input here
                javax.swing.JPanel toolBar = new javax.swing.JPanel();
                javax.swing.JButton start = new javax.swing.JButton();
              javax.swing.JButton cancel = new javax.swing.JButton();
              javax.swing.JButton clear = new javax.swing.JButton();
              javax.swing.JButton close = new javax.swing.JButton();      
                javax.swing.JTabbedPane centerPane = new javax.swing.JTabbedPane();
                javax.swing.JPanel formTab = new javax.swing.JPanel();
                javax.swing.JLabel urlLabel = new javax.swing.JLabel();
                javax.swing.JLabel current = new javax.swing.JLabel();
                javax.swing.JTextField url = new javax.swing.JTextField();
                javax.swing.JPanel errorTab = new javax.swing.JPanel();
                javax.swing.JTextArea errorText = new javax.swing.JTextArea();
                javax.swing.JScrollPane errorPane = new javax.swing.JScrollPane();
                javax.swing.JPanel treeTab = new javax.swing.JPanel();
                javax.swing.JScrollPane treePane = new javax.swing.JScrollPane();
                javax.swing.JTree tree = new javax.swing.JTree();
               *show the gui
              public static void main(String args[])
                  (new gui()).setVisible(true);
              *listen for the button presses and set the
              *boolean flag depending on which button is pressed
             class ButtonListener implements ActionListener
                  public void actionPerformed(ActionEvent event)
                       Object object = event.getSource();
                       if (object == start)
                            run = true;
                            startActionPerformed(event);
                       if (object == cancel)
                            run = false;
                            startActionPerformed(event);
                       if (object == clear)
                            errorText.setText("");
                            rootNode.removeAllChildren();
                           treeModel.reload();
                       if (object == close)
                            System.exit(0);
              *this method is called when the start or
              *cancel button is pressed.
             void startActionPerformed (ActionEvent event)
                  if (run == true && bgThread == null)
                       bgThread = new Thread(this);
                       bgThread.start();
                  if (run == false && bgThread != null)
                       webSpider.cancel();
              *this mehtod will start the background thred.
              *the background thread is required so that the
              *GUI is still displayed
             public void run()
                  try
                           webSpider = new WebSpider(this);
                         webSpider.clear();
                         urlInput = new URL(url.getText());
                       webSpider.addURL(urlInput);
                       webSpider.run();
                       bgThread = null;
                      catch (MalformedURLException e)
                           addressError addErr = new addressError();
                         addErr.addMsg = "URL ERROR - PLEASE CHECK";
                         SwingUtilities.invokeLater(addErr);
                 *this method is called by the web spider
                 *once a url is found. Validation of navigation
                 *happens here.
                public boolean urlFound(URL urlInput,URL url)
                      CurrentlyProcessing pro = new CurrentlyProcessing();
                  pro.msg = url.toString();
                  SwingUtilities.invokeLater(pro);
                  if (!testLink(url))
                        navigationError navErr = new navigationError();
                        navErr.navMsg = "Broken Link "+url+" caused on "+urlInput+"\n";
                        brokenUrl = url.toString();
                        return false;
                  if (!url.getHost().equalsIgnoreCase(urlInput.getHost()))
                        return false;
                  else
                         return true;
                //this method is returned if there is no link on a web page
                public void urlNotFound(URL urlInput)
                          deadEnd dEnd = new deadEnd();
                           dEnd.dEMsg = "No links on "+urlInput+"\n";
                           deadUrl = urlInput.toString();                
                //this method is called internally to check that a link works              
                protected boolean testLink(URL url)
                   try
                         URLConnection connection = url.openConnection();
                         connection.connect();
                         goodUrl = url.toString();
                         return true;
                  catch (IOException e)
                         return false;
                //this method is called when an error is found            
                public void urlError(URL url)
              //this method is called when an email address is found             
                public void emailFound(String email)
              //this method will update any navigation errors found
              class addressError implements Runnable
                   public String addMsg;
                   public void run()
                        current.setText("Currently Processing: "+ addMsg);
                        errorText.append(addMsg);
              class navigationError implements Runnable
                   public String navMsg;
                   public void run()
                        errorText.append(navMsg);
              class deadEnd implements Runnable
                   public String dEMsg;
                   public void run()
                        errorText.append(dEMsg);
              //this method will update the currently processing field on the GUI
              public class CurrentlyProcessing implements Runnable
                   public String msg;
                  //public String msgInfo = msg;
                     public void run()
                         current.setText("Currently Processing: " + msg );
                         addObject(msg);
             //add a node to the tree
                public DefaultMutableTreeNode addObject (Object child)
                 DefaultMutableTreeNode parentNode = null;
                 return addObject(parentNode, child, true);
             public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent,Object child,boolean shouldBeVisible)
                 DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
                 if (parent == null)
                     parent = rootNode;
                 treeModel.insertNodeInto(childNode, parent, parent.getChildCount());
                 if (shouldBeVisible)
                     tree.scrollPathToVisible(new TreePath(childNode.getPath()));
                      return childNode;
             //listener for the tree model     
             public class MyTreeModelListener implements TreeModelListener
                  public void treeNodesChanged (TreeModelEvent e)
                       DefaultMutableTreeNode node;
                       node = (DefaultMutableTreeNode)
                       (e.getTreePath().getLastPathComponent());
                       try
                            int index = e.getChildIndices()[0];
                            node = (DefaultMutableTreeNode)
                            (node.getChildAt(index));
                       catch (NullPointerException exc)
                  public void treeNodesInserted(TreeModelEvent e)
                  public void treeStructureChanged(TreeModelEvent e)
                  public void treeNodesRemoved(TreeModelEvent e)
    }It uses a class called webspider which i have not attached, if required please let me know. I beleive that in addObject I am adding all nodes to the root as children.
    Any help would be much appreciated.
    Many Thanks
    MRv

    I would recomend you create your own JTree class for this.
    Here are a few things I set in my constructor within the JTree:
    // turn on tooltips
    ToolTipManager.sharedInstance().registerComponent(this);
    // used by two setters so create reference
    RollupTreeCellRenderer renderer = new RollupTreeCellRenderer();
    // customizing the icons for the tree
    // setting the folder icons
    renderer.setOpenIcon(IconLoader.getIcon("Open.gif"));
    renderer.setClosedIcon(IconLoader.getIcon("Folder.gif"));
    // inventory icon
    renderer.setLeafIcon(IconLoader.getIcon("Document.gif"));
    // add renderer to highlight Inventory nodes with Red or Blue text
    setCellRenderer(renderer);
    Here is the renderer class example:
    class RollupTreeCellRenderer
    extends DefaultTreeCellRenderer
    * Configures the renderer based on the passed in components.
    * The value is set from messaging the tree with
    * <code>convertValueToText</code>, which ultimately invokes
    * <code>toString</code> on <code>value</code>.
    * The foreground color is set based on the selection and the icon
    * is set based on on leaf and expanded.
    * @param tree JTree
    * @param value Object
    * @param sel boolean
    * @param expanded boolean
    * @param leaf boolean
    * @param row int
    * @param hasFocus boolean
    * @return Component
    public Component getTreeCellRendererComponent(JTree tree, Object value,
    boolean sel,
    boolean expanded,
    boolean leaf, int row,
    boolean hasFocus)
    // call super for default behavior
    super.getTreeCellRendererComponent(tree,
    value,
    sel,
    expanded,
    leaf,
    row,
    hasFocus);
    // if the current node is selected do NOT over-ride
    // the default colors
    if (sel)
    return this;
    // cast to our wrapper Node class
    RollupNode node = (RollupNode) value;
    if (node.isInventory())
    if (RollupMediator.getInstance().nodeInList(node))
    setForeground(RollupTree.FOUND);
    setToolTipText("Click to find positions count");
    else
    setForeground(RollupTree.NOT_FOUND);
    setToolTipText("Inventory not in current business date");
    else
    setToolTipText("Double click to edit name");
    return this;
    } // Renderer
    Let me know if you need more examples.
    BTW
    I the TreeCellRenderer example is not public so I can add it to the bottom of the file that contains my custom JTree.

  • AT300 - need help with display brightness

    Hello! Help solve the problem with the AT300 tablet.
    Balanced consumption charge off, automatic brightness control is also disabled. But when watching videos, surfing and gaming brightness still varies depending on the color of the image. If the image is dark, the brightness decreases, if the picture is brighter - the screen gets brighter. How do to fix the brightness?
    Thanks!

    Hello,
    I have the same problem like flash85.
    When I scroll down on bright websites and a darker picture is shown on the screen,
    the whole display becomes much darker and even the colors on the screen change.
    Yesterday I've tried the same website on an IPad and the background and colors perfectly
    stays the same.
    Also the display permanently dimms down or up if the automatic brightness control is
    enabled. This is also very disturbing.
    I can't imagine that this behaviour is normal. I read many tests before and none of it mentioned this.

Maybe you are looking for

  • Payment Medium Workbench (PMW) - T.Code FBZP

    Hi Friends, I have to work on Payment Medium Workbench. This is located in T.Code FBZP in Payment Method/Country and in Payment Medium. Please explain how to configure Payment Medium Workbench, any good links related this and your expereinces and wha

  • Crystal Reports - Switch between multiple databases at runtime (esp. DB2)

    Hi, we are currently developing a reporting application in .NET (C#) with an integrated Crystal Viewer. We want to be able to change the databse dynamically at runtime, especially between different DBMS. We encountered no problems when switching betw

  • Material Type Movement type and Storage location Authorization Object

    Dear All, My client wants that  certain type of material i.e. SFG should not be GR Mvt. type 101 at the FG storage location, they want to restrict to some  user ID . Is there any authorization object or the enhancement to control all three parameter

  • .PDF coming in as Winmail.DAT

    Anyone know why all of a sudden friends sending me PDF's get converted to WINMAIL.DAT.  I can't open them, what can I check?

  • Just Got E-mail -- My Touch has Shipped!

    Just received Apple Store e-Mail, your i-Touch has shipped. Ordered 16g i-Touch on 9/5, no engraving. Should arrive in New Jersey by Friday.