Getting the default TableCellRenderer

Hello,
I need to get the default TableCellRender for a TableColumn. However, method getTableCellRender(TableColumn c) returns null if the the TableColumn is using the default TableCellRenderer. Is there any way to get my hands on the default TableCellRenderer?
Thank you
Elana

Hi,
TableColumnModel does not know anything about renderers. I use getCellRenderer of the JTable which contains the given TableModel. But the java api says that the the default value for the cellRederer variable is Null - which indicates that the Table is using the default renderer. I need to get that renderer somehow.
Here is my code
          public int getPreferredWidthForColumn(TableColumn tc, JTable table){
               int hw = columnHeaderWidth(tc, table),
               cw = widestCellInColumn(tc, table);
               return hw > cw? hw:cw;
          private int columnHeaderWidth(TableColumn tc, JTable table){
               TableCellRenderer renderer = tc.getHeaderRenderer();
               Component comp = renderer.getTableCellRendererComponent(table, tc.getHeaderValue(), false, false, 0, 0);
               return comp.getPreferredSize().width;
          private int widestCellInColumn(TableColumn col, JTable table) {
               int c = col.getModelIndex(), width = 0, maxw = 0;
               for (int i = 0; i<table.getRowCount(); ++i) {
                    TableCellRenderer renderer = table.getCellRenderer(i, c);
                    Component comp = renderer.getTableCellRendererComponent(table, table.getValueAt(i, c), false, false, i, c);
                    width = comp.getPreferredSize().width;
                    maxw = width > maxw ? width:maxw;
               return maxw;
This was taken from the Graphic Java 2 - mastering the JFC - verbatim..
Thank you

Similar Messages

  • How do I get the default Photostream on my MacBook Pro to match the Photostream on my iPhone and iPad?

    Essentially, I am having issues getting photos that I save on my iPhone or iPad to automatically appear on my MacBook's iPhoto app (and vice versa). The iPad and iPhone automatically share all photos between each other. I have iCloud set up and all of the photo sharing options selected on all devices, so that's not the issue. I used a bit of a workaround and created and shared a custom stream, which ultimately works. However, it involves a lot of moving photos around on all three devices, so I'd like to get the Photostream service working the way it's intended by getting the default Photostream connected to my iCloud account automatically syncing among all three devices.
    Thanks.

    Photos are kept in the My Photo Stream for 30 days or until more than 1000 have been added.  The photos will remain in the MPS for longer than 30 days if the 1000 limit is not reached.
    However, depending on when a device joined the iCloud feature and started receiving the MPS it will not see any that were added more than 30 days from the date of joining.  So if your MBP signed into iCloud and the MPS feature later than the other 2 devices it will not see photos that they might.  Also if you've turned off My Photo Stream on the MPB and then added it back it will only see the last 30 days worth.

  • How can I get the default value of a particular preference programatically. I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [tiki-view_forum_thread.php?comments_parentId=702631&forumId=1]
    Thanks - c</blockquote>
    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    How can I get the default value of a particular preference in FireFox?.
    I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.
    I see some that there are values for preferences in firefox.cs but I am not certain that these are being used as the default values for preferences. prefs.js in user's profile only has the updated values and not the default values.
    Any help towards acheiving this programtically is greatly appreciated.
    If the default values are stored in a file, kindly let me know the format in which it is stored for me to parse it programatically.
    == User Agent
    ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    Dear Friend,
    Here when you have the callableSattement as ?=proc(?), the first ? is an output parameter. So you should register it as out parameter using registeroutparameter.
    Then you can get the value from the outparameter using callablestatement.getXXX().
    Try that way.
    For free tral versions of JDBC Drivers go to www.Atinav.com

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

  • Trouble getting the default  user directory under Windows XP

    I m trying to get the default user directory under windows XP SP3.
    To do so, I'm using
    System.getProperty("user.home");
    I was expecting to get a path like "C:\Documents and Settings\user", nstead of that I get "C:\Documents and Settings\user\Destop".
    I checked the %USERPROFILE% and %HOMEPATH% window's environment variables and both of them are correctly set ( set to "C:\Documents and Settings\user").
    Is there any way to get the right path other than using : System.setProperty("user.home", "C:\\Documents and Settings\\user"); ?

    Thanks WalterLaan,
    The System.getenv("USERPROFILE") method will, at least, fix the problem under win XP.
    I guess i'll have to write a more refined method to be able to deploy my application under differents OSes.
    Regards.

  • Getting the default messaging app back

    i have a nokia e5-00. .bought it a few years back. .a month ago, i installed sms2.0 live app as the msging app. .it's done fine so far nw, bt i ws trying to get the default messaging app back but cant find a way to do so. There is no option to uninstall this app as it has nw become the native app for texting. Any help in this regard would be much appreciated. Thanx in advance.

    Did you try uninstalling by going to settings>application manager>installed apps>select app>select>options and select uninstall? 

  • Where does FireFox get the default value of a preference from. What is the format of the file that has the default value?

    Where does FireFox get the default value of a preference from. What is the format of the file that has the default value?. I need the actual default value for a particualr preference.
    About:config does show some default values but I need the source from which about:config picks up the default value.
    Any help in this direction is greatly appreciated.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    The prefs that aren't hidden if they are the default are stored in two JavaScript text files in the Firefox program folder
    You can open them via these links in a Firefox tab:
    <code>resource:///defaults/pref/firefox.js
    resource:///greprefs/all.js
    </code>
    ([/forum/1/702598])

  • Getting the default font - possible? (default fonts problem in InDesign Server CS5)

    Is there a way to decide whether a font is used as "default font" for a document?
    Or a simple way to see whether a font is used at all?
    The actual problem is that InDesign server (CS5 ver. 7.0.3.533) returns the "default font" along with all other used fonts, when looping through the document.fonts collection. This becomes a problem when the default font is never used in the document, and is also not present. Then the (name of) the default font may also become meddled by a style that does not even exist for that very font.
    This is indicated as a problem in our application... as a missing font, just as the call to InDesign server reports back. But the font (with that style) doesn't even exist.
    Running the same script on an desktop InDesign CS5 (ver 7.0.4) the unused default font of the same document is not returned at all.
    Thanks,
    Andreas

    To get the default font, just check:
    app.activeDocument.textDefaults.appliedFont
    Obviously this didn't solve the problem, since InDesign server has made up a font name that is reported as missing... and it's not equal to the default font. So there is some lack of logic in my previous description.

  • Getting the default Microphone

    Hello,
    I'm working on an audio/video conferencing app with FMS and
    Flex 2.0.1 (using Debug Flash Player 9.0.47 Mozilla/Windows Vista).
    When the client app starts, it should connect the default Camera
    and Microphone. Now, for the Camera this works fine, but I can't
    get my application to grab the default Microphone.
    According to the documentation (livedocs), if you don't pass
    an id for the Microphone, it should get you the default one. As far
    as I can tell, the default one should be the one that is selected
    when the Flash Settings dialog shows and this setting is persistent
    between different Flash sessions. Also, the reference to the
    default microphone should automatically change when the user
    changes the settings.
    However, I invariably get the Microphone with index=0. The
    code:
    var mic = Microphone.getMicrophone();
    What puzzles me is that Adobe claims that there is a way to
    get the default camera, but this seems impossible as the array of
    microphone indices is 0-based, and the argument to getMicrophone is
    an int. How does it distinguish between a call for microphone 0 and
    the default microphone?
    This has been solved better for the camera. The method
    Camera.getCamera() takes a String as an argument and this argument
    should contain the index of the camera (and not the name, as the
    documentation claims). The string can be null, in which case the
    default camera is returned.
    Does anyone know of a workaround to get the default
    Microphone? Has this been reported as a bug to Adobe?

    hi ThatGuyBS,
    Welcome to the Lenovo Forums.
    As the IdeaPad G505s uses a 2-in-1 audio jack (headphone and mic), you will need a headset splitter / adapter for a headset to work.
    If you're be using an external monophonic microphone only, you will need an extra 3.5mm Stereo male to 3.5mm Mono female adapter connected to the headset.
    Article:
    Microphone/Headset Jack - splitter needed for combo
    Sample items:
    - 3.5mm Stereo male to 3.5mm Mono female adapter
    - 3.5mm Headphone / Microphone adapter
    Alternatively, you can also use a USB microphone to elimiate getting an headset adapter.
    Regards
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Hi there,both my uncle and i are using iphone 5 that runs on 6.1.2 whenever i send or receive tweets i'am not getting the twitter default sound,i'am getting tri-tone sound.My uncle however would get the default twitter sound whenever he sends or receive.W

    Hi there,both my uncle and i are using iphone 5 that runs on 6.1.2 whenever i send or receive tweets i'am not getting the twitter default sound,i'am getting tri-tone sound.My uncle however would get the default twitter sound whenever he sends or receive.What's up with that?

    Check: Settings - Sounds - Tweet - Set to your preference.

  • I am creating a project in iDVD. There is no audio in the menus. How do u get the default music back?

    I am creating a project in iDVD. There is no audio in the menus. How do u get the default music back?

    If the theme had music associated with it originally choose a new theme and then go back to the original theme.  That will restore the audio to the menu audio bin.
    OT

  • How can I Get the default series of my UDO Document  ?

    Hi all
    I have create a new UDO (Type=Document,  ManageSeries = Yes) 
    Is there a way to get the default series of my UDO ?
    NB: I have tried the following code sample (SDK help) but it didn't work:
    Example
    [Visual Basic] The following is a VB.NET sample that retrieves the default series of a specified document type.
    Dim oCmpSrv As SAPbobsCOM.CompanyService
    Dim oSeriesService As SAPbobsCOM.SeriesService
    Dim oSeries As Series
    Dim oDocumentTypeParams As DocumentTypeParams
    'get company service
    oCmpSrv = oCompany.GetCompanyService
    'get series service
    oSeriesService = oCmpSrv.GetBusinessService(ServiceTypes.SeriesService)
    'get new series
    oSeries = oSeriesService.GetDataInterface(SeriesServiceDataInterfaces.ssdiSeries)
    'get DocumentTypeParams for filling the document type
    oDocumentTypeParams = oSeriesService.GetDataInterface(SeriesServiceDataInterfaces.ssdiDocumentTypeParams)
    'set the document type (e.g. A/R Invoice=13)
    oDocumentTypeParams.Document = "MyUDO_Code"
    'get the default series of the SaleOrder documentset the document type
    oSeries = oSeriesService.GetDefaultSeries(oDocumentTypeParams)
    'print the default series name
    Debug.WriteLine(oSeries.Name)
    'print the first number of the series
    Debug.WriteLine(oSeries.InitialNumber)
    Regards

    Hi all
    My problem is resolved
    I have find the field "DfltSeries" On the table "ONNM"
    Thanks for all

  • Getting the default charset.

    Hi,
    I need to get the default charset of the platform that I am using. I found a workaround by using an InputStreamReader with the required parameters and calling getEncoding() method. After this, I can user Charset.forName(...). On Windows platform, I get "Windows-1252". That's ok.
    This solution works but, maybe someone knows a simpler way to get the same information. This is what I would like to know.
    Thanks !

    Just been looking for exactly the same thing, so Google led me here. It also lead me to this:
    http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html
    In Java 1.5 ( but not in earlier versions), the Charset class contains a defaultCharset() static method, defined when the JVM starts up.
    Hope this helps.

  • Getting the default fileRealm to take precedence?

    I've got a custom realm which is doing a JNDI lookup as part of
    the getUser() function call, leading to infinitely looping recursive
    calls to getUser (since weblogic is checking my custom realm first).
    Is there any way to get the default file realm to take precedence?

    no solution. What do you mean, have "guest" always return true?
    I'm toying with the idea of trying to change the current user
    to be 'guest' or 'system' whenever a JNDI lookup is being done
    so that it will fallback to the file realm and always work, is
    that what you mean? (ie. my realm would be hardcoded to return
    null for a getUser with 'system' or 'guest', thus forcing the file
    realm to take over)
    I don't know how to change the current user for the context of
    that lookup of the DataSource and the following getConnection...
    my attempts at creating an initial context with a different user
    are failing, so if you've got something working that sets the current
    user to guest, I'd love to see it.
    -Don
    "Chris Danek" <[email protected]> wrote:
    >
    Good reading definitely, but it hasn't seemed to help
    me. Have you
    found a solution to your problem? I'm almost to the point
    of just
    letting "guest" always return true for that particular
    function....
    cd
    "Don Dwoske" <[email protected]> wrote:
    it seems we are having the same problem. look at the
    discussion
    tom and I are having.
    If you figure out a nice solution, let me know what you
    did.
    Does your code always go into an infinite recursion?
    Mine does
    not, which is confusing the hell out of me, it seemsto
    happen
    at random.
    -Don
    "Chris Danek" <[email protected]> wrote:
    I've got a custom realm which is doing a JNDI lookupas
    part of
    the getUser() function call, leading to infinitely looping
    recursive
    calls to getUser (since weblogic is checking my custom
    realm first).
    Is there any way to get the default file realm to take
    precedence?

  • How to get the default date as current date in input filed in VC

    Hi
    In my VC application i have two date fields. we are allowing the end user to select the From Data and Todate though Data pickers, But the client asking to make the today's date as default date in Todate field , rather picking up from the data picker,
    Unless the  user wants change the todate from the current date. It should display today's date as default date.
    can any body tell me how to do it.
    Regards
    Vijay

    Hi All,
    I have an issue an implementing the "Exporting the Table data to Excel."
    My VC version is 7.0
    Portal version NW 2004s.
    By refering the following link, i have implemented Export To Excell functionality in VC.
    2) Another one that's in the Visual Composer WIKI:
    https://wiki.sdn.sap.com/wiki/display/VC/Exportingdatafrom+VC
    By refering to 7th page in the document. It is explained to add the data source object from the 'info' port and add the field called 'RAPTNAME'to the DATA source object.
    But the RFC object which i added to the story board, i havent find any 'info' port in my added RFC. But still i have added the data store object and added field. then
    copied the following given formula in the document in respective formula window ,Formula showin as valid. when i click on check button.
    copied formula :
    "pcd!3aportal_content!2fcom.sap.pct!2fplatform_a
    dd_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.b
    ex?QUERY=" & STORE@REPTNAME &
    "&BI_COMMAND_1-
    BI_COMMAND_TYPE=EXPORT&BI_COMMAND
    1-EXPORTFORMAT=XLS&BI_COMMAND_1-
    null="
    i am able to run the application. After i run the application . once i click on the button 'ExportToExcel' i am getting the following error.
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    Could not find portal application com.sap.ip.bi.service.generic.
    Exception id: 05:32_01/05/07_0001_18800950
    See the details for the exception ID in the log file
    Can u please tell me what is the problem
    Regards
    Vijay

Maybe you are looking for

  • How do i get rid of old rented movies that are a week over due when it was only a one day rental?

    hi, i have been trying to get rid of my rented movies that keep wanting to download and they are using up all my space on the ipod. because of this i have to restore my ipod every time i try to use it because of the two movies "The Proposal" and "Me,

  • How to connect AD595 thermocouple amplifier?

    the picture below is my connection of the thermocoupler amplifier, i realise that that is no doted for me to guide as pin number 1,so i according the data sheet and assemble it, the orange colour wire is grounded n yellow colour wire is the voltage s

  • Example for FAGL_GET_OPEN_ITEMS_GL

    Hi All, I wanted to use the FM FAGL_GET_OPEN_ITEMS_GL Can any one tell me what are the parameters value  to pass for this function module. Please Explain this with Example. Thanks.

  • Didn't sync before restore!!Help.

    I've had my iPhone since June of last year. I was a complete newbie to the iPhone/iPod world. I had no idea that I needed to do updates and sync my phone. Well, when I found out about picture messaging, I just went ahead and did the update without sy

  • How to get OTL Alternate Name From (Timekeeper or Employee) Preference

    Hi there In the current implementation our OTL functional consultant setup Alternate Name Definition:- FOR EMPLOYEE Preference as follows:- Definition Name = XX Employee DEF Alternate Name Leave Without Pay Values (DFF) Payroll Element (ATTRIBUTE1) "