Jtree item question

Hi,
I'm new to Java coming from C++ background, I can't seem to find a method to retrieve the currently selected tree item.
The closest method I can see is getLastSelectedPathComponent()
Object tmp = treeMenu.getLastSelectedPathComponent();
    try {
        if (tmp.toString().equals("some text")) {...but that seems to return always the root node.
What am I missing ?

http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#select

Similar Messages

  • BOM:  Variable-size item  Question

    Hi,
    As you all know, we can set the item category as <b>R: Variable-size</b> item in BOM when creating or editing BOM via Tcode CS01, CS02,
    My question is, when we need to use Variable-size item, what's its main fuctions? could you please give me an example?
    Thanks and best regards.

    This item category is used for components that are cut to size. If you assign a material with this item category to an activity , you must also enter data for the item. The system then calculates the necessary variable-size item quantity. Otherwise processing is as for item category L.
    Example: Variable-Size Item Data for a Sheet of Metal
    Size             dimension          Entry      Size unit
    1                 Lenght             200         MM
    2                  Width             300          MM
    If you do not enter a formula, the system calculates the quantity for the variable-size item according to the standard formula:
    Size 1 * Size 2
    The result has the dimension area:
    200 MM * 300 MM = 60,000 MM2 (square millimeters)
    The variable-size item unit must have the dimension area (MM2, CM2, or M2) or you must maintain conversion factors in the material master record.
    In the customizing of Bill of materials you must maintain the formula key for variable size item category for R.
    The variable-size item quantity is used for calculating raw material requirements:
    Raw material requirement =
    Number of variable-size items * Variable-size item quantity * Required quantity
    Base quantity
    Regards
    TAJUDDIN
    Message was edited by:
            TAJUDDIN MOHAMMED
    Message was edited by:
            TAJUDDIN MOHAMMED

  • File Browse Item questions..

    Hi all..
    Please help me with these questions on ""file_browse"" item.
    I have a file browse item on a page, like in the following app.
    http://apex.oracle.com/pls/apex/f?p=62812:1
    1) when the user select a file with the browse button,we will get the
    """file path""" in the text field.
    Is it possible to validate (via javascript or any other way), whether that particular
    ""file path"" is correct and a valid file exist as per the ""file path""??The reason for this validation is, sometime our users will copy the ""file path"" instead of using the
    file browse button.
    2) http://apex.oracle.com/pls/apex/f?p=62812:1
    If users enter a valid path, but on that particular page if i have any validations,
    If any of the validations fails, it is clearing of the ""file path"" that the user entered.
    Is it possible to retain the ""file_path"" that the users entered? even if any validations fail?EX: In the following page
    http://apex.oracle.com/pls/apex/f?p=62812:1
    Please
    i)select a valid file from the ""file browse"" item and
    ii)""dont select any select list "" value
    iii) click upload.
    validation will get fired and file path get cleared.
    Thanks

    kumar wrote:
    Thanks for the reply fac...
    fac..just curious to know, what security issue do any one get , if file browse item keeps the ""file path"" they previously selected..The issue is not the server keeping the file "previously selected", but maliciously changing the value to capture a file the user does not intend to submit (e.g /etc/passwd) when the invalid page is resubmitted.
    so every time, when some validation fails, ""user need to reselect that file"".??For their own safety, yes.
    even it is in session state.. for a common user,he feels that it got cleared out and need to ""reselet "" the file again..It's a good practice to clean up any submitted files in APEX_APPLICATION_FILES should any related validations fail.
    Is there any other alternative for this issue? or It is (file browse item) just how it behaves?To ensure a secure and safe web environment it's how it's got to behave.
    Good UI design can be used to minimize the impact on users by isolating file browse items on different pages to items that are prone to validation failure, through the use of multi-page wizards etc.

  • How can I add a response to the end of each item question in an email list of questions and send that back to the originator?

    I have emails that ask for certian items to be addressed such as "please fix leak in bath sink" and then the next line will have another request and on and on. I would like to answer each question at the end of each line with a response (preferably in a different color font to stand out) such as "yes - will fix" or "that can't be done" or "you will have to fix that yourself". Then I want to send that reply back to the original sender.

    ''sfhowes [[#answer-697423|said]]''
    <blockquote>
    I suggest you consider this add-on: [https://addons.mozilla.org/en-US/thunderbird/addon/clippings/ Clippings] ([http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html How to install]).
    </blockquote>
    I did look int this but I need to have each answer different in a lot of cases but i thank you and did get an answer that does help greatly - Thanks

  • Automator: Copy Finder Items Question

    Hola,
    Quick question about the Copy Finder Items action in automator: the "replace existing files" option, how is sameness determined? In other words, according to what criteria does Automator determine that two files are the same, and so eligible for replacement in the destination folder when that option is chosen? For example, would file Mydog.doc, modified 10/14/05, 230k be viewed as the same thing as Mydog.doc., modifided 2/21/06, 150k?
    Cheers,
    stu

    As far as the Finder is concerned, the comparison is based on file name only.
    It doesn't care about file size or modification date. If the name is the same the existing file will be replaced.

  • When-Validate-item question

    Dear all,
    I have a block have 3 database items (seq_no, sname, svalue). seq_no and sname are text item and svalue is a list item.
    Number of records display for this block is 3.
    In when-validate-item of sname, I wrote a validation if sname = 'xxx' then svalue will be 'yyy'.
    The problem now I am facing is, when I changed the svalue to 'aaa' and then click the text item in another block, the validation in sname is triggered and I cannot change the value of svalue.
    Per my knowledge, the when-validate-item will be fired only when the value was changed.
    Therefore, I don't know why it was happened...
    I am using Oracle forms 10g.
    Please help. Thanks for advance.
    Regards.

    Indeed..
    Steve's suggestion about block level trigger is the right approach for this case. So I don't have to put code in many items.
    Splazm also had this nice idea about PRE-TEXT-ITEM.. It saves me from copying NULL to the item. Plus I don't have to worry about reseting the record's status cause user doesn't have the chance to set a value to the item cause he won't be able to navigate into it in the first place.
    Plus GO_ITEM is not needed cause if item is question is NULL that means that user is coming from this item and failure of trigger will just keep the focus there!
    So I combined all and came only with the following lines in PRE-TEXT-ITEM that fits perfectly for my requirement (ADEIA_ID is the item in question):
    IF NOT :SYSTEM.TRIGGER_ITEM = 'ADEIA_DETAILS.ADEIA_ID' AND :ADEIA_DETAILS.ADEIA_ID IS NULL THEN
    error message
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    Thanks all you've been of great help for this!

  • JTree sizing question...

    Hello:
    I have a JTree for which each cell contains a button. I have written a renderer that renders the button, and I realize that I have to do some special stuff to capture a click on the button. My question is unrelated to all of that.
    The problem is that over time, the labels on my buttons change (and may become longer (wider)), but the tree size does not change. In fact, when I update the button label and the tree is re-rendered the rendering of the button gets "chopped off". I've put the tree in a scroll pane, but this doesn't help - the right side of some of the buttons get cut off to the original tree size. I've tried lots of different variations on setPreferredSize, calling repaint, etc, and am not having any luck. I've put together a demonstration of this behavior in a smallish application that I'm posting here, where I create a 2 node tree with buttons that read "Hi", then I change the button labels to "Goodbye" and re-render. You'll see that the button's are cut off about halfway through the button.
    In case its important - I'm running java version 1.5.0_07 on a 32-bit Linux box.
    Any help would be greatly appreciated. Thanks in advance!
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class JTreeQuestion
      public static void main(String [] args)
        JTreeFrame f = new JTreeFrame();
        f.pack();
        f.setLocation(30, 30);
        //Draws buttons with "Hi" (short string)
        f.setVisible(true);
        ButtonNode.updateString("Goodbye");
        //Draws buttons with longer string, buttons get "cut off"
        f.repaint();
    class JTreeFrame extends JFrame
      JTree tree;
      JScrollPane treeView;
      public JTreeFrame()
        super("My Tree");
        DefaultMutableTreeNode root;
        root = new DefaultMutableTreeNode(new ButtonNode());
        root.add(new DefaultMutableTreeNode(new ButtonNode()));
        tree = new JTree(root);
        tree.setCellRenderer(new ButtonNodeRenderer());
        treeView = new JScrollPane(tree);
        add(treeView);
    class ButtonNode
      public static String str = "Hi";
      public static void updateString(String inStr)
      { str = inStr; }
      String getStr()
      { return str; }
    class ButtonNodeRenderer extends DefaultTreeCellRenderer
      public Component getTreeCellRendererComponent(JTree tree,
                              Object value, boolean sel, boolean expanded,
                              boolean leaf, int row, boolean hasFocus)
        Box theBox = new Box(BoxLayout.X_AXIS);
        super.getTreeCellRendererComponent(tree, value, sel, expanded,
                                           leaf, row, hasFocus);
        DefaultMutableTreeNode jtreeNode = (DefaultMutableTreeNode)value;
        theBox.add(new JButton(((ButtonNode)jtreeNode.getUserObject()).getStr()));
        return (theBox);
    }

    For those who are interested. The DefaultTreeModel has a method named nodeChanged() that tells the tree model that a specific node has changed, and the model re-interprets the cell causing its sizse to change as necessary, so that the full button is rendered now.
    Basically what I did was instead of calling repain, I call a method that I wrote that loops through all the tree nodes, indicates they have changed, then repaint's, and it all works out. My trees are relatively small, so this is fine, but if others face the same problem, you'll probably want to selectively indicate which nodes have changed so the tree model doesn't have to do more work than necessary.

  • JTree image question

    I have a question about using images in a JTree.
    I have like 2 parent nodes who both have a lot of child nodes now i know how to get an image for every node but how do i get 1 image for 1 parent with all his children and another image for the other parent with his children.

    It is a programming problem because i dont know how to give echt DefaultMutableTreeNode his own picture. You should think of it like msn when you log in your contacts are in a Tree and your offline contacts have a red icon and online contacts have green one. I need to to the same for my program(chat program). But i can't figure out how but i know how to give alle the DefaultMutableTreeNode's a picture but i cant give individual one's a picture.
    I hope i cleared things up :)

  • Warehouse items question

    Warehouse Item Records question  
    When creating a New Warehouse then automatically New Item records are also created. The Item Records created for the New Warehouse are empty Item records based on the Original warehouse initially created when we started the system. I wonder if these New Item Master records(empty) created are Mandatory or is it an option in the Initialisation or Setup. In other words, can I create a New Warehouse WITHOUT any associated Item Master Records, just an emty warehouse where I can add my own stock Items?
    Also, does anybody know how to Delete these new Blank Master Stock Items created in this new Warehouse.
    The main reason I want to Delete these Master Items is to enable me to Delete the Whole new warehouse I have created by mistake! At present I cannot Delete the warehouse because of all these Master items that SAP creates by default.
    Thanks for your help for this funny problem - yes it is funny because I only pressed * to search for the Codes of my existing warehouses, but I was in the ADD mode, so it crreated a new warehouse called * and a lot empty Master Item records.
    I hope this makes sense
    Robert

    Yes, SAP B1 has a feature where, when the check box to 'Auto Add All Warehouses to New Items' under 'General Settings' --> Inventory Tab.
    However, the feature works a little differently then what you've described. What it does is that it actually creates the new warehouse automatically for any newly created inventory item. This feature can come in handy when you have say, 6 warehouses setup within SAP B1 and you've just created a new inventory item. You wont have to manually add all 6 warehouses to the new inventory item.
    There is somewhat of an issue with the Warehouse form, because it opens in the "Add" mode by default, and you're not the first user to accidently hit ' * ' and create a new warehouse with the * name. When this happens, SAP B1 will auto create the * warehouse to all current inventory items.
    At this point in time, there is no method to batch remove the * warehouse except to do it manually by hand.

  • JTree#expandRow() Question

    JTree tree;
    //etc...
    1) /** Expand the tree */
    for (int i=0; i<tree.getRowCount(); i++)
         tree.expandRow(i);
    and tree.getRowCount() = 6
    2) /** Expand the tree */
    for (int i=0; i<6; i++)
         tree.expandRow(i);
    My tree has 6 rows, and each row has its own sub-tree hierarchy.
    I wonder why the first case will expand the whole tree, which includes
    the subtrees of each row.
    But in second case, it only expands the first 6 rows in the tree.
    So basically the question is why (1) and (2) have different tree view outputs??

    Well, after you expand row 1, the row count isn't 6 anymore, is it? It's something larger than that, depending on how many children the first node has.

  • JTree Updating question

    Hi there. I have two questions.
    I have a data structure that is being displayed in a JTree, so I made a Model and it works great. The data structure can be updated from non-gui interaction. The nodes don't change position or anything, its just the data that is displayed is changed. I handle it currently by calling a function in the model I made called nodesChanged(), which basically does the following:
    public void nodesChanged()
        int len = treeModelListeners.size();
        TreeModelEvent e = new TreeModelEvent(this, new Object[] {rootItem});
        for (int i = 0; i < len; i++) {
          ( (TreeModelListener) treeModelListeners.elementAt(i)).treeNodesChanged(e);
      }It does actually work, the changes are reflected in the JTree, but it seems a little expensive, and the updates to the actual data model could come at about 150 per second. To deal with that now, I just use a timer class that updates it about every 3/10's of a second, which does a pretty good job, but is there a more elegant way to do this? Something where the node is an observer of the data in the data structure (which are Observable objects)?
    The second question I have is when I do the above, sometimes the display name of the node will be larger than the value it had previously, but the Textbox (if that's what it is) doesn't grow, so I get a ... at the end.
    For example, if I have "Run" and it changes to "Stopped", it will show up as "Sto...".
    Any help would be great. TIA.

    well, you can start by making the node you put in the tree model event the lowest node in the tree that needs updating, instead of root.
    I don't know about the timer thing, cuz as far as I know, the listener will invoke code that will refresh the renderers, as opposed to painting where repaint calls can be merged into one. If you aren't getting that many updates all the time, you could implement something where the listener fires to an intermediate listener which will fire the info to the tree after a slight delay. That way if you get multiple updates, you can effectively ignore lots of them.
    The ... thing, I thought that treeNodesChanged was the appropriate method, although maybe it has to be for the specific node, not root.

  • Process Open items questions

    Hello gurus,
    I would like to ask you 1 thing if this is standard SAP behavior.
    when using transaction f-32, f-28,I select the customer and his local currency.
    Then  it picks the documents which have USD document currency also and local currency amnout is eactly like in document
    when I click on tab "currency", the amount of local currency on those lines with doc.currency USD always change accoridng to exchange ratess table tcurr
    so my question is if this is a normal behavior? if not, please suggest how to solve this, that the amnout does not change
    thanks in advance and if you have further questions, please let me know
    Hana

    This is standard SAP behaviour.
    amounts are converted as per the posting date exchange rate.

  • Foreign curr reval for open items - questions - very urgent

    Hi all,
    Can anyone explain me the account determination for open item exchange rate difference postings?
    1.     What are the accounts meant for under tab Exchange rate difference realized (Loss, Gain)
    2.     What are the account meant for under tab valuation (val loss 1, val gain 1 and Bal sheet adj 1)
    3.     Accounts under translation tab (Loss, Bal sheet adj loss, Gain, and Bal sheet adj gain)
    Also,
    When I run F.05 for open item reval
    1. Do I need to run customer and vendor open items as well by selecting the customers and vendors and checking the “Valuate customer open items” and “Valuate vendor open items”? Even though I have customer and vendor recon accounts in my g/l accounts selection and checked the “Valuate g/l open items” box
    2. We check “Reverse postings” with reversal period as next period (for example if reval is done for period 3 then reversal period is 4), why do we need to reverse the postings.
    Your help in this regard is highly appreciated and rewarded with points.
    Thanks in advance,
    Kumar

    Dear Kumar,
    About the acct determination for transaction KDF: open item exchange rate diff:
    When you revaluate i.e. run the F.05 transaction for open items any loss is posted to the Val.loss 1 and any gain is posted to the Val.loss 2 account with its offset credit or debit to the Bal.sheet adj.1 account.
    Now this is a provisional recognition of the FX difference. So long as the items remains open it will be revaluated in every period and a posting will be made. Now when you finally clear this open item e.g. pay the vendor or receive pymt from customer, the system will calculate the FX gain/loss at that time once again. This is the Exchange rate gain/loss realized. Thus, the accounts used will be those under tab Exchange rate difference realized (Loss, Gain)
    The Accounts under translation tab is used in the scenario where you are maintaining more than once local currency e.g. 2nd local currency as 30. In this case you would want to translate your FX valuation to this 2nd local currency.
    Regarding F.05 transaction:
    1. Yes you will need to check the customer/vendor and GL open items to valuate them all. Since the customer and vendor reconciliation account are tied up to AR and AP, the program does not recognize them as a pure GL account.
    2. You need reversal so that tracking of your fx valuation is easy. E.g:
    You have open item in EUR and your local curr is USD. Lets us say ex rate is USD:EUR is 1:1.50 and open payable item is EUR 100
    Open item in EUR-----Open item in USD--
    Diff
    Period 1: -
    100--150--
    0
    Period 2: fx rate 1:1.60--100160--
    loss of $10
    Period 3. fx rate 1:1.30--100130--
    gain of $30 over period 2.
    If you don't choose the reversal postings, the system will record both the loss of 10 and the gain of 30 netting to 20. However, if you choose the reversal posting, the system will reverse the $10 loss in period 3 and just take the revaluation based on the period 1's rate i.e. difference btw 150 and 130 USD i.e. $20.
    I hope this explains you the concept. Thanks,
    Vishal.

  • Hi Open item question in FI

    Hi
    Am using 2 Fi tables for BW One is BSIS and 2nd is BSAS.
    Now i want to know whether that account is open or not. As per my knowedge we can get the info from BSIS table.
    But my doubt is BSIS table should maintain one field to store the info is open or not.
    Please let me know that field name and all.
    Thanks in Advance
    Gopi Allu

    hi Allu,
    basiacally not the account but the item is open or not (the account can be open item managed). If the item is open you'll find in table BSIS, if the item is cleared you'll find in table BSAS. IF the account is not open item maanged, than all items will be in BSIS. In BSAS fields AUGDT and AUGDL will tell, when the item was cleared. in BSIS field XOPVW will tell if the item is subkect to open item management or not.
    hope this helps
    ec

  • PO line item question

    What is "PO line item"? in which table can I find it? I've joined ABAP development team and worked on MM report. Thanks!

    Yes, that is correct.  You can also use the help from any screen where you see this field. 
    Click once on the field (po item for example), and hit F1. 
    You can look at the technical details of the field and get the exact field name.
    Thanks

Maybe you are looking for

  • Multiple copies of same picture

    I have three albums on the phone; camera roll, photo library, and last 12 months. They all have the same pictures, and photo library even has doubles of everything. I want to delete all of this off the phone and only keep one copy, why can't I delete

  • How to set a viewable area with scrollbar?

    Hi, I am using a VI front panel to display an image. The VI loads an image dynamically and shows it in a picture control. The width of the panel and the picture control are set identically to match the image width, and a vertical scroll bar takes car

  • Broadcast keeps stopping...

    We are streaming a live event with two bitrates and the stream keeps stopping.  Can anyone shed some light on this problem?  I haven't been able to find anything that causes this.  Thanks for any help that you can provide.  Here is the log file: Mon

  • XML processing (Input & Output)

    Hi All, I am developing a server application that needs to wrap and unwrap an XML document in an XML wrapper (envelope) The wrapper looks like this (very simplified): <Wrapper>     <Element_x>xxx</Element_x>     <Element_y>xxx</Element_y>     <Elemen

  • Website doesn't show, after successful upload to ftp host

    I'm using muse v7 and my domain is www.fifacafe.com on Godaddy, when I publish on businesscatalyst.com the website is ok, but when I upload to ftp server it says successful but the website is totally empty