JTable Grid Lines

How can I make the Grid Lines (Vertical and Horizontal) of the JTable extend to the bottom even without data? Any suggestion is highly appreciated. Thank you.

Well, you can add some custom painting yourself. Here is a simple example that might get you started:
import java.awt.*;
import javax.swing.*;
public class TableLines extends JFrame
     JTable table;
     public TableLines()
          table = new JTable(10, 5)
               public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    g.setColor( Color.RED );
                    int y = getRowHeight(0) - 1;
                    g.drawLine(0, y, getSize().width, y);
          table.setPreferredScrollableViewportSize(table.getPreferredSize());
          JScrollPane scrollPane = new JScrollPane( table );
          getContentPane().add( scrollPane );
     public static void main(String[] args)
          TableLines frame = new TableLines();
          frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
          frame.pack();
          frame.setLocationRelativeTo( null );
          frame.setVisible(true);
}

Similar Messages

  • JTable Grid Lines became very light when changed to JGoodies L&f

    After changing to the JGoodies Look and Feel, my Table Grid Lines (Row and Column Lines) look very light. They are hardly visible. The former orinignal black grid lines looks light as gray. Is there a way to change the color of Grid lines using the Table Renderers or do I need to do anywhere else
    Can you help me in that. I checked through the API but did not find a function to set so..
    Update to my Question_
    I have placed the below statement in my Overridden getTableCellRendererComponent method as the first statement
    table.setGridColor(Color.red);
    The probelm is everytime I switch windows (between my application and any other program), my application is almost dying (GUI gets completely screwed) until I keep clicking on the Application and then it gets back
    Edited by: hemanthjava on Nov 10, 2008 5:25 AM
    Edited by: hemanthjava on Nov 10, 2008 5:27 AM

    I am not expert in these, but please check out the following things and see whether it would solve your issue. (All these changes can be easily rolled back in case I'm wrong :). So make note of what you do)
    As per your httpd.conf, you have chosen an automatic configuration of Apache by OWCI installer itself. What it does is create an imageserver.conf file in a separate directory and these settings will be included in your httpd.conf as you can see in the first line: Include "C:/bea/alui/plumtreeconf/".
    If you check the imageserver.conf in that location, you would find a line like: Alias /imageserver/ "C:/bea/alui/ptimages/imageserver/". This aliases the original path "C:/bea/alui/ptimages/imageserver/" to /imageserver"
    To confirm whether this is done right, check the following:
    1. Acces 'http://<server ip / server name / localhost >/' from your browser
    This should display the Apache home page (as per your httpd.conf, it uses the default port 80; so no port number required)
    2. Access 'http://<server ip>/imageserver/' from your browser
    This should display the directory structure (if its not disabled) inside your 'C:/bea/alui/ptimages/imageserver/' folder. Also confirm that all the subfolders are accessible.
    3. If all the above is right, it means that your imageserver settings are right. Please check your portalconfig.xml for the correct settings: For example, <setting name="HTTPPort"> should be 7001 in your case. If its something else, change it and restart Weblogic for the settings to take effect.
    Hope this helps.

  • JTable grid line not appearing

    http://www.instaprint.com/images/helptable.gif
    I've tried...
    making the total width of the columns smaller than the width of the table,
    making the width of the table smaller than the preferred width of the JScrollPane,
    jobTable.getColumnModel().getColumn(0).setPreferredWidth(65);
    jobTable.getColumnModel().getColumn(1).setPreferredWidth(75);
    jobTable.getColumnModel().getColumn(2).setPreferredWidth(70);
    jobTable.getColumnModel().getColumn(3).setPreferredWidth(60);
    (Total Width = 270)
    scrollPane = new JScrollPane(jobTable);
    scrollPane.setPreferredSize(new Dimension(270, 191));
    scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
    constraints.insets = new Insets(0, 0, 0, 0);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(scrollPane, constraints);
    displayPanel.add(scrollPane);
    I'm using GridBagLayout, any ideas??

    thanks a lot guys
    i solved that using a post in the forums.
    i just had to write
    super..setBorderPainted(true);
    and it worked
    thanks

  • JTable custom grid line painting

    In my JTable, I need to change the appearance of the line between two cells (either making it into a dashed line or just changing the color, the latter probably being easier). I am currently planning to turn off the JTable's grid lines and paint my own grid lines with a custom TableCellRenderer. Does anyone have a better suggestion, or a guide on a good way to do what I'm trying to accomplish? Thanks.

    The table grid is painted in the BasicTableUI.paintGrid which is unfortunately a private method. However, you can do the following:
    1. Use JTable.setGridColor API to change the color
    2. Override the JTable.paintComponent and set a custom stroke before calling the super implementation. Here the assumption is that the core implementation doesn't change the stroke (which it doesn't in JDK 5.0). Not the cleanest way to do this, but it should work. Don't forget to restore the old stroke when you're done in paintComponent.

  • Is there a way to turn on grid lines in mailboxes like you could in Eudora?

    If anyone here has used Eudora, then you probably know that you could customize the message listing for a mailbox to turn on grid lines between message lines and or columns if you wanted.
    Does anyone know of a hack that could do that, or maybe just tell Mail to highlight every other row for easier list readability?
    Thanks!

    That would be an improvement to the interface. I've been looking for some time and not found a way to do it though. Anyone else?
    If anyone here has used Eudora, then you probably
    know that you could customize the message listing for
    a mailbox to turn on grid lines between message lines
    and or columns if you wanted.
    Does anyone know of a hack that could do that, or
    maybe just tell Mail to highlight every other row for
    easier list readability?
    Thanks!
    Mac Pro   Mac OS X (10.4.8)  

  • How to print a report without row numbers or grid lines?

    Is there a way to print a Discoverer report without row numbers or grid lines?
    Thank you.
    Blake

    Hi Blake
    You're not doing anything wrong.
    The settings made when you use Tools | Options | Sheet are global settings that are only applied to new workbooks and worksheets going forwards. These have no impact on existing worksheets or even the one you currently have open. This is because Discoverer does not know whether your original worksheets were setup in a certain way deliberately as opposed to inheriting the global settings as they were at that time. What this also means, reading between the lines, is that these settings must then be stored within the worksheet itself, and this is exactly what happens.
    Thus, to edit an existing worksheet's settings you need to open the worksheet, right-click in the sheet and from the popup select either Format Table or Format Crosstab depending upon the type of worksheet you are working with. After making any necessary changes you will need to save or re-save the workbook in order for those settings to be remembered for the next time.
    Best wishes
    Michael

  • How do I add a time stamp to the moving "Major Grid Lines" of a Waveform Chart?

    Hello
    I am using LV 8.5.1
    I am using a Waveform Chart and I have turned on the "Major Grid LInes" using the properties tab of my waveform chart. (properties-->scale->grid lines)
    When the code executes, I want to attach  a time stamp to each moving yellow grid line.
    So as the grid lines move from right to left, there is an associated time stamp for each.
    Can someone help!
    thanks
    J
    Solved!
    Go to Solution.
    Attachments:
    how do I add time to the yellow grid lines.vi ‏16 KB

    hova2010,
    If you right click on your graph and go to X Scale >> Style >> and then choose one of the 3 styles on the far left you shoul see timestamps for those grid lines.
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • When I have a border around a group of cellsand remove it, it also removes the grid lines. When I go to print the sheet, there are blank spaces where the border had been. I'm sing a MacBook.

    When I have  a border around a group of cell, how do I remove it. If I outline the cells again and then show in the Inspector NO BORDER, it removes not only the borderbut when I go to print it also the grid lines.

    What application are you using? Numbers? Excel? Something else?
    For help with Numbers spreadsheets go to this forum.
    If you are using Excel, Microsoft has a forum to help you.
    If it is something else, let us know what and we will try to point you in the right direction.
    Best of luck.

  • Printing iCal grid lines...?

    Hello.
    I would like to print my weekly calendar with the grid lines showing.
    Is there a way to do this?
    Thank you.

    Hi Jack,
    I'm sure anyone who actually knows details of iCal in Leopard is not allowed to say.
    Currently you could have 3-4 categories in different colors, but when you publish to the web/.Mac they are all in the same color
    I currently publish three seperate calendars to a Webdav server and use PHPiCalendar to view them. They all show up as separate individually coloured calendars.
    I'd submit your suggestions as user feedback if I were you.
    Best wishes
    John M

  • How can I make the GRID lines more bold within a table in the new Pages?  (Not the outline of a table)

    I can't find where to darken GRID lines on a table in the new Pages.  I can make the outline more bold, but not the grid lines within the table.  Is there a way to do this?  The default grid lines are far too faint.

    Yeah, the Help is missing a little.
    If you select the block of cells that you want to change, then in the Format inspector:
    Select the Cell tab
    Expand the Border section
    Set a line type
    Set a line width
    Choose a line color
    Choose one of the nine options for which borders get the new settings

  • Change Color from grid lines in Flash 2D Line Chart

    Hi,
    does anybody know how to change the color from the grid lines in 2D Line Chart?
    The color is always black (000000), I will use gray (CCCCCC).
    I can use a custom XML. Can you give me an example please???
    Where can I read something about the possible XML-Tags in Custom XML for Charts?
    Best regards
    Simona

    Simona,
    anychart.com has XML reference you can use for the charting engine in APEX.
    Try using custom XML and sticking this inside the grid > values tag:
    <lines color='0xCCCCCC' />- Marco

  • How to hide the grid lines between two rows in a ALv? Please help!

    Hi Experts,
             I have a ABAP ALV(reuse alv grid FM) report.
    The last field in the ALV is "Description" which can contain data of size more than 130 chars.
    Since the max field length in ALV grid is 130 chars hence I am splitting this field value whenever the field length is more than 130 chars.
    After splitting I am generating duplicate rows but with different "Description" field values ( each contains the splitted values".
    For example:
    Name| City | Description                             |
    Hari|HK    |Employee responsible for time management |
    Hari|HK    |and issue resolution                     |
    Now I want to hide the grid line between these two rows
    and just for Description field.
    In other words I want ALV to display like this:
    Name| City | Description                             |
    Hari|HK    |Employee responsible for time management |
    Hari|HK    |and issue resolution                     |
    How can I acheive this?
    Please provide some sample code.
    Please help. I will be really greatfull to your help.
    Thanks
    Gopal

    Hi Rich,
          If that is the case then atleast how can I hide the complete row grid line?
    Please give some sample code.
    Thanks
    Gopal

  • How do I remove unwanted dark grid lines from my Basic_Graphic_Textures?

    Basically, I have been having dark grid lines show up in files I create in Illutrator CS6 as of late.  This particular instance is surrounding a background layout im trying to create.  I select a 650x500 rectangle and apply a patterns fill.  To be specific, Patterns--->Basic Graphics--->Basic_Graphics_Textures-----Diamonds.  No matter what I do, there is a dark grid benath the fill. It shows up in any fill I have been doing lately.
    The above image is a layout with 3 layers.  1 white layer(bottom), 1 red/pink layer(middle), and the top layer being the rectangle/diamond fill.
    This only happens with pattern fills and with fluid repeating text fills.  Normally, the dark lines are full squares, but in the above image they are only running vertically. Any suggestions would be greatly appreciated.  I'm not sure  if this is just a hardware issue with my graphics card, or if I'm missing something else.

    The patterns are for filling space with a repeating pattern but have some problems as you are discovering. Try dragging the swatch for the Diamonds texture from the Swatch panel to a file you have open. You can see how the pattern is created. Notice the overhang on both sides. Does this look like your problem?
    By changing the stroke of the line in the Diamonds pattern to 0.25 and replacing the swatch I have to go out to 50% size to see the repeat like this

  • Unable to bold a cell verticle line in Cross-tab Format Grid Lines

    Hi
    I am unable to bold a random Cell vertical line inside the cross-tab. My cross-tab is having access database which pulls every data correctly,
    To elaborate , here is the images to make it clear.
    First one is the current output of cross-tab & 2nd one is the desired output :
    To make it more clear ,
    I am giving the screenshot of Format grid lines option,  when I have selected Cell vertical lines , I can change Line options (Like style,width,color) from it. When I change it, it changes all three lines simultaneously. But, in that, I just want to bold only the last line of this grid.
    The screenshot as follows (To denote the lines, I have put numbering under the vertical lines, where I want to bold only the third one) :
    Please let me know, if  any solution to this. I m using CRVS_13.
    Thanks in Advance.

    Hi,
    try to do this way..
    Right click on crosstab - > crosstab expert -> customize style -> select your particular column then goto Format Grid Lines -> select your particular one based view -> ok..
    I hope this not yet possible because select 1 automatically 2,3 vertical lines are selected..
    See how it works......Please update ASAP
    tHANKS,
    dj

  • Grid lines get displayed while opening reports in MS Word 2003

    When generating report using rdlc, We are getting grid lines (grey color) in word document (MS Word 2003).
    When opened with MS Word 2007 the grey lines are not get appeared. It's happening only in MSWord 2003.
    Is there any solution for this problem? Please provide suggestions.

    HI Hema,
    To open new document add this line.
    *--Opening a new document
    get property of gs_word 'Documents' = gs_documents.
    call method of gs_documents 'ADD' ."= gs_document.
    Regards,
    Sravanthi

Maybe you are looking for

  • Is Verizon going to get the Blackberry Storm 3 (9570)?

    I am currently an Alltel customer that was bought out by at&t.  We are set to change over in December or January.  I may or may not stay with at&t as I have heard bad things about their service.  I am interested in a complete touch screen Blackberry

  • Download speeds in practical terms

    If you are getting 60mb/s download speeds with your broadband service, how long should 1gb file take to download (in theory)?

  • Impact upgrade copied Roadmap.

    Hello, We are investigating in using our own Roadmap. It will be a copy of the ASAP Implementation Roadmap and will have new structure nodes with related project documentation. At the moment we are using the ASAP Implementation Roadmap V3.0 Sep 2005

  • 4G in Waseca, MN not working

    4G is supposed to have been turned on in our area yesterday. Even on Verizon's website it claims there is 4G here. We are not receiving 4G. The 3 major cities to the East, South and West all have working 4G, but for some odd reason it is like they fo

  • Online Photo Albums With Dreamweaver/FireWorks

    I try to make an online photo album with dreamweaver and fireworks and it says an "internal error occured" and wont work. Any idea wha the problem is?