Needed help with updating java code

Hello all,
Let me begin by let you know I am not a programmer and I have tried to solve this by reading on the net. I am a network admin so I tech knowledge but no programming.
I have a webcam sending a Jpg to an FTP site and there I have used an applet called view.class to refresh once a second.
site:http://70.154.170.253/webcamold.html
My problems is now that it refreshes the same image over and over. It refreshes the cached image not the new image.
From reading I suspect that it has to do with the newer version of java (it used to work fine).
I have tried using JavaCam but same issue it just refreshes cached image. Also image flickers, the applet I am trying to fix was really smooth.
I have also tried to compile code that I found on this forum but I got error dealing with deprecated code.
Any help would be greatly appreciated!!!
Code:
import java.applet.Applet;
import java.awt.*;
import java.io.PrintStream;
public class View extends Applet
implements Runnable
public void init()
setBackground(Color.white);
String s = getParameter("refresh");
if(s == null)
update = 30;
else
try
update = Integer.parseInt(s);
catch(Exception _ex)
update = 30;
filename = getParameter("picture");
if(filename == null)
System.out.println("No filename given as parameter.");
md = new MediaTracker(this);
off = createImage(size().width, size().height);
refreshImage();
public void paint(Graphics g)
g.drawImage(off, 0, 0, this);
public void update(Graphics g)
paint(g);
public void refreshImage()
img = getImage(getDocumentBase(), filename);
md.addImage(img, 0);
try
md.waitForID(0);
catch(Exception exception)
exception.printStackTrace();
Graphics g = off.getGraphics();
g.drawImage(img, 0, 0, this);
img.flush();
public void run()
while(th != null)
try
refreshImage();
repaint();
Thread.sleep(update * 1000);
catch(Exception exception)
System.out.println("Error when thread was supposed to sleep: " + exception.getMessage());
public void start()
if(th == null)
th = new Thread(this);
try
th.start();
return;
catch(Exception exception)
System.out.println("Couldn't start thread: " + exception.getMessage());
return;
} else
return;
public void stop()
if(th != null)
th.stop();
th = null;
public void destroy()
stop();
public View()
update = 30;
Thread th;
String filename;
int update;
Image img;
Image off;
MediaTracker md;

