JTable: How do you get the sort indicator shown in the design guidelines ?

http://java.sun.com/products/jlf/at/book/Idioms4.html#996747
As opposed to Volume 1, they don't provide any code :-(
(http://java.sun.com/products/jlf/)

You need to put your own TableCellRenderer into the table header. You implement the same interface as an ordinary cell renderer, but you install it differently. Here's a snippet of my code that does this:
     private void setupHeaderRenderers()
          for (int i = 0; i < model_.getColumnCount(); i++)
               TableColumn tc = t_.getColumnModel().getColumn(i);
               tc.setHeaderRenderer(new SortHeaderRenderer(/* my ctor args */));
     }and the renderer itself is as below. Apologies for dependencies on other stuff of mine, but you get the idea.
private class SortHeaderRenderer extends    DefaultTableCellRenderer
  RenderInfo r_;
  SortHeaderRenderer(RenderInfo r)
    r_ = r;
  public Component getTableCellRendererComponent(javax.swing.JTable table,
                                                Object  value,
                                boolean isSelected,
                                                boolean hasFocus,
                                                int     row,
                                                int     column)
      if (table != null)
        JTableHeader header = table.getTableHeader();
        if (header != null)
          setForeground(header.getForeground());
          setBackground(header.getBackground());
          setFont(header.getFont());
      setText((value == null) ? "" : value.toString());
      setBorder(UIManager.getBorder("TableHeader.cellBorder"));
      setHorizontalAlignment(SwingConstants.CENTER);
      setHorizontalTextPosition(SwingConstants.LEFT);
      // Check if we are the primary sort column and if so, which
      // direction the sort is in
      if ((orderItems_ != null) && (orderItems_.contains(r_)))
        if (sortDescending_)
          setIcon(sortDescending__.getIcon());
        else
          setIcon(sortAscending__.getIcon());
      else
        setIcon(null);
      return this;

