Hide horizontal and vertical lines in a JTree

Hi,
suppose we have three JTrees in a Windows L&F where the second one shall not show any vertical or horizontal lines for a node. If this restriction would be true for all three JTrees one could invoke
UIManager.put("Tree.paintLines", Boolean.FALSE).
However only the second one must not show any lines. I tried something like
tree.putClientProperty("Tree.paintLines", Boolean.FALSE);
tree.updateUI();But unfortunately this does not work as the lines are still shown. Furthermore we need to set "on/off" the lines dynamically dependend on the user data.
Does anyone have a clue to solve this problem?
Thx.

only tested on windows, but this seems simple enough
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
class Testing
  boolean showLines = false;
  public void buildGUI()
    JButton btn = new JButton("Show/Hide Lines");
    final JTree tree = new JTree();
    tree.setUI(new javax.swing.plaf.basic.BasicTreeUI(){
      protected void paintHorizontalLine(Graphics g,JComponent c,int y,int left,int right){
        if(showLines) super.paintHorizontalLine(g,c,y,left,right);
      protected void paintVerticalLine(Graphics g,JComponent c,int x,int top,int bottom){
        if(showLines) super.paintVerticalLine(g,c,x,top,bottom);
    JFrame f = new JFrame();
    f.getContentPane().add(new JScrollPane(tree),BorderLayout.CENTER);
    f.getContentPane().add(btn,BorderLayout.SOUTH);
    f.setSize(200,200);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        showLines = !showLines;
        tree.repaint();
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        try{UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");}catch(Exception e){}
        new Testing().buildGUI();
}

Similar Messages

  • Pdf files print with horizontal and vertical lines

    All of a sudden, today, when I print pdf files, they print with horizontal and vertical lines.  I thaught it was the computer or printer. So I printed from another computer on the network, and printed to a different printer with the same result.  It is not just that one pdf file either, I have tried multiple files.  HELP.  Does anyone have any ideas?

    It is not clear how you are creating the files. It appears that they were created by Distiller from PS files that were created in some way. I also noted that you are using AA8.1.0. You may want to try to update (do all the updates in order) as a possible fix. It may be in the creation process also. Several packages will split large graphics into parts and create the image. I think this is a characteristic of OFFICE 2007 (docx) files - but I am not sure yet. Tell us how you created the files - step by step, including the scan.
    If you have the original documents, why not simply print to the Adobe PDF printer. The result would be smaller and a lot cleaner.

  • Hello' I am having an issue with my iPhone 5 display. 2 days before i've noticed some horizontal and vertical lines on the display. Minor but noticeable. Specially in dark wallpapers and on full brightness. Is it normal?? Please Help!!!

    Hello' I am having an issue with my iPhone 5 display. 2 days before i've noticed some horizontal and vertical lines on the display. Minor but noticeable. Specially in dark wallpapers and on full brightness. Is it normal?? Is this a software bug or Hardware problem?? Please Help!!!

    Hello,
    No, it is not normal. Follow this article:
    http://support.apple.com/kb/ht1414
    If this doesnt solve the issue your iPhone will need service.
    Burcu

  • CRXIR2 - A chart with horizontal and vertical lines?

    Good morning,
    Is it possible to create a chart with horizontal and vertical lines?
    I have a chart where the Y-Axis show the percentage and the X-Axis shows a timeline.
    The horizontal line shows the percentage for the points in time.
    Now I would like to mark some special points in time on the X-Axis with a straight vertical line.
    Is there a way to do that?
    Thank you very much in advance
    Christoph

    Hello Usama,
    unfortunatelly I couldn't find that that feature in the basic chart features.
    Also the webpage www.3DGraphics.com doesn't exist and I had no luck to google for 3DGraphics.
    It's a little strange, that it seems to be possible to draw one additional horizontal line with the basic features, but no additional vertical line.
    for example.
    If the main chart would be y=3x+1
    It seems to be possible to draw e.g. y=5
    But I see no chance to draw x=5
    In addition, to make it a little more complicated, I would need to have that dynamically, based on the values of a sql-statement.
    thx
    Christoph

  • Table data needs to be displayed with horizontal and vertical lines

    Hi,
    I need to display the data of the table in the SAP script which is having both horiziontal and vertival lines.
    the out put needs to looks as it in Excel...where there are multiple records with 5 fixed coulmns each seprated from one another by horizonalt and vertical lines..
    Can you let me know how to proceed in SCRIPT ,,,, where the number of records might vary ..and also ..it might continue to second page..
    Regards
    Senthil

    well it is possible but quite tricky.
    All you got in SAP-SCRIPT to achieve this is the BOX-Statement.
    The BOX statement works with variables for XPOS, YPOS, WIDTH and HEIGHT. what you need to do is:
    - calculate those variables during runtime
    - add box-statements with those variables.
    to calculate those variables you need to count used lines and so on. i hope i showed you a way, rest is a lil brainwork then.
    regards

  • Dyanamic table is SAP Script with horizontal and vertical lines

    Hi,
    I need to display the data of the table in the SAP script which is having both horiziontal and vertival lines.
    the out put needs to looks as it in Excel...where there are multiple records with 5 fixed coulmns each seprated from one another by horizonalt and vertical lines..
    I thinking about useing the Box with XPOS and YPOS who value changes dynamicaaly..
    But again as the number of pages might be more than one..i think there will issues,
    Can you  let me know how to proceed in SCRIPT ,,,, where the number of records might vary ..and also ..it might continue to second page..
    Regards
    Senthil

    well it is possible but quite tricky.
    All you got in SAP-SCRIPT to achieve this is the BOX-Statement.
    The BOX statement works with variables for XPOS, YPOS, WIDTH and HEIGHT. what you need to do is:
    - calculate those variables during runtime
    - add box-statements with those variables.
    to calculate those variables you need to count used lines and so on. i hope i showed you a way, rest is a lil brainwork then.
    regards

  • MSI GTX 570 TF III Power ed o/c Fuzzy Horizontal and vertical lines.

    Hello.
    Recently built, tested and stable PC with GPU issue. (System specs in Signature)
    I Have installed a MSI GTX 570 Power Edition O/C in my rig.  I have a clean install of Win 7 and carried out a clean install of the latest (non beta) Nvidea drivers DL'd from Nvidea site.
    Here is my problem:
    When running graphically demanding software I get fuzzy lines either horizontally or vertically across the screen (but not both at once)
    They only appear when GPU is underload.
    When running Heaven Benchmark the lines are soft and horizntal consistantly in the middle of the screen.
    When running the in the Kombuster Benchmark I get harder lines when the GPU load increases and they are vertical
    Interestingly whilst playing BF3 on Ultra no lines are present (but GPU load is not as heavy)
    I have not touched after Burner settings.
    Here is what I have tried already.
        Removed card and clean contacts (card connection to PCI slot)
        Cleaned (although brand new) mobo PCI-E slot
        Checked it is seated correctly upon reinstall
        Cleaned Power connectors and Card power connection
        Cleaned PSU modular power connection on PSU
        Changed PCI-E power cables connection on PSU (cable management model)
        Changed PCI-E power socket on PSU.
    I have looked into what Bios I have but have not found any information in regards to any other Bios releases by MSI.
    My GPU BIOS is:70.20.27.00.01
    Thanks for reading and all suggestions are welcome. Thanks  

    No problems at all.
    However when running some games,.and in particular K kombuster default "KMARK" I get those lines.
    In Heaven benchmark I h´get them horizontally but only one or 2 in the middle of the screen and very soft.
    I am sending the card back.
    No Overclock performed by me and no adjustment of any afterburner settings.
    It should work out of the box.
    Thanks for your help, and I will be sure to report back once my my new card is installed.
    Please look here for an image of what I have described. http://forums.tweaktown.com/gigabyte/47221-ga-z68xp-ud4-rev1-0-install-bios-test-procedures-questions-3.html#post413137

  • Checker board / Grid / Horizontal and Vertical lines on my 4th Gen iPad

    It's only visible in sunlight, but when I'm outside in the sunlight, it's very easy to spot. Is this a screen defect, or is it normal?

    Never saw this on my iPad. Take it back to Apple and have them look at it.

  • One of first versions of macbook air with black horizontal lines on bottom one third of screen and vertical line also one third of left side of screen

    one of first versions of macbook air with black horizontal lines on bottom one third of screen and vertical line also one third of left side of screen

    Hi
    I've recently notice I have a thin black line in my screen.. I went to Apple store and was told it’s a hardware problem (400$+ to fix as no warranty).
    This is the second time I’m having hardware screen issues with a Macbook Air (last time it was 3 months after I bought it, and it was replaced with this one)
    Looks like the Macbook Air screens are very problematic!  Anyone experience something like that?
    Thanks,
    Eyal.

  • IPhone got horizontal And vertical gray lines

    Hello guys i have a issue with my iphone i see horzizontal and vertical lines, i sended to apple (ups) and they could not duplicate issue now is my question shall i send it again to them with a better explanation?
    Kind regardz,
    Assaasaaa

    That is really bad.
    I have tried restoring it / updating the firmware - nothing helps.
    I am pretty sure it is a hardware issue since I've seen similar issues with other devices - its the LCD that is at fault here and that needs to be replaced.
    I read it in some forum here that it would go away with 24 hours of use - tried that - but no effect, with a full charge then drain and charge again - nothing.
    So, I'll be sending it off to the dealer - who too thinks it needs repair / replacement.
    Will let you know what happens in the next few days.

  • Is there a way to hide the horizontal and vertical scroll bar?

    Hi,
    I have report with customized page height and width and I am displaying it in the windows forms.
    When I am resizing the form wherein the crviewer is dock in, the horizontal and vertical scroll bars appears.
    Is there a way for me to suppress the those scrollbars?
    Thanks in advance.

    Couple of ways I've been able to find info about. E.g.; there is not straight API off os the viewer (CRviewer.ScrollBar = False ).
    1)  Add Panel control onto the page and add report viewer control into a Panel. Set Scrollbar, width, height property of Panel control.
    2) See http://www.dotnetspider.com/forum/266932-Remove-Scrollbar-from-Crystal-report-Viewer.aspx for another idea.
    If either of the above works for you, please let us know as I have not tested this yet.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Center text horizontally and vertically on composition?

    Hello,
    I'm working on a short projects (15 minutes length). Every 30 seconds a title fade in/out against a blank (grey) composition. How do I go about easily centering the text (single word) on the composition both horizontally and vertically? I know I can horizontally center via the paragraphs pallet, but how do I center on the vertical at the same time?
    Right now I'm modifying the Anchor Point of the text so it's in the center (visually) of the text, and then set the Position to the center of the composition, but every time I increase the type size, I have to go through this all over again...and with different titles coming up every 30 seconds or so, a simple text size change turns into a lot of work.
    I can only image there's a better way to do this and would appreciate any advice for an AE newb!
    Thanks,
    Kristin.

    It is possible to do this via scripting, but it won't be "live", i.e. you would have to run a script to grab the dimensions of the text layer each time you want to update its vertical alignment.
    It is also possible to roughly align text vertically using expressions given three limitations:
    1) You'll have to be willing to consider the height of the text layer to only extend from the cap height of the first line to the baseline of the last line, meaning descenders and ascenders wouldn't be counted as part of the height of the text layer.
    2) You'll have to manually locate the center of the first line of text.
    3) You'll have to be happy with a consistent point size and line spacing throughout.
    Given those limitations, vertical alignment can be done as follows:
    Add a Position animator to your text layer. Delete the default range selector you won't need it. Next add the Line Spacing property to the newly-created animator (using its "Add" menu). In the Character panel, set your text layer's line spacing to 0 (it will really be set to .01, but the difference shouldn't be noticeable once we're done). In the Line Spacing animator, set the desired line spacing (unfortunately, "Auto" isn't an option).
    Now set your Text layer's anchor point such that it falls in the center of the text's cap height (the height of a capital letter with no ascender or descenders).
    Next, add the following expression to the Position property of the text animator (NOT the Position property of the text layer's Transform group):
    >STA = text.sourceText.split("\r");
    >value - [0, (STA.length-1)*propertyGroup(countUp = 2).property.lineSpacing[1]]/2
    The second line should be all one line, but the forum insists on wrapping it. Be aware that if you later decide to change the point size of the font, you'll need to temporarily disable the text animator and center up the anchor point again.
    You can also use this method to force the text layer to shift up to accommodate new lines by deleting the "/2" at the end of the second line of the expression.

  • Horzontal and Vertical Lines won't get thinner then 1pt

    I've been working with illustrator for years and never came across this problem. If I make perfectly horizontal or vertical line I can't get line weight lower then 1pt. If I rotate the line just by 0.1 degrees then I can make the like less then 1pt. When I rotate the lane back to perfect 0 or 90 degrees then it automatically changes the line weight back to 1pt. Has any one else had this problem?

    Wow, I was messing with this problem for hours and didn't think of that. Thank you

  • Word .docs with Horizontally and Vertically oriented pages

    I have 30 plus Word .docs that have Horizontally and Vertically oriented pages in them. A new PDF is created each time the orientation changes. Is there a way to have Acrobat keep those in the same PDF?
    I am using Acrobat Pro for Mac 10.1.10

    As far as I know there are no patches available for the software and OS I am using (I ran the update check on each), but my version of Acrobat Pro is older.
    OSX 10.9.4 Mavericks
    Acrobat Pro for Mac 10.1.10
    Word 2011 14.4.3 (140616)

  • I'm in a multi-page document, how can i rearrange the pages or insert blank pages in front of pages? Also, is there a way to show the ruler both horizontally and vertically?

    I'm in a multi-page Pages document, how can i rearrange the pages or insert blank pages in front of pages? Also, is there a way to show the ruler both horizontally and vertically?

    Not on my document. I have a 7 page document open. The "flashing vertical bar" is at the top of page 3. I have the thumbnail view showing. I click page break and two blank pages are added to the end of my document. I have to scrool thru the pages to see that the 2 pages were added as they do not appear in the layout view... I'm not sure if it is inserting a "section" as it adds two blank pages.. But I am clicking on "INSERT PAGE BREAK".. So guess there are still a lot of bugs to fix..
    Thanks again

Maybe you are looking for

  • Same number range for commercial invoice.

    Hi. Can we maintain same number range as last year for commercial invoice for new fiscal year? if last year Invoice no is 60000001 new fiscal year again 1st no is  60000001 then what will happen to earlier number? Reg. Amol

  • How do I uninstall unwanted aps, games, etc. from Snow Leopard?

    I am getting ready to upgrade to Lion and I have several apps that I no longer want on my MacBook Pro OS X 10.6.8.  I am used to a PC where you have to clean it up and get it ready (defrag) for new programs. Boy, I don't miss my pc.   Do I need to do

  • Rich Text Editor & FireFox

    Hello, I get the integration of fckeditor instead of the Oracle component done. I'm happy with it and my users too, except those with firefox, because they got the standart TextArea. It seems that if the browser is not IE the pages launchEmbedded is

  • Recycling Iphone 4 for iphone 4s in store

    Hi, I'm traveling to NYC and thinking of recycling my old iPhone (4, 16 gb) to the new iPhone 4s. can I do it in your store or do I have to send it by mail?

  • Problem exporting HD to AppleTv using FCE4?

    So I just got my canon Vixia HV30 (NTSC) today..... I used 30p for a test, selected All formats, all rates and HDV Apple interm Codec 1080i60 in my easy setup. Captured my test, no problem. Now when I exported my sequence with Quicktime conversion>Ap