This is compile error free code and regarding your issues i don't think am good at this stuff
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
public class View extends Applet implements Runnable {
     Thread th;
     String filename;
     int update;
     Image img;
     Image off;
     MediaTracker md;
     public void init() {
          setBackground(Color.white);
          String s = getParameter("refresh");
          if (s == null) {
               update = 30;
          } else {
               try {
                    update = Integer.parseInt(s);
               } catch (Exception _ex) {
                    update = 30;
          filename = getParameter("picture");
          if (filename == null) {
               System.out.println("No filename given as parameter.");
          md = new MediaTracker(this);
          off = createImage(size().width, size().height);
          refreshImage();
     public void paint(Graphics g) {
          g.drawImage(off, 0, 0, this);
     public void update(Graphics g) {
          paint(g);
     public void refreshImage() {
          img = getImage(getDocumentBase(), filename);
          md.addImage(img, 0);
          try {
               md.waitForID(0);
          } catch (Exception exception) {
               exception.printStackTrace();
          Graphics g = off.getGraphics();
          g.drawImage(img, 0, 0, this);
          img.flush();
     public void run() {
          while (th != null) {
               try {
                    refreshImage();
                    repaint();
                    Thread.sleep(update * 1000);
               } catch (Exception exception) {
                    System.out.println("Error when thread was supposed to sleep: "
                              + exception.getMessage());
     public void start() {
          if (th == null) {
               th = new Thread(this);
               try {
                    th.start();
                    return;
               } catch (Exception exception) {
                    System.out.println("Couldn't start thread: "
                              + exception.getMessage());
               return;
          } else {
               return;
     public void stop() {
          if (th != null) {
               th.stop();
               th = null;
     public void destroy() {
          stop();
     public View() {
          update = 30;
}

Similar Messages

  • HT201541 I need help with updating my browser.

    I need help with updating my browser.  Its telling me that Safari is outdated.

    That is a very old version belonging to Snow Leopard. I take it you are not actually running Yosemite.
    Upgrading to Yosemite
    You can upgrade to Yosemite from Lion or directly from Snow Leopard. Yosemite can be downloaded from the Mac App Store for FREE.
    Upgrading to Yosemite
    To upgrade to Yosemite you must have Snow Leopard 10.6.8 or Lion installed. Download Yosemite from the App Store. Sign in using your Apple ID. Yosemite is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
        OS X Mavericks/Yosemite- System Requirements
          Macs that can be upgraded to OS X Yosemite
             1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
             7. Xserve (Early 2009) - Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
         Are my applications compatible?
             See App Compatibility Table - RoaringApps.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mavericks, it may still meet the requirements to install Lion.
    You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • Need Help With Simple ABAP Code

    Hello,
    I'm loading data from a DSO (ZDTBMAJ) to an Infocube (ZCBRAD06). I need help with ABAP code to some of the logic in Start Routine. DSO has 2 fields: ZOCTDLINX & ZOCBRDMAJ.
    1. Need to populate ZOCPRODCD & ZOCREFNUM fields in Infocube:
        Logic:-
        Lookup /BI0/PMATERIAL, if /BIC/ZOCBRDMAJ = /BIC/OIZOCBRDMAJ
        then /BIC/ZOCPRODCD = ZOCPRODCD in Infocube
               /BIC/ZOCREFNUM = ZOCREFNUM in Infocube         
    2. Need to populate 0G_CWWTER field in Infocube:
        Logic:
        Lookup /BIC/PZOCTDLINX, if /BIC/ZOCTDLINX = BIC/OIZOCTDLINX
        then G_CWWTER = 0G_CWWTER in Infocube.
    I would need to read single row at a time.
    Thanks!

    I resolved it.

  • MAC OS 10.6.8 Using Safari 5.1 Needing Help With Updating Adobe Flash

    Hello-
    Recently Adobe Flash installed an icon in my System Preferences and when I click the icon there are several tabs.  One allows updates to check automatically.  It says it will install the latest version of Flash without having to remove the previous version, but I have never been told that a newer version is available unless I clcik "check now."  although "Check for updates automatically" is checked, I do not know where it tells me a newer version is available.  Also, there has been 5 "newer versions" available since this icon was installed in System Prefeences, I have only found out about the newer versions when I clicked "Check Now."  If I read that with this new way to install the latest Mac version of Flash does not require me to uninstall the previous version of Flash how do I install the most recent version of Flash?  Does it come in an email?
    Since it is not telling me that there is a more recent version of Flash unless I click "Check Now" should I still do it the way I used to install the latest version of flash?  (The way before this icon was added to System Preferences)?
    I would appreciate help with updating Flash to the most recent version.  I used to uninstall the older version, restart the browser and download the most recent version and install it.  It always worked find but this was before there was an Adobe icon in my system Preferences.

    Hello,
    The way you used to do this (uninstall, restart the browser, etc.) is still definitely valid and probably the "safest" way to get a new version installed.  Uninstalling shouldn't be required, but it definitely doesn't hurt.  If you feel comfortable doing it the old way, please feel free to continue using that process.
    As for notifications, this is a bit trickier, but in general you should be notified within 30 days (or so) after a new player is released.  This usually occurs when the browser loads swf content.  Clicking the button will, like you mention, immediately check.  Another alternative to finding out when a new player is released is to subscribe to our Flash Player Releases feed.
    Is there a way to be automatically notified when a new Flash Runtime release is made?
    Thanks,
    Chris

  • Need help with pie chart code

    I am new to Java and am having problems and I am in need of some help. I have written the code for my Mortgage Calculator but do not know how to get my chart to work. I found an example of the chart code in my text book but I am not sure if I wrote it wrong. When I run the MortCalc code it compiles but the Pie Chart code won't. I tried to run the chart code by itself but it prints out another calculator. My question is 1.) Is my chart code written wrong? and 2.) How do i enter it into my MortCalc code so that I get my chart?
    **Below I have included the assignment(so you know what I am doing exactly) and below that the pie chart code just in case you have questions. Thanks for any advice you can give.
    **If you need the rest of the code I can post it too. It was too long to post with the pie chart code.
    Assignment:
    Write the program in Java(w/ a GUI) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage adn the user's selection from a menu of availible mortgage loans:
    --7 yrs @ 5.35%
    --15 yrs @ 5.5%
    --30 yrs @ 5.75%
    Use an array for the mortgage data for the different loans. Read the interst rates to fill the array from a sequential file. Display the mortgage payment amount followed by the loan balance and interest paid for each payment over the term of the loan. Add graphics in the form of a chart.Allow the user to loop back and enter a new amount and make a new selection of quit. Please insert comments in the program to document the program.
    CODE:
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    //Class to hold a value for a slice
    public class PieValue {
    double value;
    Color color;
    public PieValue(double value, Color color) {
    this.value = value;
    this.color = color;
    // slices is an array of values that represent the size of each slice.
    public void drawPie(Graphics2D g, Rectangle area, PieValue[] slices) {
    // Get total value of all slices
    double total = 0.0D;
    for (int i=0; i<slices.length; i++) {
    total += slices.value;
    // Draw each pie slice
    double curValue = 0.0D;
    int startAngle = 0;
    for (int i=0; i<slices.length; i++) {
    // Compute the start and stop angles
    startAngle = (int)(curValue * 360 / total);
    int arcAngle = (int)(slices[i].value * 360 / total);
    // Ensure that rounding errors do not leave a gap between the first and last slice
    if (i == slices.length-1) {
    arcAngle = 360 - startAngle;
    // Set the color and draw a filled arc
    g.setColor(slices[i].color);
    g.fillArc(area.x, area.y, area.width, area.height, startAngle, arcAngle);
    curValue += slices[i].value;

    // Draw each pie slice
    double curValue = 0.0D;
    int startAngle = 0;
    for (int i=0; i<slices.length; i+) {
    // Compute the start and stop angles
    startAngle = (int)(curValue 360 / total);
    int arcAngle = (int)(slices.value * 360 / total);Look here and i think you will find some syntax errors.
    Count the brackets.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help with basic Java programming

    I'm having a little bit of trouble with my code. For the sake of argument, I've removed the code I'm having trouble with, because I know it was inaccurate. I'm trying to create a loop so that this program will keep going through and through until the user enters an invalid variable. I thought the default after the case statements was supposed to make the system exit and output my message. Those two problems, the loop and the default, are what I'm really having problems with. My code is posted below.
    import javax.swing.JOptionPane;
    import java.util.Locale;
    import java.text.NumberFormat;
    public class Retail
    public static void main(String args[])
    String firstNum;
    String secondNum;
    String result;
    int prodNum;      //first number to input
    double quantity; //second number to input
    double total = 0.0;     //total of Prod * Quantity Sold for all items
    // To use American Dollar
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance( Locale.US );
    // first number entered as string
    firstNum = JOptionPane.showInputDialog( "Enter product number 1-5" );
    // second number entered as string
    secondNum = JOptionPane.showInputDialog( " Enter quantity of items sold" );
    // convert values to type double or int from type string
    prodNum = Integer.parseInt( firstNum );
    quantity = Double.parseDouble( secondNum);
    result="";
    if ( prodNum >=1 && prodNum <=5 ) {
    switch (prodNum)
    case 1: // 1st product
    total = 2.98 * quantity;
    break;
    case 2: // 2nd product
    total = 4.50 * quantity;
    break;
    case 3: // 3rd product
    total = 9.98 * quantity;
    break;
    case 4: //4th product
    total = 4.49 * quantity;
    break;
    case 5:
    total = 6.87 * quantity;
    break;
    default: JOptionPane.showMessageDialog( null, "Wrong product number entered" );
    JOptionPane.showMessageDialog( null, moneyFormat.format(total), "Total Price of Items Purchased", JOptionPane.INFORMATION_MESSAGE );
    System.exit(0);
    ***I know I need to put something in the user input message to state that any value other than 1-5 entered will cause the program to skip to the output, I'll put that in later.***

    When you post code, please use [code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read and prevents accidental markup from array indices like [i].

  • Need help with adjusting Javascript code to work in Adobe Edge (Countdown)

    Hello
    Im a newbie when it comes to working with Javascript and Adobe Edge and need a bit of help with adjusting some javascript code to work with Adobe Edge. A friend of mine helped me with making this javascript code: Edit fiddle - JSFiddle
    Its a simple countdown which counts down to a certain time at a certain date. What I aim to do is to add this code as a trigger on a text-element called "countdown" (within a symbol called "count").
    I have tried to do this as the code is, but it does not work. Anyone have any suggestions?
    Thanks!
    Mvh,
    Øyvind Hermans

    Hello again
    I have stumbled upon a problem with these animations; They crash the browser after viewing them a little while, usually less than 30 seconds in.
    Is this problem also occuring when you watch the animations?
    Is the countdown-code to much for the browsers to handle?
    Thanks in advance for your answers.
    Sincerely,
    Øyvind Hermans

  • I need help with updating my Ipod 5

    So i am updating my ipid 5 to IOS 7.0.3. I am doing it through Itunes on my computor. I have sucsessfully updated the ipod, and am now in the process of setting up the ipod after the update. I am connected to wif-fi, but for the past 20 hours all the ipod has said was "restoring ICloud settings". I need help! i dont know what to do
    Thanks!

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - The try again.

  • Need Help With NetBeans (Java Studio Enterprise 8)'s code generation

    Hi!
    I am using Java Studio Enterprise 8 with NetBeans 4.1 IDE bundled together with it. When trying to create GUI out from NetBeans Form Designer, I don't like the way it generates the code. When I try to use a JTextField, it uses "Fully Qualifed Class Names" (e.g: javax.swing.JTextField) on the code. How do I set NetBeans not to use it but rather use only the class name and generate import lines on top of the code? Also, how do I set it up that it will generate the variable declarations (which is on the uneditable blue portion of the code) on top rather than the default which is placed at the bottom of the class code body. I have tried tweaking the Options menu of this IDE but haven't got any luck...
    Hope you could help, and thanks in advance!

    To address the location of the var decl codegen section (or any codegen location issues), there is a workaround, admittedly, it is a bit tedious.
    Once the form code is generated, as Kris mentioned, open the class in an external editor so that you can edit the generated code.
    Then cut the entire var declaration section along with the begin/end gen-code markers and paste it to the section of the file you desire.
    When you add more components to your form, the codegen will find this section wherever it is and add to it.
    Alternatively, you could just move the non-protected code around the protected within the NB editor, but you would not be able to rearrange the order of the actual code-genned sections.
    craig

  • Need Help with a JAVA programming assignment

    How do I write a JAVA program that could be used as the start of an MS-DOS/Windows simulation of the IEEE 802.3 protocol? I am to only code the parts necessary to build the 802.3 frame. For the initial implementation, the Checksum function need not be a CRC function, and the Destination and Source addresses wil be in input, stored, and output, and in dotted-decimal format.
    I need:
    1. A record to describe the frame, with each field being a (byte-) string of the required size, except that the Data field is of variable size. Although the "Source address" and "Destination address" would be 6 bytes for a real implementation, for this first implementation you can either assume they'll be text strings in the usual "dotted decimal" form (e.g. "14.04.05.18.01.25" as a typical example--from Tanenbaum, p. 429), or 6 hex digits.
    2. Suitable constant declarations for values such as the standard "Preamble" and "Start of Frame" values.
    3. Suitable functions to Get the three variable values "Destination address", "Source address", and "Data" from the standard input device.
    4. A suitable function to display each of the fields of a given frame in a format such as:
    Preamble: ...
    StartofFrame: ...
    Destination: ...
    etc.
    5. A suitable function to generate a "Pad" field if necessary.
    6. A "dummy" Checksum-generating function which just takes the first 32 bits (4 bytes) of the Data (or Data+Pad, if necessary) rather than an actual CRC algorithm.
    I have no experience with Java. Can you help me or start me in the right direction?
    Thanks...........TK

    If you have no experience with Java, then it seems to me your first step should be to start learning the language. But it's difficult to advise how, since we don't know anything about your background. There are many good books available on Java, some are for beginners and some are for advanced programmers, so I'd suggest you go somewhere that has a large selection and start looking for something that doesn't seem completely over your head.

  • Need help with update statement with multiple joins

    I've got the following select statement that is pulling 29 records:
    SELECT
    PPA.PROJECT_ID,
    PPA.SEGMENT1,
    peia.expenditure_item_id,
    peia.expenditure_type,
    pec.expenditure_comment
    FROM PA.PA_PROJECTS_ALL PPA,
    pa.pa_expenditure_items_all peia,
    pa.pa_expenditure_comments pec
    where PPA.segment1 < '2008' and
    PPA.project_id = 52 and -- just run for project # 20077119 for testing
    peia.expenditure_type = 'PAYROLL' and
    peia.project_id = ppa.project_id and
    PEC.EXPENDITURE_ITEM_ID = PEIA.EXPENDITURE_ITEM_ID;
    I need to update the pec.expenditure_comments to a static field for those 29 records. I assume I should start with the following, but not sure how to complete the where:
    update
    pa.pa_expenditure_comments pec
    set pec.expenditure_comment = 'REFERENCE HD#728'
    where
    First time that we've ever needed to update, so any and all help appreciated.

    Try using exists:
    update pa.pa_expenditure_comments pec
    set    pec.expenditure_comment = 'REFERENCE HD#728'
    where exists ( select null
                   from   pa.pa_projects_all ppa
                   ,      pa.pa_expenditure_items_all peia
                   ,      pa.pa_expenditure_comments pec2
                   where  ppa.segment1 < ''    -- not sure what you posted here, so for next time:
                                               -- please put your examples between the code tags.
                   and    ppa.project_id = 52  -- just run for project # 20077119 for testing
                   and    peia.expenditure_type = 'PAYROLL'
                   and    peia.project_id = ppa.project_id
                   and    pec2.expenditure_item_id = peia.expenditure_item_id
                   and    pec2.expenditure_item_id = pec.expenditure_item_id
                 );

  • I need help with a java assignment

    I am being taught java but dont really understand what i have to do. If you send me an email to [email protected] ill send you a copy and so help me with the assignement.
    I am currently working on free web page so you can download the assignment.
    Thank You All

    hey, there's something wrong with my internet, i clicked on your email adress and nothing happened :(
    too bad. maybe i can't do your assignment.
    go see somee tutorials, maybe these will help you, also try to understand how API will elp you (to both you may find links from left column of this page) and also, see if there area some samples of how to do what you need to be done.
    http://www.javaalmanac.com -- my favorited place for code samples.
    also whan you have some saaignment or other task, then see if google finds you apropriate solution. and there's a search function in these forums as well.
    i hope you get your homework doen in time...

  • I need help with some simple code! Please read!

    hi everyone.
    I'm having problems with a piece of code, and i'd be extremely greatful if somebody could give me a hand with it. I'm totally new to java and have to make a program for my university degree, but i'm finding it extremely difficult, mainly due to my total lack of apptitude for this type of thing. I know this is easy stuff, but the books I have are no use so any help would be greatly appreciated.
    I have to write a program which uses two class files. I want one with the code to produce a simple button, and one to invoke it several times at different locations. I decided to write the program as one class file at first, and thought i'd be able to split it up at later. The program works fine when it is one class file. My book said that to split the two classes up, all i needed to do was change the second class to public, although this seems to not work at all. I'm at my wits end on this, and if anyone could correct my code I'd be eternally greatful.
    Here is the first class... (sorry about the lack of indentation)
    >>>>>>>>>>
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20);
    >>>>>>>
    This is the second class....
    >>>>>>>
    public class PhoneButton {
    private Button butt;
    public PhoneButton(int a, int b, int c){
    setLayout(null);
    butt = new Button();
    butt.setBounds(a,b,20,20);
    add(butt);
    >>>>>>>>
    My compiler generates errors relating to Button, but i can't do anything to please it.
    Also, could anyone give me some pointers on how to add a different number or symbol to each button. That is what I added int c for, but i couldn't get it to work.
    Cheers in advance.
    Michael Morgan

    I found that there are 5 error in your code.
    1. You should import the "java.awt" package to the PhoneButton.java
    2. The PhoneButton is not a kind of Component. You cannot not add it to the Phone class
    3. the myButton = new PhoneButton(20, 20) does not provide enough parameters to create PhoneButton
    4. You cannot add a Button to a PhoneButton. Becaue the PhoneButton is not a kind of Container
    Fixed code:
    import java.awt.*;
    public class PhoneButton extends Button {
    public PhoneButton(int a, int b, int c){
         setBounds(a, b, 20, 20);
         setLabel(String.valueOf(c));
    ===========================================
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20, 1);
    ======================
    Visual Paradigm for UML - Full Features UML CASE tool
    http://www.visual-paradigm.com/

  • Need help with updateing a JTree

    I have a JList, and JTree which mimic each other. User makes selection in list presses OK and in the JTree I need the node that matches their selection to update and have child nodes under it. Can't seem to get it working right.
    right now I have this:
    Logic Trail
      item one
      item two
      item three
      item four
    after update I need this
    Logic Trail
      item one
         testing
      item two
      item three
      item four
    // in the GUI
    // pass the selected int to the method in class TreePanel
    treePanel.updateTree( questionList.getSelectedIndex());
    // here is the TreePanel class
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.DefaultMutableTreeNode;
    public class TreePanel extends javax.swing.JPanel {
      private String[] questions;
      DefaultTreeModel treeModel;
      DefaultMutableTreeNode root;
        public TreePanel(String[] questions) {
        this.questions = questions;
        root = new DefaultMutableTreeNode("Logic Trail");
        treeModel = new DefaultTreeModel(root);
        initComponents ();
      private void initComponents () {
      jScrollPane1 = new javax.swing.JScrollPane ();
      logicTree = new JTree(treeModel);
      setLayout (new java.awt.BorderLayout ());
        jScrollPane1.setViewportView (logicTree);
      add (jScrollPane1, java.awt.BorderLayout.CENTER);
    // method to update JTree, when user selects accept tree will update with new logic path
    public void updateTree(int selectedNode){
      DefaultMutableTreeNode newNode = new DefaultMutableTreeNode( treeModel.getChild(root, selectedNode));
      logicTree.setSelectionRow(selectedNode);
      DefaultMutableTreeNode logicNode = new DefaultMutableTreeNode( logicTree.getSelectionPath() );
      DefaultMutableTreeNode testNode = new DefaultMutableTreeNode(" testing" );
      treeModel.insertNodeInto(testNode, logicNode, 0);
      treeModel.reload();
    public void createTree(){
      for( int i = 0; i < questions.length; i++ ){
      DefaultMutableTreeNode questionNode = new DefaultMutableTreeNode( questions[i] );
      treeModel.insertNodeInto(questionNode, root, i );
    treeModel.reload();
    // Variables declaration - do not modify
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTree logicTree;
    // End of variables declaration
    }

    Thanks for nothing

Maybe you are looking for

  • Shift Registers not working properly with counter group .vi

    Because I'm not sure how to refer to them as a group. Well, because my previous vi only let my DAQ(STC) model no. 6020E read on one channel, I switched to a new set of .vis. They solved my channel problem, but in exchange, they introduced a set of ne

  • Can't export to tape !   Help !

    Hi, I'm having some trouble exporting an HDV sequence back out to tape from Premiere Pro CC. I click on "File > Export > To Tape". Then the "render and record" window pops up. I click ok, but instead of the render line coming up and then recording, i

  • Windows will not restart after install of itunes & quicktime, what to do?

    I installed itunes and quicktime from the disc provided. After install the installer asked to restart the computer and I clicked yes. It has not booted since. Windows 2000 Pro locks up about 75% through process. I did hear the speakers activate then

  • My Ipod was dropped and is now dented on the side.

    I dropped my iPod today, there is now a dent in the metal on the side.  Because of that the is a large black spot on the screen.  What can I do to fix this and how much will it cost?

  • How to install Solaris 10 with Win XP on 2nd Hard Drive

    hi everyone, I'm totally new to Solaris. As an enthusiast, I wants to install Solaris 10 on my Win XP PC's 2nd Hard Drive(40GB, empty) from Solaris 10 DVD. I need help from how to format 2nd Hard Drive to how can I configure the PC so it asks me whic