JtreeTable - Nodes update issue - Nodes are cut off

Hi,
I'vet got a little problem with the JtreeTable. Everything works fine until I try to change the rendering of a row to BOLD.
The text turns bold, but the TreeNode (first col in row) is cut off because it was first rendered plain and now its to big to be
displayed.
I tried
tree.getModel().valueForPathChanged(new TreePath(node.getPath()), myNewValue);but beacuse value doesn't change (text stays just font changes) there is no need to fireNodesChanged.

Here's one I put together. Select any node, and any other node with text that begins with the same letter is rendered in bold. From my test, it looks like repaint on the tree isn't sufficient. However, firing node changed events seem to be working (as a quick and dirty measure, I fire node changed on every node each time). Now I have to go back and revisit the problem I originally had and see what I was doing there.
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.*;
public class BoldTreeCellTest {
     public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    launchUI();
     private static void launchUI() {
          final DefaultMutableTreeNode[] nodes = new DefaultMutableTreeNode[5];
          JFrame frame = new JFrame("Test JTree With Bold Rendering");
          nodes[0] = new DefaultMutableTreeNode("root of the tree here");
          nodes[1] = new DefaultMutableTreeNode("Every cell which has the");
          nodes[2] = new DefaultMutableTreeNode("same first character as the");
          nodes[3] = new DefaultMutableTreeNode("selected cell text will have it's text");
          nodes[4] = new DefaultMutableTreeNode("rendered in bold.");
          for (int i=1; i<nodes.length; i++) {
               nodes[0].add(nodes);
          final DefaultTreeModel model = new DefaultTreeModel(nodes[0]);
          final JTree tree = new JTree(model);
          final JRadioButton useRepaintButton = new JRadioButton("Repaint Tree", true);
          final JRadioButton useNodesChangedButton = new JRadioButton("Fire Nodes Changed");
          ButtonGroup buttonGroup = new ButtonGroup();
          buttonGroup.add(useRepaintButton);
          buttonGroup.add(useNodesChangedButton);
          tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
               @Override
               public void valueChanged(TreeSelectionEvent event) {
                    if (useRepaintButton.isSelected()) {
                         tree.repaint();
                    } else {
                         model.nodeChanged(nodes[0]);
                         model.nodesChanged(nodes[0], new int[] {0, 1, 2, 3});
          tree.setCellRenderer(new BoldTreeCellRenderer());
          JScrollPane pane = new JScrollPane(tree);
          JPanel panel = new JPanel(new BorderLayout());
          JPanel buttonPanel = new JPanel(new FlowLayout());
          buttonPanel.add(useRepaintButton);
          buttonPanel.add(useNodesChangedButton);
          panel.add(buttonPanel, BorderLayout.NORTH);
          panel.add(pane, BorderLayout.CENTER);
          frame.setContentPane(panel);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
import java.awt.Component;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreePath;
public class BoldTreeCellRenderer extends DefaultTreeCellRenderer {
     private Font plainFont;
     private Font boldFont;
     public BoldTreeCellRenderer() {
          super();
          Font baseFont = (new JLabel()).getFont();
          this.plainFont = baseFont.deriveFont(Font.PLAIN);
          this.boldFont = baseFont.deriveFont(Font.BOLD);
     @Override
     public Component getTreeCellRendererComponent(JTree tree, Object value,
               boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
          super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
          String st = (String) ((DefaultMutableTreeNode) value).getUserObject();
          Font font = this.plainFont;
          TreePath selectionPath = tree.getSelectionPath();
          if (selectionPath != null) {
               String selectedText = (String) ((DefaultMutableTreeNode) selectionPath.getLastPathComponent()).getUserObject();
               if (st.startsWith(selectedText.substring(0, 1))) {
                    font = this.boldFont;
          setFont(font);
          return this;
Edited by: Skotty on Aug 12, 2010 2:02 PM
Edited by: Skotty on Aug 12, 2010 2:05 PM - set useRepaintButton as selected on start                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Opened a .ai file, found that left and right side are cut off (landscape vs. regular the issue?)

    Information all in the title.  I open a .ai file and the left and right sides of the image are cut-off based on the "page" box

    Did you open it in a lower version?
    It looks like you opened the PDF part of the file instead of the AI part.

  • After burned to dvd the edge are cut off in my tv screen. looks like zoomed

    hi
    i am FCPX user. i create my project using format (resolution )as showed on the pic below
    after burned to dvd the edge are cut off on my tv screen. looks like zoomed as showed in  the pic below.
    thanks for taking ur time to help me!!
    then i export using master file as
    showed on pic below
    and after i burn on to dvd my edge are cut off. here pic trying to show before burn on my mac and after burned on to dvd
                                           before burned on to dvd on my iMac screen
                      AFTER BURNED ON TO DVD ON MY TV SCREEN
    i really need ur help thanks
    after burned to dvd the edge are cut off in my tv screen. looks like zoomed

    Thanks Alchroma
    i used this dvd burner just incase..
    but i thought i might have wrong settings from begning.
    do u thinik this setting is alright when creating DVD
    Alchroma wrote:
    That thought jumped into my head as well.
    If the Safe Area settings are OK then it's well a settings issue in either the DVD player or TV or both.
    Al
    Alchroma wrote:
    That thought jumped into my head as well.
    If the Safe Area settings are OK then it's well a settings issue in either the DVD player or TV or both.
    Al
    thanks again

  • Songs Are Cutting Off / Left Earpiece

    I have the IPod mini that stores 1500 songs. I only have 120 songs on my IPod and at least 10 songs that I've come across so far are cutting off within the first 10 seconds of the song. I've deleted those songs and added them again and still, same problem. I then deleted all of the songs and transferred them back onto the IPod and some of the songs that were cutting out are now working but others that were fine are now cutting out.
    Also, the left earpiece is very low and staticy (sp?). I tried another pair of headphones and am having the same problem which leads me to believe the problem is the IPod not the headphones.
    Anyone familiar with these issues?
    Thanks!

    Hi Nicole!
    Have you tried to reset your iPod?? Hold the MENU & CENTER buttons at the same time until you see the Apple logo on your screen and then release them. You might have to do this a couple of times before it actually works. Try to play the songs that the iPod would usually cut off and see what happens. Also, check your ear pieces. Please reply to this post if you keep having the same problem.

  • Descktop J4550 Some font lines are cut off at top half of row

    The subject line above says it all. Just need to know how to correct the problem. Descktop J4550 Some font lines are cut off at top half of row

    My personal opinion is that it is a problem from some books that have been published via Smashwords. That has been my experience for one or two books I've downloaded. I contacted the author in one case and he replied:
    "Just to let you know I've had some feedback from Smashwords about the odd display issue. It's relates to the line spacing in the original document, apparently. I'll be uploading a fixed version to them in the near future, though it might take a while for the new version to trickle down to the iBookstore."
    So I dunno if your book is published by Smashwords, but if it is it may be worth contacting author?

  • A lot of songs on my Iphone are cutting off several minutes short, and some are just skipping to the next song in the middle of the current song. Any ideas or suggestions would be appreciated.

    A lot of songs on my Iphone are cutting off several minutes short, and some are just skipping to the next song in the middle of the current song. Any ideas or suggestions would be appreciated.

    Go to http://www.apple.com/support/itunes/contact/ and then click contact iTunes Store Support. Then find your issue in the categories and then it will most likely take you to a page with suggested things to do but also on this page should be an option to e-mail them. Just explain your problem and also have the names of the songs that you are having problems with listed in the e-mail so they can help you more quickly. They usually get back to you within 24 hours.

  • HT2729 my music videos on my ipod touch are cut off

    when I play my music videos on my ipod touch, they are cut off in beggining or the middle.

    On you iPod, force close all the Apps in the multitask window.
    Follow these steps to force an app to close:
    From the Home screen, click the Home button twice. 
    Tap and hold on the app. 
    When it starts to jiggle, tap the to close it one by one until all cleared
    Now do a Soft reset of your iPod:
    Hold both Home and Sleep button for around 10secs until you see the Apple logo then release. After it returns to Home screen, try your youtube and see if this resolves the issue.

  • Many songs on my iPad are cut off before completion, or are scrambled (bits of different tunes mixed in with other tunes).

    I am running iTunes 11.0.3.42 on Windows 8, and am an iTunes match subscriber.  I have approximately 2700 songs in my library - maybe 1/2 and 1/2 ripped from my CD collection and the rest purchase exclusively through iTunes.  None of this music is pirated.
    When playing this music back on my iPad, I am finding that many songs are cut off before they complete.  When this happens, they continue to play, but it is just silence.  Additionally, many other tunes are scrambled, with bits of other songs mixed together into one.  When going back to iTunes on my PC, I will sometimes find that the songs play fine there - but sometimes they behave as they do on the iPad. 
    This happens whether or not I run my library with iTunes match on the iPad.  I have redownloaded all my songs to try to repair this, with mixed results.  It will often fix the songs that I was having trouble with - but then other songs will begin to show the same type of problems.  I know that 2700 songs is not an immense library, but it is too large for me to systematically review the whole library - which makes tracking these problems very difficult.
    I have seen similar types of complaints on the forums ranging over the last several years.  It also seems that these problems have been "solved" by many different methods.  Nothing I have found has worked for me - or only worked with the mixed results I mention above.  I wonder if these individuals have actually been getting the mixed results I am finding.
    This is truly frustrating, as I do not do anything exotic with my library, and have not pirated, but gotten my music honestly.  I also have ripped my entire CD collection into iTunes, and have gotten rid of the CD's - as I have NEVER had similar problems to this in all the many years I have been using iTunes.  Suddenly I find that I have a majorly corrupted library, with seemingly no way out.  I cannot even abandon iTunes since I have such an investment in it.  At a minimum of $.99 per song it would cost me almost $2700 to replace my library honestly, and that is at the low end of what I would pay.  I don't know about you - but I don't have three grand to blow on replacing a music library I already paid for just to get away from a crappy product (sorry Apple - but what the heck else would you call this nonsense?).  Makes a dude covet taking an eye-patch.
    I am screwed and doubt there's a way out - but I have no choice but to ask for help.  Anyone?

    shameless bump

  • Please help i started my project video format 720HD resolution 12x720 rate 25p at last when i finish and burn to dvd the edges are cut off any one help please i am really in trouble

    please help i started my project with  video format 720HD, resolution 12x720, rate 25p.  at last when i finish and burn to dvd the edges are cut off and my logo cut off the screeen aswell any one help please i am really in trouble. thanks

    Sorry, but I don't know anything about that app.
    I did go to their Web site and I see they have a support link. Perhaps you can get help there or in their forum.
    If you are OK with a DVD with a basic menu, you could try the Share>DVD option in FCP.
    Good luck.
    Russ

  • Images at the bottom of the screen are cut off in HDR Pro

    I'm running a Mac and have recently installed CS5.  When I open files to do an HDR, the photos used in the HDR are cut off at the bottom of the screen.  In other words, what I mean is, they should be able to be selected with the check box is being included or not.  Also, the "OK" and "Cancel" buttons are cut off.  I thought that perhaps it was the screen resolution or perhaps the dockeed icons below.  Yet, I'm using the highest screen resolution and that's not a factor. I've hidden the dock,moved it...no difference. I've tried resizing the HDR window but it only resizes horizontally - not vertically.
    This is frustrating.  I'd like to be able to see the entire images being used in the HDR pro and decide whether to include them (or not) by the check boxes; especially since this is how it's supposed to work.  Any ideas?

    Hi Charles,
         Until just now...it didn't work.  Isn't that how it is...ya ask for an answer for something that's broke...then it works.
    When it wasn't working...the Green maximize button didn't do much except allow me to pull the window down further.  Once I would try to resize the window from the resize section at the bottom right, the window would resize to full size...not much good.
    Although...for whatever reason, it seems to be working now.  Will it work tomorrow?  beats me.
    Thanks for yoru help.
    Tony

  • All my song in my playlists are cutting off either in middle or at the end of each song. How do i fix this?

    all my song in my playlists are cutting off either in middle or at the end of each song. How do i fix this?

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • After I covert my excel file to PDF, my images are cut off or not appearing at all HELP?!

    Hello!
    I am creating a Exel Work book and converting it to a PDF file (easy to share online).
    Once I convert the Excel Work book, some of my images are cut off or not appearing at all.
    Which I find weird because some images pop up just fine.
    These images are originally flats from Adobe Illustrator I converted to pictures with Excel.
    So why is that when I convert my workbook to a PDF file some images show through and others don't?
    Please Help!
    ORIGINAL EXCEL FILE
    Once I save it as a PDF File. Other pages are fine except this one?

    Correction for above: 'Bit depth' not ' Bid depth'

  • Characters are cut off when they don't fit in the pdf report output.

    Hi All,
    I understand that Forms 6i and Oracle 9 iAS have been de-supported for years. Meanwhile we do still run a small application in the 9 iAS environment.
    We have forms and reports running on Windows 2000 server, I am able to successfully clone the same 9 iAS from Windows 2000 to a Virtual Server Windows 2003 x32 and all runs fine, the only problem is that the fonts in the pdf reports are larger in the new Windows 2003 environment as compared to the original Windows 2000 and characters are cut off when they don't fit in the pdf report output in 2003 env.
    Any advice is most appreciated.
    Thanks.

    You may want to check on the printer driver and paper size selected

  • Please Help...My photos are cut off in my slideshow

    Hello,
    I am making a slideshow using IMovie. I am using photos from IPhoto. When I drag them to the strip and then play my show, many of the photos are cut off. You can't see the whole photo. Example, my daughter is on a balance beam and you can only see her legs and the beam. Any suggestions on how to fix this would be greatly appreciated. Do I need to adjust all of my photo sizes? (Hope not, this slideshow has hundreds of pictures) Do I need to adjust something with the slideshow?
    Thank you in advance for you help.

    Is there a way to do that for all the pictures at once?
    You can either set the Project Preference to automatically use the "Fit" option when new images are added to a project. However, to change the rest of the images already added, you would have to select the image you already corrected, press Command-C to copy the information to temporary memory, select all other images, and then use the "Paste Adjustments > Crop" Edit menu setting to copy the current "Crop" setting to all selected images at once.
    BTW-what is Kens Burns?
    It adds a "motion" effect to still images. I.e., you can select a start and stop scaled/position view and the application will interpolate "in between frames" to create the motion effect.

  • Pictures in e-mail are cut off on the right side.

    some pictures in e-mail are cut off on the right side. When I zoom out the text gets smaller but the picture stays the same

    Sounds like the webpage you are on isn't optimized for devices with touch screens. I would suggest attempting to use a different web browser such as atomic browser or any of the other ones in the App Store. Otherwise you may have to resort to using a Mac/PC to do your homework.

Maybe you are looking for

  • Lock Code when turn on - 5800XM

    When I had v40 I had to tenter the Lock Code when I turned the phone on (something I did rarely so no problem). When I updated to v50 it doesn't ask for the Lock Code now. Any one know how I can set this to happen please? Mark

  • Movie proportions in Premier Pro CS 5.5

    I have been given video footage and while it is .mov format, I don't know it's native proportions or any information about it and I don't know how to find out so that I can import it properly into Premier Pro and have it scale properly. I have tried

  • Second call of an SQL query throws a syntax error?

    Private Sub RefreshDataSet() Dim strSQL As String = DataAdapter1.SelectCommand.CommandText Try DataSet1.Clear() DataAdapter1.SelectCommand.CommandText() = Trim(strSQL & " WHERE BadgeID = " & strEmployeeBadge) DataAdapter1.Fill(DataSet1) Catch ex As E

  • How system deals with co commitments

    Situation is: PO: 1 line purchase order, account assignment category A (asset) with 5 AU (order unit) and with 5 WBS elements each on 1 AU. 1 AU=37.480,00u20AC Invoice: Partial invoices comming to first PO line and first WBS element (first partial in

  • VIP network of RAC are on Node 2 Only

    Hello, This is related to this thread: https://forums.oracle.com/forums/thread.jspa?messageID=10817046#10817046, which is (as of writing) is still unresolved. Is it normal to have the VIP eth are on the one node only? Below is the result of ifconfig