Help with developing a dynamic JTree

Hi,
I have developed a webspider that clicks on links in a website. The current url that is bein processed is stored in a string call msg. At the moment I have developed a JTree that use msg to create its nodes. But it is desplaying as follows:
root|
|-url 1
|-url 1a
| -url 2
| - url 2a
I would like my JTree to be displayed as follows:
root|
|-url 1
| |-url 1a
| -url 2
| - url 2a
So that the jtree represents the structure of the website.
How would I go about tackling this so that my tree would display like this?
here is the code that I have written for adding the string msg, which is a url to the tree:
//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;
Also would it be possible to select a node and manipulate the url to view the webpage?
mr v

I mean it displays like this:
root|
|-url 1
|-url 1a
| -url 2
| - url 2a
I would like my JTree to be displayed as follows:
root|
|-url 1
| |-url 1a
| -url 2
| | - url 2a

Similar Messages

  • Help with alignment of dynamic menu

    Hi.
    I can't for the life of me get the main meny (a bc dynamic menu) to align center on this site http://www.eaglerockfarm.com.au/home.htm. At the moment I've fudged it with a 350px left margin, but that only looks ok on smaller screens, larger ones, It's to the left and smaller, i.e an ipad, it's to the right.
    I have a div id in the css "nav2" with text-align:center, but when I inspect the element (q) in Firefox, it crosses out that line. I also tried putting in the text-align:center inline, but nothing seems to work...I am not a developer, but have an average understanding of css and html...
    Can anyone assist please?
    Thanks.

    Hello justasking506,
    To bring your main menu to center just change the div#nav2 to:
    div#nav2 {
        font-size: 14px;    height: 20px;
        margin: 0 auto;
        padding-bottom: 10px;
        padding-top: 10px;
        width: 633px;
    Here you can see that I've changed the margin to "0 auto", that will put auto margin on the left and right of the div. Now the width needed to be a little bigger to center the div.
    I would also suggest not using the default dynamic menu type. This is using tables to output your navigation. Instead I would suggest using the CSS(HTML Only) menu type, this will use an unordered list and will allow you to use your own css to position the navigation. I go over how the dynamic menus work in this video:
    http://bcgurus.com/tutorial/how-to-create-business-catalyst-dynamic-menus
    Hope this helps,
    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

  • Using Search Help with ALV and Dynamic context node

    The topic subject already describes my situation.
    I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
    This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
    Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
    I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
      CALL METHOD lo_nd_info_root->add_new_child_node
        EXPORTING
          static_element_type          = vs_tabname
          name                         = 'SAMPLE_NODE_NAME'
    *    is_mandatory                 = abap_false
    *    is_mandatory_selection       = abap_false
         is_multiple                  = abap_true
         is_multiple_selection        = abap_false
    *    is_singleton                 = abap_false
          is_initialize_lead_selection = abap_false
          is_static                    = abap_false
        RECEIVING
          child_node_info              = lo_nd_info_data .
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
          parent_info = lo_nd_info_root
          node_name = 'SAMPLE_NODE_NAME'
          structure_name = vs_tabname
          is_multiple = abap_true ).
    The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.

    I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
    The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
    Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
    Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
    Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening.

  • Need a help with Struts Tiles dynamic menu

    Hello,
    I am started few days ago with Tiles, try to develop web application.
    Can anybody sugest very simple example with Tiles and menu.
    So my definition looks like this:
    tiles-def.xml
    <tiles-definitions>
    <definition name="MainDefinition" path="/layouts/myLayout.jsp">
    <put name="title" value="This is the title." />
    <put name="header" value="/tiles/header.jsp" />
    <put name="menu" value="/tiles/menu.jsp" />
    <put name="body" value="/tiles/body.jsp" />
    <put name="footer" value="This is the footer." />
    </definition>
    I am simple layout.
    I need to on menu click change body content, now i am doing it like this:
    index.jsp
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%String body = request.getParameter("body");%>
    <tiles:insert definition="MainDefinition" flush="true">
    <tiles:put name="body" type="string"> <%= body %> </tiles:put>
    </tiles:insert>
    But now body is a string how to make it open url?
    Maybe somebody have link to menu Tiles good examples.
    Thanks

    But here's some useful advice :P
    I'm going to assume that the other two people involved in this have a bit more experience, have them do most of the designing. Have them leave most of the easy stuff for you. You can then spend your time learning the minimum of what you need to know. And if you have problems, or don't understand things, ask your partners for help.
    And you'll want to set some spare time for you to all get together and do something fun so that you don't kill each other because of the stress :P
    I've had a lot of bad project experiences, fortunatly they where all just at school :P I blame myself, mainly because I didn't do the whole thing myself (mostly because I listened to people when they said that I shouldn't or couldn't do everything myself.) I'd like to say that it's mostly because of poor communication, and disorganization, but an awful lot of it had to do with the fact that I tend to be the only person with any work ethic what so ever.
    But whinning and repressed memories aside, good communication and organization help a lot. Come up with a good system with your team mates. And don't be afraid to ask questions. And don't worry about dividing up the work load equally. Just make sure you put in a good amount of effort, if not frightening amounts.
    If all of you are clueless, divide up the learning stuff between yourselves too.
    I have no experience with Struts. I've done a bit of stuff with XML, but nothing too complicated. The XML by itself tends to be extremely easy. What you plan on doing with it can vary (I don't like XML incidentally :P)
    Other then that, good luck.

  • Help with ecomerce and dynamic table link

    I am new to dynamic pages. I am trying to build or use a
    template to display my tables.
    Here is an example of what I want to do.
    http://www.snaz75.com/ if you
    click on any of the links on the left side, it brings up the
    products on the right. I know this is done through tables. I have
    the website built and the tables built, but don't know how to get
    the product to display dynamically without manually adding each
    item.
    I am using yahoo e-commerce and have downloaded their table
    formats. I have all the tables created and uploaded to my hosting.
    I am trying to use these tables to display my product in a simple
    way. Yahoo has a site builder where you can build tables and upload
    them and your product is displayed, but I am extremely limited on
    the actual design of their website builder. I want to use my
    website, but do essentially the same thing. How can I get the built
    tables display my products. I have 1000's of products and I know
    there must be a way display the item through a table using
    template.. I can't imagine someone adding one item at a time to
    their website. Any idea's where to start.

    I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
    The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
    Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
    Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
    Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening.

  • Need help with developing a small pool game

    Hi,
    I want to develop a small pool game ....Im using the netbeans ide and ....what I have so far is 2 classes ......Pool and GUI
    Basically the main method is in the Pool class.......withing main I created a new GUI object .....which in turn creates a frame.
    I now want to custom code a rectangle and make it a container for the pool table and also colour it......the thing is can I do animations in a frame and by using independant classes rather than using an applet?
    I know this may be innefficient but I want to create a standalone pool game that uses custom objects and classes for the various tasks. I was just wandering if it was possible to do drawings the way i am saying without using an applet? Its just all the tutorials I see .....well all the code seems messy and lumped together in the one place ....and I basically want things such as a independant ball class and perhaps a painter custom interface that colours rectangles.
    Any advice would be appreciated
    David

    Thanks for the advice .....The thing is I understand pretty well what is needed .....and I have programmed small applications that take bookings for a hotel and and a library ....Im am familiar with references, arraylists and the alike and im also reading about the java collections interface ......I have also coded a simplistic program in the past that basically a ball was bouncing of the sides of a container and made a sound when it hit the edge(this used threads i believe). However it has been a while ......and although I am happy with some of the concepts of java........we did not do any java graphics programming at college. In all fairness though I learned the importance of using classes properly and in a way thats why im finding it so difficult to code even basic graphic movement that Im happy with as the tutorials Ive seen have everything lumped in one place(as mentioned) and trying to make them more modular can be difficult. As far as I know from coding some basic applets they are generated on the client side to enable everyone with different platforms to view stuff over the web. I dont want applets as I dont at this time want to distribute any of my meager programs over the web :-)). It is good to know that I can use threads and such independent of the applet class........I know my question may be naive but 100% of the tutorials I saw invoked the applet class in some way and emplied in a way that it was essential.......I thought there would be a way to do it without using applets but was not 100% sure which is why I asked.
    I will just need to try and find one guide now that actually shows me how to do what im asking:-)
    Cheers
    David
    I also have 3 java books.......each of which concentrate on graphics by use of applets ....im going to look them out again as they might contain something useful .....to be honest though they were a bit of a waste of money lol(well 2 of them were)

  • Help With SUBSTR in dynamic SQL statement

    Following is the dynamic SQL statement.
    EXECUTE IMMEDIATE 'UPDATE table_name pml
    SET pml.'|| con_fields.field ||' = SUBSTR(pml.'||con_fields.field||' ||'' ''||
    (SELECT pml1.'||con_fields.field||'
    FROM table_name pml1
    WHERE pml1.grp_id = '||los_concats.grp_id ||'
    AND pml1.row_id = '||los_concats.row_id||'
    AND pml1.loser_flg = ''Y''),1, '||con_fields.max_length||')
    WHERE pml.grp_id = '||los_concats.grp_id ||'
    AND pml.loser_flg IS NULL ';
    what it does is that it updates a particular field. This field is concatenated by a field of a similar record.
    My problem is with SUBSTR function. Since I am concatenating fields I do not want the field to be updated greater than max_length on that field, the reason why I use SUBSTR. the select query inside SUBSTR works alright with one of the AND condition in a WHERE clause not present. When I add that additional condition it gives me this error.
    ORA-00907: missing right parenthesis.
    Is there any way to get around this problem. Does SQL has other than SUBSTR function which can limit the character length.
    Appreciate it.

    The other alternative I thought about was to do this first
    EXECUTE IMMEDIATE 'SELECT pml.'||con_fields.field||'
    FROM table_name pml
    WHERE pml.grp_id = '||los_concats.grp_id||'
    AND pml.row_id = '||los_concats.row_id||'
    AND pml.loser_flg = ''Y''
    ' INTO v_concat_field;
    write into the variable v_concat_field and then use it into the previous script.
    But on this I get SQL Command not properly terminated, I don't get it Why?
    Donald I tried with your suggested script. It works fine with one of the conditions eliminated. I don't understand what the error trying to say?
    Thanks

  • Help with developing a POS Software

    Hello I have recently came witht developing a POS system for a client. I have a problem with one of the requirement of my client. This software has to be capable to capture and incoming caller id and auto fill in a program filed so it will automatically
    sorted out with client database. 
    Any idea what should i do ? I have tried to do it with Tapi but no luck.
    Thank you and regards

    See webpage below for all the manuals. You need to get the software programmer manual which should contain all the modem commands. Not sure which model you are using. You will need to send and receive the modem command and make connections and then send
    the POS commands to the USB device. http://www.avm.de/en/Download/index.php3?js=enabled
    jdweng

  • More 401 error help with developer tool

    Ok so last night I posted about getting this 401 authentication error whenever I tried to download the SDK.   I fixed my problem by creating a new developer account.   That let me download the sdk.   Now this morning when I'm ready to try some sample code from the SDK I can't seem to stay authenticated in the developer tool at https://afcs.acrobat.com/  or https://cocomo.acrobat.com/.   Any time I try to do something like download the sdk again, or add a room it tells me I'm not authenticated.   If I refresh the page it asks me to login again.
    I've tried this with flash player 10 in safari, firefox, and ie.   Then I downgraded to flash player 9 and tried again in IE.    Has anyone else gone through this?   Is there just something simple that I'm missing here?
    Thank you,
    Eric

    Wow thanks for the fast response I really appreciate it.   I used
    HTTPLiveHeaders to capture me going to https://afcs.acrobat.com.   Then I
    logged in as [email protected]   After I was logged in I clicked on the
    download sdk link.   I've attached the header results in a file.   I don't
    really have an afcs applications yet I just started this yesterday (although
    I've been doing a lot of flex development).
    I was able to download the sdk once when I create a new account and once out
    of the many times I tried to login today.
    Thanks!
    Eric

  • Please help with developing a simple application

    I have small reference book that is falling apart, that I can no longer get a copy of, and would like to get it put onto my iphone. It's a book I use often.
    I just want to be able to put in a number or title name and have the app find the text. I'm prepared to enter all the text, but have no idea where to go from there. It's only for mine and my brother's use, so not worth paying for it to be done.
    Can anyone help me?
    Thanks in advance,
    Kerrie.

    Hi Kerrie,
    The resources provided here: http://developer.apple.com/ will help you create an iPhone application.
    If you don't want to create the app yourself, you can look for a consultant here: http://consultants.apple.com/
    -Jason

  • Help with a 2d dynamic graph question

    Post Author: eseidel
    CA Forum: Other
    I have a subreport that I'm having a lot of difficulty with and I dont know if I've hit the limitations of CR or I just don't know how to do it.  I need to set the subreport graph parameters on the fly and I can't figure out how to do this.  Here is the situation:
    My report prints a vendor report card, one vendor per report page.  For each vendor, I need to access a table and pull all parts that the vendor supplies our company with.  Then, I need to create a seperate 2D bar graph for each part that is listed under the vendor.  Since this is a subreport and would run for each vendor, and each vendor can have 1 to n-number of different parts, I need to create these graphs on the fly. Is this possible?  Any suggestions.  The furthest I have gotten was I can create a OLE DB(ADO) command that retrieves the parts for each vendor. 
    But from there I am stuck.  Once I have these parts per vendor, how can I iterate through them and create a new 2d bar graph for each one?  The graph itself would display on the x axis all of our vendors that supply us with a part, ranking them.  So if a vendor supplies us with Rubber Hoses, magnesium and Aluminum then I would need three graphs, one for each, Rubber Hoses, Mag, Al that would list the vendor on the x axis and points on the y axis pertaining to that specific part.  Understand?  Is this possible?  Help please.  Thank you.
    Eric

    Faster than an if statement, if you are up to learning it, is the use of the ternary operator.
    It's syntax is like this:
    condition ? value1 : value2
    where condition is a boolean expression, value1 is the expression to be evaluated and returned if and only if condition is true, and value2 is the expression to be evaluated and returned if and only if the condition is false.
    Your line of code would be something like:
    System.out.print(maze[i][j] == 0 ? "*" : " ");Edit: I am not assuming people are newbies when they are, I realize this.
    Message was edited by:
    Aken_Bosch

  • Flex 3 need help with panels in dynamic tabs

    I am building an app where the user can add tabs as needed.  Each tab will have 4 panels inside
    it.  I can't get my for loop to build the panels.  It keeps erroring out.
    So question is  1) How do I create these with a loop and 2) I am wanting to put data from a data provider in here.  How can I reference the panel in the vbox in the tab control in the future?  Thanks in advance.
    PS...any reason why I can't get newPanel.width="100%" to work? Tried multiple ways. Thanks.
    private  
    function addNewTab():void{ 
    if(labelText.text!=""){ 
    var newVbox:VBox=new VBox(); 
    var newLabel:Label = new Label(); 
    var newPanel:Panel=new Panel() 
    newVbox.label=labelText.text;
    dbtabs.numChildren+1
    numChild = dbtabs.numChildren + 1;
    var i:int 
    for(i=0;i<4;i++){
    newPanel.title=
    "Panel";newPanel.layout=
    "absolute"; 
    //newPanel.width="100%";
    newVbox.addChild(newPanel)
    newVbox.addChild(newPanel)
    newwLabel.text =
    "Content here";newVbox.addChild(newLabel);
    dbtabs.addChild(newVbox);
    labelText.text=
    else{Alert.show(
    "You must enter a tab name") 
    // validate labelText

    NewPanel.percentWidth=100

  • Help with Developer Toolbox...

    I am getting the following message when I try to download a file by clicking on the link that was created by the download file server behavior: (ERR_DOWNLOAD_FILE_NO_READ)
    Can anyone help?

    please provide us a complete vision of your script or what ever your are doing.
    because you miss many things in your question such as what comes before this error or after it... thank you

  • Help with picking up dynamic url

    Basically, I am trying to get the url from the application, and set some rules so that flex will call the right ColdFusion template depending on what server this application is running on like dev, staging or production. The application is for uploading a csv file. A coldfusion page reads some values from the csv file, and inserts/updates some db records.
    I have the following:
    [Bindable] private var _strDomain:String = new String("http://dev.domain.com/");
                [Bindable] private var _strUploadScript:String = new String(_strDomain + "ubs/upload.cfm");
                private var unid:int = 0;//Application.application.parameters.unid;
                // Initalize
                public function initApp():void {
                    _strDomain = mx.core.Application.application.url;
                    var index:int = _strDomain.indexOf("/Intranet");
                    _strDomain = _strDomain.substr(0, index);
                    _strUploadScript = _strDomain + "/Intranet/ubs/upload.cfm";
                    mx.controls.Alert.show('a:'+_strUploadScript);
                    Security.allowDomain('*');
    there are several issues. if i get rid of all the stuff in initApp and run this in dev by calling:
    http://dev.domain.com/ubs/upload.cfm
    it works great.
    It doesn't seem like initApp() changes the _strDomain, _strUploadScript right. If i get rid of the above vars, then I get all sorts of 'access of undefined property errors'.
    The initApp is called by  creationComplete="initApp()". I am new to flex 3/as 3 and cannot resolve this issue. What am I doing wrong? thanks in advance.

    out.print("db=pubmed&");
    out.print("term="+term+"&");
    out.print("dopt=XML&");
    out.print("SendTo=File");Surely all that goes on the end of the URL, not in the output stream? It's not HTTP.

  • Help with Data Matrix (2D) barcode

    Hey everybody,
    I need a little help with creating a dynamic Data Matrix barcode. The DM Studio help files explain the barcode, regions, data code words, etc, but don't really help with implementation of one. I can create a static one using the actual Barcode widget in DM Studio, but I'm unsure how to create a dynamic one. Minimally I'd need to change the barcode's content from document to document, but if you use the barcode object in your section, it doesn't appear as though it allows variables or variable information (i.e. DAL script results). We have 3 of 9 barcodes, but we create those by simply using the 3of9 font when outputting the barcode's content. With the Data Matrix barcode, that doesn't seem like the appropriate course of action because of additional attributes like Scale or Symbol Size.
    Thanks,
    Gregg

    Hi Gregg,
    I would request you to try like this.
    1. First insert a normal field (not a bar code).
    2. Change 'Type' to Barcode.
    3. Change 'Format' to Data Matrix.
    4. Change 'Length' to 11.
    5. Change Symbol size, Scale appropriately.
    6. Use Rule as usual you would do for a normal field.
    7. Use Data Matrix bar code fonts (13504, 13505, or 13506) which are included with Documaker. If you have any other specific font for Data Matrix bar code, you may try that as well.
    These steps should allow you get a dynamic bar code.
    Thank you.

Maybe you are looking for

  • Macbook Air not starting at all

    Hi, i have a MacBook Air 11" (mid 2011), purchased in Australia. the other day I powered it down, unplugged the power, re-plugged, and it won't start at all. no beeps, no fan noise. Green light on the Magsafe connector. Magsafe power works on a diffe

  • Multiple Radiogroup ?

    Hi everbody, I need to make a survey page and there will be 30 questions with 5 choice every one of them. Like: Faculty is fully qualified 1 2 3 4 5 1:certainly agree 2:agree 3:almost 4:do not agree 5: certainly do not agree I create a table like: qu

  • Problem in transfering data from DSO to InfoCube

    Hi, I am trying to transfer data from DSO to Infocube. But it is giving the following message. Last delta update is not yet completed Therefore, no new delta update is possible. You can start the request again if the last delta request is red or gree

  • Photoshop CS4 file associations (Vista) - fix

    --Only tried on Windows Vista - For those who upgraded from Photoshop CS3 to CS4 and lost the ability to associate Photoshop with specific file extensions (like .jpg) because it didn't show up in the "Openwith" list.  You might want to try this fix:

  • Used by someone else

    music plays for a moment on airplay and then switches back to iPad/iphone/mac. Get a message Apple TV (2) is being used by someone else.