Similar Messages

  • I have a 120gb Classic that has no space left on it. i am going to buy a larger gb capacity ipod as soon as i get clearer instruction on how to get the old ipod content to the new ipod. How do you get content from one ipod to the other?

    how do you get content from one ipod to the new one? my content is on an external hard drive not on my pc and i have run out of space on my 120gb classic. can you get old ipod content to new? my itunes has only got short cuts, the real content is on an external drive? can this be done?? please help

    If the content is on an external drive, but your library knows where to find it, then it should all work. Connect your device, make some selections for what to put on it, and sync. If, on the other hand, your current iPod is the only place holding some of your media then see this user tip: Recover your iTunes library from your iPod or iOS device.
    tt2

  • How do you get word count to print at the end of a document in Pages?

    How do you get word count to print at the end of a document in Pages?

    Pages v5 does not provide a user assignable word count variable. With some AppleScript, and a paste operation from the clipboard, you can have locale punctuated word count in this format: 7,803 — anywhere in your document. The following AppleScript works with Pages '09 v4.3 through Pages v5.5.2 on Yosemite.
    I would suggest that you copy paste the following AppleScript into your [Apple] Script Editor and save it (suggestion) wordcnt.applescript. Then, follow this with an option+Save As… and this time set the File format to Script Bundle, or Application with hidden extension — saved to your Desktop. Provided you have a Pages document open, you are then a double-click from the ability to paste your current word count into Pages.
    Note: If you have Pages word count display enabled, it will automatically count your pasted value as another word which initially may deceive on true word count at the time the script was run.
    AppleScript
    --- copy below this line ---
    property locale : "en_US.UTF-8" -- In Terminal, use the locale command to see yours
    if not ApplicationIsRunning("Pages") then
         display dialog "Pages must be running to use this utility."
         return quit
    end if
    tell application "Pages"
        tell body text of front document
            set wordCnt to count words
            -- Don't want punctuated numbers? Remove the single quote from printf format
            set the clipboard to (do shell script "export LC_ALL=" & locale & "; printf \"%'d\" " & wordCnt)
        end tell
    end tell
    on ApplicationIsRunning(appName)
         tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
         return appNameIsRunning
    end ApplicationIsRunning

  • Background noise removal takes about 3 seconds into each clip in timeline to kick in, so each clip has noise in the first few seconds.  How do you get this to remove noise from the very start of the clip?

    Background noise removal takes about 3 seconds into each clip in timeline to kick in, so each clip has noise in the first few seconds.  How do you get this to remove noise from the very start of the clip?

    insert a 5 second gap in the beginning of the timeline.

  • Content Holder How do you get css class to appear in the wysiwyg editor? The only option is "clear class".

    Need an answer to my question: How do you get css class to appear in the wysiwyg editor? The only option is "clear class".

    Liam,
    If it's not supported there, then where can I access the css and do you have any recommendations for a simple app to change the css style?

  • How do you get fontmetrics before displaying something on the screen?

    Let me ask in another way:
    how do you get fontmetrics before displaying something on the screen?
    Edited by: tjacobs01 on Aug 24, 2008 12:03 PM

    and you call getGraphics() it returns nullI learned to not use the getGraphics() method. Check out my posting here where I ask what the getGraphics() method is good for:
    [http://forums.sun.com/thread.jspa?threadID=5233274&messageID=9954741|http://forums.sun.com/thread.jspa?threadID=5233274&messageID=9954741]
    Also, c.getFontMetrics(c.getFont()) will be an NPE because Font is initially null.Maybe I don't understand the question. The following works for me:
    import javax.swing.*;
    public class Test
         public static void main(String args[])
              JTextField textField = new JTextField();
              System.out.println(textField.getFontMetrics(textField.getFont()));
    }Every question should have a SSCCE, so we don't have to guess.

  • How do you get your content in front of the right people?

    "Outbound Content Marketer of the Year, Joe Chernov (VP of content at HubSpot) told me: Marketers always ask me how to make more or better content, and it’s almost always the wrong question. The right question is: “How do I get my content in front of the right people?” - Forrester's Ryan Skinner
    Forrester published a very interesting report in October called "Put Distribution at the Heart of Content Marketing" (here's the related Forrester blog post). My VP shared the report with me and asked me to review and research a key content distribution strategy potentially leveraging the key technologies that are listed in the report. These technologies focus on helping identify influencers, publish content on targeted media properties and publish content if it ranks highly. I have to admit, this is somewhat new territory for me - I've yet to really focus on content distribution strategies across the entire buyer/customer lifecycle and although I've used one or two of these technologies personally, others I've only heard of and some I just flat-out had to Google.
    In true intrapreneurial spirit, I starting working through the research phase - I'm actually still working through it - and as I do, I can't help but to start mentally creating a blueprint of sorts... Imagining our technology roadmap interwoven with a content distribution strategy to create and drive a valuable buyer/customer experience (to acquire, keep and grow, of course). Ideally, we'd be able to accomplish all of the above points to significantly - and intelligently - extend our reach moving forward. So, back to the the Forrester report... To help more holistically drive content distribution, Forrester recommends creating a "distribution boss" and linking that person to content creation. I like it. To even further boost success of content marketing initiatives, Forrester suggests: (and I'm paraphrasing liberally here):
    1. Your distribution boss needs to be a left-brained analyst with a right-brained way with words
    2. Borrow some $$ from your content creation budget for some content promotion
    3. Encourage a BFF relationship between your PR and media teams and your content marketing teams
    Bottom (or should I say "top") line? I'm looking forward to our organization developing a more scientific content distribution strategy in 2014. Can I get an "amen!"? So, what are you and your teams doing to take a more scientific approach to content distribution in 2014? Or what are you currently doing? I look forward to Topliners feedback!
    Cheers!
    Kristin
    P.S. Technologies currently under review:
    - Include your influencers in a distribution strategy: Little Bird, Klout, PeerIndex
    - Look to specific vendors to push content on publisher’s sites: Outbrain, Sharethrough, Taboola
    - Identify social content winners and invest to amplify reach on the networks that work: SimpleReach
    - Keep an eye on emerging technologies for content visibility and distribution: TrendSpottr
    - Others: Parse.ly
    CC: marilyncox

    Alessia,
    I agree! In our current blog consolidation project, we're implementing Google Authorship for all our bloggers and we're currently evaluating how to best leverage Deltek's Google+ channel w/in our content strategy. Our PR/Social Director is not a fan - I'm working on, I mean with, her to see the possibilities.

  • How do you get Cloud storage to back up the SD Card?

    My daughter S3 died and had to be replaced. Lost all the data and apps that were stored on the phone's internal memory. With the replacement phone, I set up the cloud storage for back up offered by Google but it only accessed the data on the phone's main memory and not the separate SD Card that is installed. How do you get the Cloud app to also back up the SD card data?

        NDBeartrap, Let's help get your daughter's info back! If the info was backed up the cloud, you would be able to download it back to the device. Can you verify that there is info on the sd card? this can be done by inserting the sd card into a reader w/adapter or phone that is compatible. Please let us know what happens.
    sheritah_vzw
    Follow us on Twitter
    @VZWSupport

  • How do you get to your apn settings on the iPhone 4s

    How do you get to your APN settings without jail breaking your phone

    take a look at the link 
    ios: viewing and editing apn  http://support.apple.com/kb/HT2283

  • How do you get a table to flow onto the second page?

    Since upgrading to Yosemite, I cannot figure out how to get my table to continue on to the second page. If you look at my screenshot, you can see that my table was so big so the whole thing was moved to the next page. I want it to remain on the 1st page and have additional rows continue on to the second page. In the previous version of pages, the column titles would also appear on the second page. Thank you very much for your help.

    Hi F.AD.;
    Go to View > Show Invisibles (Shift+Command+I).
    This will display Paragraph marks (¶) at the end of each paragraph.
    Delete the paragraph mark (¶) that is at the end of the paragraph before the table, i.e. just between the table and the paragraph.
    This will bring the table surely just beneath the paragraph (text), I suppose.
    Hi BePositive26;
    You didn't mention whether my suggestion made easy to solve your problem.
    Regards,

  • How do you get your photos, apps etc. from the iCloud after your iPhone 5 has been set up at the AT

    How do you your get your apps, photos, etc,  from iCloud after your iPhone 5 has been set up at the AT&amp;T store?

    http://support.apple.com/kb/HT4859

  • How do you get rid of paused applications in the dock?

    Suddenly I have tiny icons in my dock because there are all sorts of invisible paused icons. I can delete them individually, but they come back every startup. I tried the advise in the post
    "How to permanently delete..."
    but they didn't work. I don't have any VirusScanner or other such software.
    I have OS 10.6.8 on this laptop..

    When you hover over one of the 13 ovals, it displays the name of the application, eg "Remote Mouse - Paused"

  • HT202213 how do you get it to show up in the sidebar again, after setting it up?

    how do i get home sharing to tapear agian in the toolbar, after i set it up?

    I can sort of reproduce what your talking about I think its because your setting the Start and Due date to the same time which seems to affect the search folder that's used for the view. The following seems to work okay for me
    Task taskItem = new Task(service);
    taskItem.Subject = "Created From qqq";
    taskItem.Body = "body";
    taskItem.IsReminderSet = true;
    taskItem.ReminderDueBy = DateTime.Now;
    taskItem.StartDate = DateTime.Now;
    taskItem.DueDate = DateTime.Now.AddHours(1);
    taskItem.Status = TaskStatus.NotStarted;
    ExtendedPropertyDefinition PidLidToDoOrdinalDate = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, 0x85A0, MapiPropertyType.SystemTime);
    taskItem.SetExtendedProperty(PidLidToDoOrdinalDate, DateTime.Now.AddHours(1));
    ExtendedPropertyDefinition FlagDueBy = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, 0x8560, MapiPropertyType.SystemTime);
    taskItem.SetExtendedProperty(FlagDueBy, DateTime.Now.AddHours(1));
    taskItem.Save();
    Cheers
    Glen

  • How do you get Itunes to have control in the tray when you minimize

    A little while ago, before i messed around with some of my computer settings, i was able to control Itunes while it was minimized so instead of having a button for itunes it was a play and two skip buttons on the bottom, how do i get my itunes to do this again

    You can get a taskbar toolbar by right clicking anywhere on your taskbar. Select toolbars and put a check mark next to iTunes. Then, in iTunes Preferences: iTunes > Edit > Preferences > Advanced Make sure the box Minimize iTunes to the System Tray is UNCHECKED.
    Now when you minimize iTunes you'll get the toolbar.

  • HOW DO YOU GET NEW TABS TO LOGIN TO THE HOMEPAGE DEFAULT THAT IS IN TOOLS

    WHEN I OPEN A NEW TAB - HOE DO I GET IT TO COME UP WITH THE DEFAULT HOME PAGE THAT IS SET UP IN TOOLS / GENERAL. AT THE MOMENT IT ALWAYS COME UP BLANK

    There are also other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Java Plug-in 1.6.0_07 for Netscape Navigator (DLL Helper)
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

Maybe you are looking for

  • Probably a Stupid Newbie Question, but....

    Picked up a 8300 series Curve a couple of weeks ago.  Had it synched with my Outlook on my pc.  About a week ago the synch stopped working and I noticed that when the phone was plugged into the USB cord the little charger symbol would only stay lit u

  • Special GL

    Hello How do we deal with Letter of credit, Bills of exchange, Post date checks and Guarantees. I understand that we use the special gl transactions and statistical postings to take care of these. What I want to understand is how the accounting proce

  • Receiving a HasMap in a web servicde method

    Hello, I´m using JDeveloper 10g, with the wizard i convert a java class into a web service. I have two methos and both of them send Strings and receive an HashMap. In the wsdl i have this schema: <schema xmlns="http://www.w3.org/2001/XMLSchema" targe

  • Cd won,t play on car CD player

    I have burn my purchased CD's and now when I go and try to play I get an "err". If I play it on my computor it plays fine.

  • Photo files, why does my MB pro store some many files with same similar name in finder..

    I take a lot of large file pictures, how do I manage all the files that get created in finder to maintain file space?