How to replace original JTree node with + and - sign or icon??

Dear friends:
I have following code for JTree:
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
public class TreeSample {
  public static void main(String args[]) {
    JFrame f = new JFrame("JTree Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = f.getContentPane();
    JTree tree = new JTree();
    JScrollPane scrollPane = new JScrollPane(tree);
    content.add(scrollPane, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);
}Here, when I click any node to explore its children, right handle pointer become down handle Pointer, but if I hope to change this right handle pointer to + sign or icon; and to change this down handle pointer to - sign or icon; how to do it, ??
Is there any simplest way instead of using ImageIcon ????
Thanks
sunny

You have to use Windows look and feel instead of Java look and feel.
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#display

Similar Messages

  • How to replace # or Not assigned with blank in BEx Query Output.

    Hi,
    While running the query through BEx Query desginer or Anlayser, I am getting # or Not assigned where there are no values.
    The requirement is to "Replace # or Not assigned with a blank" in the output.
    I want to know, is there any setting in BEx query desginer where we can do this. How to do this.
    Please share your inputs on this. Any inputs on this would be appreciated.
    Thanks,
    Naveen

    Check out SDN-thread: "Re: Remove 'Not assigned'" for more details
    Ideas from SDN research:
    "a solution i have used is to put each RKF column in a CKF colum then in each CKF use RKF + 0, the outcome is that your # should now be 0s, in the query properties you can set the option to display 0s as blank."
    "try to enter a text for the blank entry in the master data maintenance of the relevant objects and set the display option for the objects to 'text'."
    Threads:
    SDN: How to replace # or Not assigned with blank in BEx Query Output.
    SDN: Re: Remove 'Not assigned
    SDN: How to replace # or (Not assigned) with blank in BEx Query Output.
    SDN: Bex Analyzer : Text element system's table ?  
    SDN: change message in web application designer ["nonavailable" ->  136 of SAPLRRSV]
    SDN: Not Assigned ["Not Assigned -> 027 of SAPLRRSV]
    SDN: replacing '#'-sign for 'not assigned' in queries
    SDN: # in report when null in the cube
    SDN: How to replace '#' with blank when there is no value for a date field
    Edited by: Thomas Köpp on Sep 13, 2010 5:20 PM

  • HOW CAN I PUT THE AMOUNT WITH THE SIGN OF DOLLAR?

    HI!
    HOW CAN I PUT THE AMOUNT WITH THE SIGN OF DOLLAR?
    BECAUSE WHEN I WRITE THE DATA THE AMOUNT OVERWRITE THE SIGN.
    THANKS PEOPLE

    THIS IS THE WRITE PART:
    [code]
    WRITE:
              /97 t_bsid-dmbtr,          "Invoice Amount
              104 '$',
              104 t_bsid-fecha,          "Payment Date
              114 t_bsid-pago,           "Payment Amount
              116 '$'.
    [/code]

  • How to configure Exchange 2013 OWA with Single Sign On

    Hi All ,
    How to configure Exchange 2013 OWA with Single Sign On ?
    Thanks .

    Hi,
    From your description, I am not quite sure what you really want to achieve. Could you explain it furthermore? If you need to set up Exchange 2013 OWA single sign on with Exchange 2010, here is a helpful thread for your reference.
    Exchange 2013 OWA Single Sign on with Exchange 2010
    https://social.technet.microsoft.com/Forums/en-US/2899ebfc-8622-4cdc-8d77-d76b607618f7/exchange-2013-owa-single-sign-on-with-exchange-2010?forum=exchangesvrdeploy
    If that is not your case, please feel free to tell me.
    Best regards,
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Amy Wang
    TechNet Community Support

  • How can I REPLACE original RAW files with JPG's and keep my 'Develop mode' edits?

    An image describing my problem:
    http://i.imgur.com/hcqMYkv.jpg
    (Lightroom 5)
    'edits' = Edits made in develop mode.
    'CR2' = My RAW image file format.
    I have existing CR2's with edits for them saved in Lightroom.
    I want to replace the CR2's with JPG's, and do nothing else. I want those JPG's to inherit the CR2's edits, but I DO NOT want the edits to be permanently applied to the image.
    If I export the CR2's (which have edits) to JPG's, the edits will be permanently applied to them. I do not want this.
    If I export the CR2's to JPG's without the edits, I have no way of getting the edits back and will have to redo the work if I use that photo again.
    Any solutions? I've been trying for a while and have no idea how to do this.
    Q: Why not keep the CR2's?
    A: I am uploading these files to an online host (S3) as my primary storage method and uploading CR2's takes way too long with my internet speeds. Furthermore, online storage costs money.
    Q: Why not shoot with JPGs instead of shooting raw?
    A: I do my initial edits with the raw files and then archive them as JPG's to save storage space. They won't be raw anymore if I apply future edits, but I still have the option of retouching them from the 'original' state and still have my old edits preserved.

    Probably the best thing for you to do is simply use lossy DNG format (e.g. export as, or convert to..): raw data is re-formatted with jpeg compression (full-rez or reduced-rez), but all raw settings apply.
    If you insist on trying to have a true jpeg file with (mostly) raw settings, then:
    The simplest way I can think of to do it without a script or plugin:
    * Reset the raw photo (consider preserving things that don't translate well, like profile-based lens corrections and white balance).
    * Export jpeg
    * Un-reset the image (e.g. using edit history or pre-reset snapshot).
    * Sync settings from raw to jpeg (note: omit settings that don't transfer well, or that were not reset..).
    * Optionally: Delete raw
    To automate/streamline would require a script or plugin.

  • How can I add a node with with a user-chosen name  to JTree in one action

    The functionality that I would like to implement is to add a new node to a tree (JTree with DefaultTreeModel), that during the adding process of the the new node the user will type the node name.
    I am using the following documentation as a reference: http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#select
    but in this example (as well as all the other examples that I found on net) the user can add first a new node with a constant name (like "NewNode").
    and then in a seperated action the user can edit this node. I'd like to perfrom it in one action.
    one solution that could be implemented is on the end of the adding node invoking beginning of editing action that will be triggered in code instead of forcing the user to click with the mouse on the selected node. The question is how can I do it? how can I trigger an edit action on a selected node in a JTree?
    Edited by: Rotshield on Aug 23, 2008 2:21 AM
    Edited by: Rotshield on Aug 23, 2008 2:24 AM
    Edited by: Rotshield on Aug 23, 2008 2:29 AM
    Edited by: Rotshield on Aug 23, 2008 2:29 AM

    Ah, well.
    You can lead a horse to the water but you can't make it drink.
    Just to provide some background, I'm not a developer, just a hobby programmer and first took up Java less than 14 months ago. I didn't know the answer to your problem, but on reading the API it was fairly clear which method I'd have to make use of. In less than half an hour of coding, I had a JFrame with a JTree and a JButton to add a node, which was immediately in editing condition.
    Try to find another profession, Rotshield. Or at least don't disgrace the community by calling yourself a Java developer (for 4 years lol) until (if ever) you learn how to read and apply an API.
    db

  • How to replace typewriter (straight) apostrophe with typographic (curly) apostrophe?

    I have a manuscript I got off the Internet that has a bunch of isn?t's and wasn?t's and the like—due, I assume, to some miscommunication between MS Word's automatic curly quotes and the ASCII limits of ISO Latin 1. I tried doing a find-and-replace to put typographic apostrophes in place of the question marks. Pages found the question marks and put typewriter apostrophes in place of them, though I'd carefully entered a typographical apostrophe ((opt-shift-]) in the Replace field. So I tried again, to replace the typewriter apostrophes with typographical apostrophes. Pages now replaced the few typographical apostrophes I'd manually entered with typewriter apostrophes. Well, at least it's consistent. So far as Pages, Apple's flagship word-processing/page-layout app is concerned, there's apparently no such thing as a typographical apostrophe—something that was understood, as I recall, by the original MacWrite 25 years ago. So do I have to go back to doing all my editing in TextEdit (which seems to be much better at text work than Pages), or can somebody tell me how to persuade Pages to take care of this trifling little task correctly?

    Copy these two paragraphs into a Pages WP document:
    When you?re sleep deprived… parental control of baby?s sleep… meet baby?s needs consistently… respond to baby?s cries…
    "Parents should recognize that having their babies cry unnecessarily harms the baby permanently," Commons said. "It changes the nervous system so they?re overly sensitive to future trauma."
    Open the Find & Replace dialog. Enter Find: ? and Replace: ’ (opt-shift-}). (I.e. replace question mark with typographical apostrophe.) Click Replace All. It should say 5 Replaced. Check any of the replacements by enlarging the type; you’ll see an ASCII apostrophe ['] rather than the requested typographical version [’].
    Then enter Find:  " (space-") and Replace:  “ (space-opt-[), and click Replace All. It will say 1 Replaced, meaning the quote mark preceding "It" in the second sentence (the only quote mark preceded by a space). Enlarge the replacement to see it clearly; it's replaced an ASCII " with another ASCII ".
    So far as I can tell, Pages’ Find-Replace function can't tell the difference between ASCII apostrophe/quote marks and the typographical versions. Maybe it will once you turn on smart quotes in preferences; I haven't tried that -- but then of course you'd get smart quotes when you don't want them, for instance for something to be posted on an Internet forum, which often doesn't understand them. (The problems above and similar, often seen on the 'Net, are due to MS Word's having smart quotes on by default, so unaware users compose material with them and send it out over teh Interwebz, where they sometimes come through correctly, sometimes don't.)
    Try the same experiment in TextEdit; you'll get the requested typographical versions. And so I did, then copied the text back to Pages. Like I said, kinda shoddy for Apple's Pride & Joy word processor. AppleWorks, by the way, does it right.

  • MacBook hard drive is full again. Replaced original hard drive with a Samsung SSD 840 Pro Series 256GB hard drive about 18 mo. ago, but my MacBook is now already saying that my hard drive is full again.  13in. Alum. Late 2008 MacBook

    My MacBook hard drive is full again. I have a 13in. Aluminum, Late 2008 MacBook, and about 18 months ago (in October 2013), I replaced the original hard drive with a Samsung SSD 840 Pro Series 256GB hard drive. However, my MacBook is now already saying that my hard drive is full again.  When I check "System Information," under "Storage," it states the following:  Audio 52.02 GB; Movies 33.68GB; Photos 43.13GB; Apps 14.76 GB; Backups 174.4 MB; and Other 96.39GB.
    Also, at home, I have an Apple Time Capsule 4th Generation 2TB that I use as my wireless router, and I also use it for automatic backup via Time Machine.  And when I first purchased Time Capsule, the first time I connected Time Capsule, Time Machine asked if I would like to use it to back up my files, and I clicked, "Use as Backup Disk."  And that's really all I've ever done with Time Capsule.
    In addition, I also have a LaCie Porsche Design P'9223 1TB external hard drive.  I have copied my MacBook's hard drive onto my LaCie external hard drive.
    Does anyone have any suggestions?  Obviously the Audio, Movies, Photos, and Apps are taking up a lot of space... Any suggestions re: what I can do with Audio, Movies, Photos, and Apps?  And what about the Other?  Other is taking up 96.39 GB. What is Other, and what can I do about it? 
    And what about partitioning my hard drive... Is that something I should do?  Should I partition, or configure, my MacBook's internal hard drive differently?  And should I partition, or configure, my external hard drive?  And if I need to partition, or configure, my MacBook's internal hard drive differently, how do I setup Time Machine to backup per any such changes?  Same thing for my external hard drive?   
    13in. Aluminum, Late 2008 MacBook, 250 GB (with upgraded Samsung SSD 840 Pro Series 256GB hard drive)
    Processor 2.4 GHz Intel Core 2 Duo
    Memory 2 GB 1067 MHz DDR3
    OS X 10.9.5
    plus
    Apple Time Capsule 4th Generation 2TB
    LaCie Porsche Design P'9223 1TB external hard drive
    Thank you for your help.

    Partitioning makes no sense. You have a drawer full of stuff. Split it into two smaller drawers and you have two smaller drawers full of stuff.
    Decide what you can store on external storage - your iPhoto/Aperture/Lightroom libraries can all be stored on externals, as can your iTunes Libraries and so on. Do you need to carry 30 gigs of movies with you all the time? You  can get portable drives the size of an iPhone these days.

  • JTree Nodes with the same name

    What do I have to do to get the JTree to render nodes with the same name? These Nodes user objects are completely different object types and each has a unique hashcode.
    + Root Node
    +-- node1 (this is a folder)
    +-- node1 (this is a file)
    The problem is I have n folders in my tree but if a parent folder contains a folder and a file with the same name then no other subfolders are displayed.
    The nodes exist in memory because I enumerate the tree and display its contents in System.out.
    Thanks in advance!
    Matt

    Thank you to everyone that responded. I solved the issue. It was a timing issue...here's my original method:
    private void renderProductFolder(SubFolder sf){
    try{
    WTPart part = QueryHelper.service.findWTPart("number", sf.getNam());
    WTTreeNode node = buildWTTreeNode(part);
    super.getTreeModel().setRoot(node);
    renderTree(node, sf); // This is the problem call
    super.getSelectionModel().
    setSelectionPath(new TreePath(node.getPath()));
    super.expandPath(new TreePath(node.getPath()));
    }catch(Exception ex){
    ex.printStackTrace();
    Here is the fix:
    private void renderProductFolder(SubFolder sf){
    try{
    WTPart part = QueryHelper.service.findWTPart("number", sf.getNam());
    WTTreeNode node = buildWTTreeNode(part);
    renderTree(node, sf); // This was the problem call
    super.getTreeModel().setRoot(node);
    super.getSelectionModel().
    setSelectionPath(new TreePath(node.getPath()));
    super.expandPath(new TreePath(node.getPath()));
    }catch(Exception ex){
    ex.printStackTrace();
    I was originally building the root node, then setting it as the root, then adding additional nodes to the root in the call to renderTree(). So the fix was to build the complete tree structure and then call setRoot(). Otherwise the tree doesn't automatically paint the nodes when they're added via node.add(nodeChild).
    It was just a coincidence that I discovered this problem with nodes having the same name.
    Thanks for all your great input!
    Matt

  • Xml in JTree: how to not collpase JTree node, when renaming XML Node.

    Hi.
    I'm writing some kind of XML editor. I want to view my XML document in JTree and make user able to edit contents of XML. I made my own TreeModel for JTree, which straight accesses XML DOM, produced by Xerces. Using DOM Events, I made good-looking JTree updates without collapsing JTree on inserting or removing XML nodes.
    But there is a problem. I need to produce to user some method of renaming nodes. As I know, there is no way to rename node in w3c DOM. So I create new one with new name and copy all children and attributes to it. But in this way I got a new object of XML Node instead of renamed one. And I need to initiate rebuilding (treeStructureChanged event) of JTree structure. Renamed node collapses. If I use treeNodesChanged event (no rebuilding, just changes string view of JTree node), then when I try to operate with renamed node again, exception will be throwed.
    Is there some way to rename nodes in my program without collpasing JTree?
    I'am new to Java. Maybe there is a method in Xerces DOM implementation to rename nodes without recreating?
    Thanks in advance.

    I assume that "rename" means to change the element name? Anyway your question seems to be "When I add a node to a JTree, how do I make sure it is expanded?" This is completely concerned with Swing, so it might have been better to post it in the Swing forum, but if it were me I would do this:
    1. Copy the XML document into a JTree.
    2. Allow the user to edit the document. Don't attempt to keep an XML document or DOM synchronized with the contents of the JTree.
    3. On request of the user, copy the JTree back to a new XML document.
    This way you can "rename" things to the user's heart's content without having the problem you described.

  • How to replace original submit_mc?

    Hello
    I have an FLA file which came with an online tutorial on how
    to send emails from Flash MX 2004.
    I wish to incorporate it into my own site and have done most
    of the work which this involves.
    However, the original came with a huge, ugly 'Submit' button
    (submit_mc) and I would like to replace it with my own JPEG
    'Submit' button which is more subtle and attractive.
    How do I replace the original with my own, that is, how do I
    substitute my own while assuming all the properties of the original
    submit_mc?
    Many thanks.
    Steve

    Steve,
    If the original .FLA file has all the graphics in the
    library, you should be able to get the properties of that submit
    graphic in terms of dimensions and pixel size. Create your own
    button with those dimensions, and then, go into flash, view the
    properties of the ugly submit button (the original graphic, not the
    movieClip) and there should be an "Import" button. You can choose
    this and if you import your graphic, it should replace the old one
    with yours. I don't have MX2004 here, so it's possible that button
    is called something else, so someone can let me know if I'm wrong
    there. That should do it.
    - B

  • How can you repair "invalid node structure and invalid b-tree node size"

    I have a MacBook Pro 17"  and the original install disk is Mac OS 10.4.  I have an update 10.6 install CD, but I cannot use it to boot up my computer.  My computer had been running on 10.6 when the problem occurred.
    It seems my harddrive has crashed. It only boots to apple logo and spins.  I have reset the pram. Started up in safe mode with shift pressed down and started up on the start up disk,  where I did repair disk and got this "invalid node structure invalid b-tree node size".  Then it said repair failed to complete.  I tried booting again but it still failed. I thought doing a restore might solve the problem.  I have a month old backup with time machine which is on a lacie external drive, but when I try to restore using my original 10.4 install disk, I can only choose the lacie hardrive icon (by dragging) and cannot choose the folder in the backups with the latest backup.  When I tried to restore, it says my source is not a valid option.  Is this because it is a 10.4 startup disk.
    Basically I have two questions:  Is there a way to fix my problem without doing a restore and if I have to restore, how do I restore my time machine backup?  Will I need to do a reinstall with 10.4 and then update to 10.6?
    I really hope to find a way to have my computer back to how it was when it started spinning and if not, at least as it was when I did the latest backup 3 weeks ago. 
    Please help me!!! 
    Rebecca

    You should be able to boot to the Snow Leopard upgrade disc — you had to do so to install the upgrade in the first place. If you can't boot to it now, either the disc is scratched or dirty or your drive's lens is dirty; for the latter problem, a drive cleaning disc is an inexpensive, frequently-used and often successful remedy, available at any store that sells DVDs.
    Because you're running Snow Leopard now, you should repair your hard drive directory using the Snow Leopard version of Disk Utility, not the one on your Tiger installer disc. If you aren't able to do so even after trying to clean your drive, you could buy and use DiskWarrior to rebuiild the damaged HD directory. But DW costs nearly $100, and though it would probably do the trick, that's a bunch of money. You'll have to weigh its cost against the value of the new or changed data on your drive that hasn't been backed up in the last three weeks. If you can get along without that data, then erasing your hard drive and restoring from your last backup is the no-cost, immediate (as opposed to waiting for a DW startup disk to arrive in the mail) solution.

  • How was replacement SSD able to download and install Mavericks?

    This has puzzled me for 2 years.
    A friend bought a new Mac mini and bravely (!!!!) replaced the hard drive with a third party SSD.
    He told me that the moment he switched the mini on it connected with the App Store and downloaded and installed Mavericks.
    How could it do this when it had no operating system whatsoever and no recovery partition, as these had presumably disappeared along with the original hard drive?

    Hello!
    His Mac Mini had an Internet Recovery Partition
    It's explained here:
    OS X: About OS X Recovery - Apple Support
    if your startup drive encounters an issue, or if your startup drive has been replaced or erased. Internet Recovery lets you start your Mac directly from Apple's servers.

  • In BEx, how to display hierarchy Upper Node with selected Lower Nodes only

    Currently I am displaying the Cost Centre (GFL Responsibility Cost Centre) hierarchy in a workbook. I want to be able to filter on this hierarchy dynamically. E.g. the upper node must be displayed including the rolled up results for this node, together  with a selection of the lower nodes e.g 2 nodes ( not all the lower nodes related to the upper node must be displayed in the query).
    What's possible when filtering :
    To filter on the 2 lower nodes only ( results are displayed as required)
    Not possible:
    When I include the higher node of the 2 lower nodes in the query, All the lower nodes of the higher node are displayed, and the filter selection of the lower nodes are over written.
    This is logically what's expected when the higher node is included in the filter.
    Creating a hierarchy variable gives the same problem, I am not able to filter on the hierarchy nodes as required.
                      <b>Upper Node</b>
              <b>Lower Node1 LowerNode2 LowerNode3</b>
    Filter the report for UpperNode and LowerNode 2 & 3 only
    <b><i>Thanking YOU in advance. Will reward points for the correct help</i></b>

    Hi
    Do you want to show particular node or particular level ?
    If you want particular node , then create hierarchy node variable and restrict to that node ( 3rd node)
    If you want particular level, what does that mean  say i am taking employee hierarchy and the hierarchy is as below.
    Ihe setting that we have is to expand upto n levels but  if yiou say i need level 2 what does that mean and how do you want to show in report ?
           A -
    (level 1)
           B,C,D( --child of A ) --- level 2
              E(Child of B), F(Child of C)   -
    level 3.
    Regards
    vamsi

  • How to replace a paragraph style with object style

    Hi,
    I am having this issue lately that in paginating a newspaper I have to do all premium post with a Rectangle Border. the problem is that the text is in the grid.
    Is there anyway that, while I add a specific paragraph style to some parts of the text, I can automatically give this text a specific Object Style (like stroke rectangle)
    Does it make sense?
    Thank you very much

    Michael,
    I think that I did not explain myself as I should have. The problem is not really related to links but more of a automatic replacement issue.
    Every time I do this newspaper I include a new text information and the location of the Headers changes in every single case.
    http://i.imgur.com/sgQ2wIK.jpg
    In the link, the blue paragraphs need to be replaced with the respective Header Icons that you see on top and everytime this location of the headers in the newspaper changes due to the different number of posts in each specific category. Now the problem is related on how to autoaticaly replace this string in blue with its respective header
    thanks a lot in advace for all your help

Maybe you are looking for