Jtable Header's border disappear  after placing an icon on it

I tried this in java 1.4
it works fine but the border between the headers of my JTable diappear
Anyone knows why?
ImageIcon icon = new ImageIcon(pathoficon);
DefaultTableCellRenderer headerRenderer =new DefaultTableCellRenderer();
headerRenderer.setIcon(pathoficon);
TableColumnModel colmod = jtable.getColumnModel();
colmod.getColumn(col).setHeaderRenderer(headerRenderer);
jtable.getTableHeader().resizeAndRepaint();

Its because DefaultTableCellRenderer isn't quite the mustard for a header renderer. Mine is shown below, the crucial line being setBorder(UIManager.getBorder("TableHeader.cellBorder"));
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;
}Never mind about anything else because that's specific to me.

Similar Messages

  • Why does border effect disappear after rendering?  It's visible before.

    I'm editing a project that needs a lot of pictures as b-roll.  I used the standard border effect in FCP7 and everything looks great!  Until I render it.  And, then all or a portion of the border disappears.  When I toggle the effect off, the border reappears just as it was when I first applied it.  Render again, it disappears again.  Confused.  Any advice would be appreciated.

    Thanks for all the input.  I figured it out.  Pictures were too large.  You can all stop typing now.

  • Release Tab in purchase order disappear after release using ME29n

    Hi there,
    We are busy testing support stacks (upgrading from ECC6 SAP_APPL SAPKH60305 to SAPKH60307)and we've come accross a strange problem.  When we create a normal purchase order (ME21n) the purchase order does pick up a release strategy.  Using the older ME28 transaction to release this purchase order, everything is fine.  We can use ME28 to release the purchase order, as well as unreleasing the purchase order, as often as we want (the same purchase order).  When we use transaction ME29n the release tab in the purchase order just simply disappears after saving.  In the purchase order header changes, the release change is visible, but the release tab is missing.  This purchase order is now not subject for release, and a goods receipt is possible without release.  I checked in table EKKO as well and the release fields in this table for this purchase order is empty.
    Has anybody had a similar experience?  Any advise would be greatly appreciated.
    Regards
    Christo Vermeulen

    Hi Christo Vermeulen,
    I have detected the same problem as reported by you. Did you solve it? Do you know how can I procedure to solve it?
    Thanks in advanced,
    Eder Nicoleti

  • How to add  ComboBox in Jtable Header

    Hello everyone,
    I want to add a Combox box in JTable Header .Basically it works as central access to whole table e.g. by selecting delete row in combo box then it should delete the current selected row.If somebody has any idea please share it.
    Thanks in advance.

    The individual headers are not Swing components and therefore do not respond to mouse events in the same way as Swing components. Why don't you just have a popup menu that is positioned over the currently selected row? If you want to apply an action to all selected rows then have a set of buttons placed above the table header.

  • 90% of pictures disappeared after new program. Time machine folders mostly empty. Downloaded my Carbonite file. Can I restore directly from this file or do I have to drag and drop 20,000 pix?

    90% of pictures disappeared after adding Maverick. My Time Machine folders were in the right order but mostly empty so useless for restore. Repair and rebuild attempts were not effective. Downloaded my Carbonite file which is now sitting on my desktop. Is there any way to use the restore command to rebuild my portfolio or do I have to drag & drop approx 20,000 pictures? Can album groupings and faces be retained?

    Do you still have the original library that was present at the time you upgraded to Mavericks?  If so apply the two fixes below in order as needed:
    Fix #1
    1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
    2 - run Option #4 to rebuild the database.
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.
    2 - click on the Add Library button and select the library you want to add in the selection window..
    3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option.
    4 - In the next  window name the new library and select the location you want it to be placed.
    5 - Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    Happy Holidays

  • Not able to edit the JTextField under the JTable header

    Hi,
    As per my requirement, i need to add the text field in JTable header for filtering the table records.
    i have added the text field but not able to enter any value (it is disabled).
    Can anyone please help me on this?

    Welcome to the forum.
    After reading how to format Code in this forum (SQL and PL/SQL FAQ ),
    please show us the code of your TableHeader implementation.
    bye
    TPD

  • Journal entry disappears after saving and not available to post

    Hi Gurus
    On BPC for Netweaver version 7.5 and excel 2003 i am able to save the journal entry but am not able to post it since it disappears after saving. I could see the Journal ID being generated and then the layout gets cleared . i am unable to post this journal. Also when i go to journal manager and tries to list the journals this saved journal does not show up.
    I have already set the application parameter "JRN_MAXCOUNT" to 1000  so that i can see the journals that i create.
    Have any of you faced such an issue?
    Regards

    Hi Tara,
    Thank you very much for your tip. I had Datasource as one of the header fields and i moved it to the item fields to make it work. I am still not sure why does that. May be because when we create the journal template system proposes only the required fields in Header and if select additional ones its not liking it.
    I cannot come up with a reasoning why we cannot incorporate a non required field in header journal template . The obvious reason that i included the datasource dimension in header itself was because it was a common value that i want to use for all my journals.
    Anyway i hope SAP would either fix this or come up with a reasoning.
    Thanks again..

  • All my Photos disappeared after I saved a photo from an email from my wife. I am running Mountain lion on Mac book pro 2012, help. What did I do wrong?

    All my Photos disappeared after I saved a photo to Iphoto from an email from my wife. I am running Mountain lion on Mac book pro 2012, help. What did I do wrong?

    Apply the two fixes below in order as needed:
    Fix #1
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Since only one option can be run at a time start with Option #3, followed by #4 and then #1 as needed.
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.
    2 - click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option.
    4 - In the next  window name the new library and select the location you want it to be placed.
    5 - Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments.  However, books, calendars, cards and slideshows will be lost. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • Submenu disappears after click in Firefox only

    I have created a horizontal spry menu which is working fine, but in Firefox the submenu disappears after clicking a submenu item - you then have to roll over the parent menu item to make the submenu visible again. In Safari the submenu remains visible even after clicking an item. I would prefer the menu to behave as it does in Safari. A link to the site is www.jakeharris.ca if anyone can help - look at it in Safari and Firefox to see the differences (not sure how it is in IE!)
    Many thanks,
    Hillary

    That is how the submenu is programmed to work...to hide when you get to the page you call.
    Although my Safari did not work the way yours did (I am on XP), I think what you are actually asking about is what I would call "local page indicators." That is, a kind of 'sign' that you are on a specific page.
    In your case, for each page, you would show an "open" menu with the appropriate menu list item highlighted with your normal hover color.
    There may be a way in the javascript to allow the submenu on a page to be always "on" or open, but I don't know much about javascript, so I can't help with that.
    If you have not used a Template to build the pages, it is even easier than fiddling with the javascript, if a tiny bit timeconsuming.
    Locally-significant styling is pretty straightforward, in theory.
    On each page, replace the class on the top menu item (on the main bar) for that page (right now it will say something like <li><a class="MenuBarItemSubmenu" href="#">Item 1</a> with a new class (you might call it "localpage") so you can make descendant selectors that apply to showing the submenu. Then write styles that cancel the 'hide' technique...get rid of the left: -1000em; for instance. I haven't gone through and worked this through, but it should work. Let me know if you need code; I need to go to breakfast right now, though!
    Then make another class to style the individual items for their pages, for instance .local that can be grouped with the hover styles that change the item color when you hover over them:
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible, .local
        background-color: #33C;
        color: #FFF;
    On each page, add this class to the menu item that pertains to that page:
    <a href="#" class="local">Chasing Wild Horses</a>
    on the "Chasing Wild Horses" page, for instance.
    This is a pretty subtle and elegant solution to what most people use <h1> heads for. Keep in mind, though, that if you want SEO to understand your page, without a hierarchical text indicator, it might be too subtle, as h1, h2, etc. heads help to indicate levels of importance of content for search engines and screen readers.
    But it will look great, nonetheless.
    Beth

  • Displaying header and border on a dynamic page passing parameters to a form

    I am using portals 10.1.4. and am trying to pass parameters to a form which appears as a portlet on a page.
    for this, dynamic page has been used to pass parameters to that desired form. my problem is this that when the form is displayed with parameters, the header and borders of the portlet disappear.
    The check-boxes for header and borders of the portlets on the page are checked. Yet, when for any reason, the parameters are not passed into the dynamic page, the header of the dynamic page and border are displayed. But when the parameters are passed and the form shows up, then the header and borders disappear.
    can anyone help me with the following:
    - is it the desired behavior?
    - how can i get the headers and borders reappear?
    thanks

    Any ideas fellows?
    how can we control the border and header of dynamic pages when a form or report is called from them with passed parameters?
    will appreciate any helpful experiences.

  • Header and border on a dynamic page passing parameters to a form

    I am using portals 10.1.4. I am trying to pass parameters to a form which appears as a portlet on a page.
    I am using the dynamic page to pass parameters to that desired form. My problem is this that when the form is displayed with parameters, the header and borders of the portlet disappear.
    The check-boxes for header and borders of the portlets on the page are checked. Yet, when for any reason, the parameters are not passed into the dynamic page, the header of the dynamic page and border are displayed. But when the parameters are passed and the form shows up, then the header and borders disappear.
    can anyone help me with the following:
    - is it the desired behavior?
    - how can i get the headers and borders reappear?
    thanks

    Hi AMN,
    I am not sure I follow what you are exactly attempting, can you post a set of steps to reproduce?
    Cheers,
    Mick.

  • How to remove JTable header from JScrollPane?

    Hi!
    Does anyone know how to remove the JTable header from the JScrollPane the table is placed in? I tried calling
    scrollpane.setColumnHeader( null ) and
    scrollpane.setColumnHeaderView( null )
    but none of the above worked...
    Thanks!
    Fil

    Hi,
    The easiest way to do this is to put an extra layer between the table and the scrollpane as follows:-
    JPanel p = new JPanel(new BorderLayout());
    // Add it to the north rather than center so that the table background color
    // won't cover the empty part of the view port.
    p.add(table, BorderLayout.NORTH);
    JViewport v = tableScroll.getViewport();
    v.setView(p);
    where table is your JTable and tableScroll is your JScrollPane.
    Hope this helps,
    Ian

  • Highlight JTable Header

    Hello,
    I want to be able to change the color of a JTable header of a column ie highlight it when a user clicks on the table header. Is there a way to do this? I'vd done a google search but nothing seems to address this. Any help is much appreciated. Thanks.
    vyang

    Try this piece of code on for size. The HeaderRenderer class is far from complete but it should give you something substancial to work with. This renderer also using GradientPainting to give you an extra boost in terms of appearance.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.datatransfer.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    public class HeaderRenderer extends DefaultTableCellRenderer implements
                    MouseListener, MouseMotionListener {
        Color bg = new Color(242,242,255), fg = Color.black;
        Rectangle paintingRect = null,
            lpr = null; //last painted rect
        JTableHeader header = null;
        public boolean isOnCol = false, highlightClickedCol = false;
        private int paintingCol = -1, clickedCol = -1, currentCol = -1;
         * Buffer gradient paint.
        GradientPaint gp = null, hoverGradient, columnGradient;
         * The current sorting state of the columns
        SortOrder sortOrder = null;
        public HeaderRenderer() {
            super();
            setFont( getFont().deriveFont(Font.BOLD) );
            //setBackground( bg );
            setForeground( fg );
            setOpaque(false);
            setBorder( BorderFactory.createCompoundBorder (BorderFactory.createMatteBorder(0,0,1,1, new Color(200,200,230) ),
                            BorderFactory.createEmptyBorder(4,7,4,4)) );
            setHighlightClickedColumn(true);
        public void setColumnGradient(GradientPaint gp) {
            this.columnGradient = gp;
        public void setHoverGradient(GradientPaint gp) {
            this.hoverGradient = gp;
        public GradientPaint getColumnGradient() {
            return columnGradient;
        public GradientPaint getHoverGradient() {
            return hoverGradient;
        public void setHighlightClickedColumn(boolean b) {
            highlightClickedCol = b;
        public void paintComponent(Graphics g) {
            Rectangle rect = paintingRect;
            Graphics2D g2 = (Graphics2D)g;
                g2.setPaint(gp);
                g2.fillRect( 0, 0, rect.width, rect.height );
            FontMetrics fm = g.getFontMetrics();
            int strWidth = fm.stringWidth( getText() );
            /*if(currentCol == clickedCol) {
                if( sortOrder == SortOrder.ASCENDING )
                    new ArrowIcon( ArrowIcon.UP ).paintIcon(this, g, strWidth + 15, 8);
                else if(sortOrder == SortOrder.DESCENDING )
                    new ArrowIcon( ArrowIcon.DOWN ).paintIcon(this, g, strWidth + 15, 8);
            sortOrder = null;
            super.paintComponent(g);
        public void attachListener() {
            header.addMouseListener(this);
            header.addMouseMotionListener(this);
        public void mouseEntered(MouseEvent e) {
            isOnCol = true;
        public void mouseExited(MouseEvent e) {
            isOnCol = false;
            paintingCol = -1;
            header.repaint();
        public void mouseReleased(MouseEvent e) {}
        public void mouseClicked(MouseEvent e) {
            clickedCol = header.columnAtPoint( e.getPoint() );
        public void mousePressed(MouseEvent e) {}
        public void mouseMoved(MouseEvent e) {
           // isOnRow = true;
            paintingCol = header.columnAtPoint( e.getPoint() );
            paintingRect = header.getHeaderRect( paintingCol );
            header.repaint( paintingRect.x, paintingRect.y, paintingRect.width, paintingRect.height );
            if(lpr != null) {
                header.repaint(lpr.x, lpr.y, lpr.width, lpr.height);
            lpr = paintingRect;
        public void mouseDragged(MouseEvent e) {
            //isOnRow = true;
            paintingCol = header.columnAtPoint( e.getPoint() );
            paintingRect = header.getHeaderRect( paintingCol );
            header.repaint( paintingRect.x, paintingRect.y, paintingRect.width, paintingRect.height );
            if(lpr != null) {
                header.repaint(lpr.x, lpr.y, lpr.width, lpr.height);
            lpr = paintingRect;
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
             boolean hasFocus, int row, int col) {
            currentCol = col;
            if(header == null) {
                header = table.getTableHeader();
                attachListener();
            if(table.getRowSorter() != null && table.getRowSorter().getSortKeys().size() > 0 ) {
                java.util.List<? extends RowSorter.SortKey> keys = table.getRowSorter().getSortKeys();
                for(RowSorter.SortKey key: keys) {
                    if(key.getColumn() == col) {
                        sortOrder = key.getSortOrder();
            Rectangle rect = table.getTableHeader().getHeaderRect(col);
            if( (isOnCol && paintingCol == col) || (clickedCol == col && highlightClickedCol)  ) {
                gp = new GradientPaint( rect.x, rect.y + rect.height, new Color(200,220,235),
                                    rect.x, rect.y, new Color(230,235,250)  );
                setForeground( new Color(50,50,50) );
            } else {
                gp = new GradientPaint( rect.x, rect.y + rect.height, new Color(235,240,245) ,
                                        rect.x, rect.y, new Color(245,250,255) );
                setForeground( new Color(100,120,160) );
            paintingRect = rect;
            //JLabel renderer = new JLabel();
            setText( value == null ? "" : value.toString() );
            //setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
            //   brdr) );
            return this;
        public static void main(String[] args) {
            DefaultTableModel model = new DefaultTableModel(20,5);
            JTable table = new JTable( model );
                table.getTableHeader().setDefaultRenderer( new HeaderRenderer() );
            JFrame frame = new JFrame("Header Renderer Test");
                frame.add( new JScrollPane(table) );
                frame.pack();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
    }ICE

  • The green forward and back arrows under File and Edit disappeared after I downloaded the new Firefox Toolbar. How do get them back?

    The green arrows for page forward or back at the top left under File and Edit disappeared after I downloaded the new Firefox toolbar (for 3.6) and were replaced by Most Visited, Getting Started and Latest headlines Icons, which I have little use for. How do I get the Original Toolbar back?

    Is the Navigation Toolbar not being displayed? See below.
    <u>'''Can't see the Menu Bar'''</u> (File, Edit, View, History, Bookmarks, Tools, Help)?
    Turning the Menu Bar on and off is a new feature in version 3.6.
    ''(~~red:Linux & OSX see~~: [[Menu bar is missing]] )''
    <u>''Windows'' Method 1.</u> '''''Hold down''''' the key and press the following letters in this exact order: V T M then release the key
    <u>''Windows'' Method 2.</u> Tap the F10 key, while the Menu bar is visible, choose "View > Toolbars", click "Menu Bar" so that a check mark is placed next to Menu Bar
    <u>''Windows'' Method 3.</u> Tap and release the key. The Menu Bar will be displayed; then choose ~~red:V~~iew > ~~red:T~~oolbars and click on ~~red:M~~enu Bar so that a check mark is placed next to Menu Bar
    The Menu Bar should now be displayed permanently, unless you turn it off again using View > Toolbars. Check mark = displayed, NO check mark = not displayed.
    See:
    http://support.mozilla.com/en-US/kb/Menu+bar+is+missing
    http://kb.mozillazine.org/Toolbar_customization#Restoring_missing_menu_or_other_toolbars
    <u>'''Navigation Toolbar, Bookmarks Toolbar and other Toolbars'''</u> under View > Toolbars. Clicking on one of them will place a check mark (display) or remove the check mark (not displayed).
    <u>'''To display the Status Bar'''</u>, View, then click Status bar to place a check mark (display) or remove the check mark (not displayed).
    <u>'''Full Screen mode'''</u>
    http://kb.mozillazine.org/Netbooks#Full_screen
    Also see:
    ''' [[Back and forward or other toolbar buttons are missing]]'''
    '''[[Navigation Toolbar items]]'''
    '''[http://support.mozilla.com/en-US/kb/How+to+customize+the+toolbar How to customize the toolbar]'''

  • My iPhone 4 with iOS 6 is making me start to hate Apple. Any App and at any time I open and I can not view it or move for more than 2 minutes, they close themselves. During connections, it also gives this problem and the signal disappears after a few seco

    My iPhone 4 with iOS 6 is making me start to hate Apple. Any App and at any time I open and I can not view it or move for more than 2 minutes, they close themselves. During connections, it also gives this problem and the signal disappears after a few seconds back but often the person on the other end has hung up ... I can not stand it anymore, someone suggests something?
    Besides these problems, there is the battery, which was bad got worse, she is not lasting more than 10 hours, even without using the phone.
    Sometimes it even seems that the problem was solved, but my joy did not last long after I celebrate all the problems return, is incredible ...
    thanks.
    Sorry my bad Inglês.

    Try a reset hold home/sleep buttons until Apple logo appears
    If that does not improve try a restore
    http://support.apple.com/kb/HT4137
    For your information
    We are NOT Apple here we are all users helping other users
    so emotion is ignored

Maybe you are looking for

  • Problem with KB3039066 Update

    Running Windows 7 Home Premium, 64 bit, SP1 with all updates other than this one. This update was automatically downloaded by Windows Update along with several other updates. After installation, restart was required but the computer hung with the mes

  • 6300 power saver & sleep mode

    Hello, My problem is that after only one week that passed after I bought a Nokia 6300 my power saver and sleep mode stopped working. I tried turning them on and off or even put one on "off" and the other one "on" but it seems they just stopped activa

  • De-installing application

    Since I've upgraded from Jaguar to Leopard, I can't get my old version of Photoshop to open. I was going to remove program and install it again. Is it a simple matter of dragging the program to the trash to de-install?

  • Everytime I print anything, it prints in mini form.

    I am trying to print using Firefox, and every time I print anything, it prints a tiny version instead of the whole page. I do not have this problem when printing with other browsers. I've checked the Firefox printer settings, they are correct. I trie

  • Trouble with bridge mode and port forwarding

    I have a Westell Model 6100F DSL modem in bridge mode into my network and I'm having trouble forwarding ports. Is there any general guidance available to do this. I have set many of my friends networks up to allow port forwarding but all have been on