Snapshot of a colored table

Hi,
Does anyone know of any design pattern or of any standard class that can return a snapshot of a JTable?
What I want to do is to create a small picture of a large table and then add the zooming and panning functionality to it, so that we can easily traverse the large table.The table has cells of different colors.
So is getting a smaller snapshot directly possible or do I have to actually create a 2D graphics picture of the table.
Thanks
Connie

Hi Dr Ness,
as you suggested I had a look at that thread and tried that code, but it returns a blank image.The code I have used is as follows.I have created a class called dynamic table which is supposed to display the image of the component passed in its constructor in a new frame.
public class DynamicTable {
public DynamicTable(Component cmp) {
BufferedImage bi=createImage(cmp);
JFrame jf1 = new JFrame();
jf1.getContentPane().paint(bi.getGraphics());
jf1.setVisible(true);
jf1.pack();
jf1.setSize(300,300);
public static BufferedImage createImage(Component cmp) {
Rectangle d = cmp.getBounds();
BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi.createGraphics();
//temporary container
JFrame jf = new JFrame();
jf.getContentPane().add(cmp);
jf.pack();
SwingUtilities.paintComponent(g2d,cmp,jf.getContentPane(), 100,100,d.width,d.height);
return bi;
any suggestions will be of great help.
thanks
connie

Similar Messages

  • How can I get scripting access to color values in the indexed Color Table?

    Hey all,
    I'm relatively new to Photoshop scripting, but I've just finished a script that helps my fiance with some very tedious tasks related to textile design.
    The last issue that I'm having is that the image I start with is indexed and has a very specific Color Table pallete ( 2-12 colors max + black and white, so 14 max total, sometimes as few as 2 ). Part of my script, I create a number of color chips and fill them with black currently... What I'd like is to be able to get a count of the colors in the Color Table and put the actual color values as hex into an 1 dimension array, so that I fill those black chips I've made with the actual colors from the Color Table.
    ( I don't know if it makes a difference but I'm converting the image to RGB mode at some point in the script, and back to Indexed Exact ).
    Can anyone please help me do this? Needs to be compatible with CS5 and CS6 ideally.
    Thanks!!

    Cheers for that, your code works but what had thrown me was that the collections appear to be empty - so I hadn't actually tried retrieving one, I just assumed I was looking in the wrong place.
    So if I do this in my Immediate window:
     App.Current.Resources.Count
     0
    Yet when I request it, I get one:
     App.Current.Resources["TitleTextStyle"]
     {Windows.UI.Xaml.Style}
         base {Windows.UI.Xaml.DependencyObject}: {Windows.UI.Xaml.Style}
         BasedOn: {Windows.UI.Xaml.Style}
         IsSealed: false
         Setters: {Windows.UI.Xaml.SetterBaseCollection}
         TargetType: {Name = "TextBlock" FullName = "Windows.UI.Xaml.Controls.TextBlock"}
    Looking at the resources object itself, I get similar apparently empty collections:
     App.Current.Resources
     {Windows.UI.Xaml.ResourceDictionary}
         base {Windows.UI.Xaml.DependencyObject}: {Windows.UI.Xaml.ResourceDictionary}
         Count: 0
         IsReadOnly: false
         Keys: Count = 0
         MergedDictionaries: {Windows.UI.Xaml.DependencyObject}
         Source: null
         ThemeDictionaries: {Windows.UI.Xaml.ResourceDictionary}
         Values: Count = 0

  • How do I fix RGB "info" pointing in color table customizer?

    When I hover my cursor over a cell in the color table customizer, the "info" panel is supposed to show the RGB values of that cell (there's 256 cells, one for each color). Which cell the cursor is pointing at for this RGB info purpose is supposed to be determined by the upper left corner of the mouse cursor, that is to say, where the is the "point" of the arrow cursor is. Unfortunately the RGB info is being shown for the cell near the middle or lower right portion of my cursor, and not the upper left point. However the upper left point of my cursor DOES properly select the color when I click on the cell and it brings up the color picker dialog box). Does anybody know how to fix this for the "info" panel's interaction with pointing at the color cells of the color table?
    I'm working with a fresh install of the 32bit version of Photoshop CS6, and my OS is Windows 7 Home Premium x64 (mentioning my OS, just in case my OS somehow has some effect on this).

    When I hover my cursor over a cell in the color table customizer, the "info" panel is supposed to show the RGB values of that cell (there's 256 cells, one for each color). Which cell the cursor is pointing at for this RGB info purpose is supposed to be determined by the upper left corner of the mouse cursor, that is to say, where the is the "point" of the arrow cursor is. Unfortunately the RGB info is being shown for the cell near the middle or lower right portion of my cursor, and not the upper left point. However the upper left point of my cursor DOES properly select the color when I click on the cell and it brings up the color picker dialog box). Does anybody know how to fix this for the "info" panel's interaction with pointing at the color cells of the color table?
    I'm working with a fresh install of the 32bit version of Photoshop CS6, and my OS is Windows 7 Home Premium x64 (mentioning my OS, just in case my OS somehow has some effect on this).

  • How to load Color Table in VB?

    Hi, I'm very new to Illustrator scripting and this problem drives me crazy. I can't find any information on the Web, so please help~!
    I have a series of illustrator files(.ai) and a color table(.act), and I wanna apply the same color table to all these image files. I know how to do it in Illustrator: open the ai file, "save for web" then load the color table in by click the color palette button, then click on "done". But how can I do this in VB? anyone have any idea?
    Your help is highly appreciated!
    Cheers,

    any idea? I really need help~

  • How to load color table in a indexed mode file??

    How to load color table in a indexed mode file??
    Actually, if i opened a indexed file and want to edit color table by loading another color table from desktop (or any other location), any way to do this through java scripting??

    continuing...
    I wrote a script to read a color table from a GIF file and save to an ACT color table file. I think it might be useful for someone.
    It goes a little more deeper than the code I posted before, as it now identifies the table size. It is important because it tells how much data to read.
    Some gif files, even if they are saved with a reduced palette (less than 256), they have all the bytes for the full color palette filled inside the file (sometimes with 0x000000). But, some gif files exported in PS via "save for web" for example, have the color table reduced to optimize file size.
    The script store all colors into an array, allowing some kind of sorting, or processing at will.
    It uses the xlib/Stream.js in xtools from Xbytor
    Here is the code:
    // reads the color table from a GIF image
    // saves to an ACT color table file format
    #include "xtools/xlib/Stream.js"
    // read the 0xA byte in hex format from the gif file
    // this byte has the color table size info at it's 3 last bits
    Stream.readByteHex = function(s) {
      function hexDigit(d) {
        if (d < 10) return d.toString();
        d -= 10;
        return String.fromCharCode('A'.charCodeAt(0) + d);
      var str = '';
      s = s.toString();
         var ch = s.charCodeAt(0xA);
        str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
      return str;
    // hex to bin conversion
    Math.base = function(n, to, from) {
         return parseInt(n, from || 10).toString(to);
    //load test image
    var img = Stream.readFromFile("~/file.gif");
    hex = Stream.readByteHex(img);      // hex string of the 0xA byte
    bin = Math.base(hex,2,16);          // binary string of the 0xA byte
    tableSize = bin.slice(5,8)          // Get the 3 bit info that defines size of the ct
    switch(tableSize)
    case '000': // 6 bytes table
      tablSize = 2
      break;
    case '001': // 12 bytes table
      tablSize = 4
      break;
    case '010': // 24 bytes table
      tablSize = 8
      break;
    case '011': // 48 bytes table
      tablSize = 16
      break;
    case '100': // 96 bytes table
      tablSize = 32
      break;
    case '101': // 192 bytes table
      tablSize = 64
      break;
    case '110': // 384 bytes table
      tablSize = 128
      break;
    case '111': // 768 bytes table
      tablSize = 256
      break;
    //========================================================
    // read a color (triplet) from the color lookup table
    // of a GIF image file | return 3 Bytes Hex String
    Stream.getTbColor = function(s, color) {
      function hexDigit(d) {
        if (d < 10) return d.toString();
        d -= 10;
        return String.fromCharCode('A'.charCodeAt(0) + d);
      var tbStart = 0xD; // Start of the color table byte location
      var colStrSz = 3; // Constant -> RGB
      var str = '';
      s = s.toString();
         for (var i = tbStart+(colStrSz*color); i < tbStart+(colStrSz*color)+colStrSz; i++) {
              var ch = s.charCodeAt(i);
              str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
          return str;
    var colorHex = [];
    importColors = function (){
         for (i=0; i< tablSize; i++){ // number of colors
              colorHex[i] = Stream.getTbColor(img, i);
    importColors();
    // remove redundant colors
    // important to determine exact color number
    function unique(arrayName){
         var newArray=new Array();
         label:for(var i=0; i<arrayName.length;i++ ){ 
              for(var j=0; j<newArray.length;j++ ){
                   if(newArray[j]==arrayName[i])
                        continue label;
              newArray[newArray.length] = arrayName[i];
         return newArray;
    colorHex = unique(colorHex);
    // we have now an array with all colors from the table in hex format
    // it can be sorted if you want to have some ordering to the exported file
    // in case, add code here.
    var colorStr = colorHex.join('');
    //=================================================================
    // Output to ACT => color triplets in hex format until 256 (Adr. dec 767)
    // if palette has less than 256 colors, is necessary to add the
    // number of colors info in decimal format to the the byte 768.
    ColorNum = colorStr.length/6;
    lstclr = colorStr.slice(-6); // get last color
    if (ColorNum < 10){
    ColorNum = '0'+ ColorNum;
    cConv = function (s){
         var opt = '';
         var str = '';
         for (i=0; i < s.length ; i++){
              for (j=0; j<2 ; j++){
                   var ch = s.charAt(i+j);
                   str += ch;
                   i ++;
              opt += String.fromCharCode(parseInt(str,16));
              str = '';
         return opt
    output = cConv(colorStr);
    // add ending file info for tables with less than 256 colors
    if (ColorNum < 256){
         emptyColors = ((768-(colorStr.length/2))/3);
         lstclr = cConv(lstclr);
         for (i=0; i < emptyColors ; i++){
              output += lstclr; // fill 256 colors
    output += String.fromCharCode(ColorNum) +'\xFF\xFF'; // add ending bytes
    Stream.writeToFile("~/file.act", output);
    PeterGun

  • BCG Brightness Contrast Gamma - Looking for BCG function returning color table / lookup table coded in pure G and applicable to Intensity Graph or Picture Control

    Looking for BCG function returning color table / lookup table coded in
    pure G and applicable to 8-bit Intensity Graph or Picture Control. Do
    not want to use IMAQ Vision is this particular application.  Any
    help is appreciated.
    Sincerely,
    Don

    Take a look at this color model software I put together.  (Don't concern yourself much with the basic programming at this point.). The color component generator subVI is borrowed from a LabVIEW example.
    First look at test_color2.vi.  If you adjust the sliders of the various controls, you will see how it works.  You can see that for pure B&W images, brightness, contrast, and gamma (which I think I have coded correctly) are all fairly straightforward to modify.
    Now look at test_color3.vi.  Here we try to adjust BCG for color images using the color model shown here where current color component clusters are carried into the BCG event cases via shift registers.  You can see that once color is introduced into the image, it becomes difficult to mix the colorizing with the BCG model.  And this is pretty much where I am right now.
    Would be interested in comments / suggestions.
    Sincerely,
    Don
    Attachments:
    test_color2.llb ‏2251 KB

  • Lexmark all-in-one printer error: Color table is missing

    I've got this "Color table is missing." only after I accepted the automatic update 2.2 of 24.2 MB coming from Lexmark.
    To solve the problem I had to remove ALL traces of Lexmark drivers and software, then reinstall the correct driver, the one for Mac Os 10.6 (snow leopard).
    Now I must remember NOT to accept any automatic update and I can use again my X3550.
    So please DO NOT INSTALL that update 2.2 of 24.2 MB!!!
    Message was edited by: Daniele P.

    Color table is missing: solved.
    I've got this "Color table is missing." only after I accepted the automatic update 2.2 of 24.2 MB coming from Lexmark.
    To solve the problem I had to remove ALL traces of Lexmark drivers and software, then reinstall the correct driver, the one for Mac Os 10.6 (snow leopard).
    Now I must remember NOT to accept any automatic update and I can use again my X3550.
    So please DO NOT INSTALL that update 2.2 of 24.2 MB!!!

  • Write tif file color table

    Hello:
    I am trying to write a 16-bit tif file with the proper color table using Vision utility.  I cannot get the proper color table.  I can save as other formats but have special requests for 16-bit tif.
    I have attached an example VI to show you this including a test color table and image.  I will cross post in the Vision forum also.  Any help is appreciated.
    Sincerely,
    Don
    Attachments:
    test_write_tiff.vi ‏56 KB
    normalize_2darray_data_for_16-bit_scanner.vi ‏13 KB

    Identical post in machine vision message board: write tif file color table
    Hope this helps.
    -Ben
    WaterlooLabs

  • Setting color table of intensity graph

    Hi!
    I set the attribute color table of an intensity graph to a rainbow
    distribution of the colors, but now I'm not able to change the color
    table with the markers in the front panel.
    Do you know a solution?
    Thanks, Markus

    > I set the attribute color table of an intensity graph to a rainbow
    > distribution of the colors, but now I'm not able to change the color
    > table with the markers in the front panel.
    > Do you know a solution?
    >
    Intensity graphs have two different modes for its color definition.
    The first, typical one, is the Color array. It can be set using
    either attributes or interactively and lets you define number/color
    pairs that create either a smoothly interpolated or a banded color
    gradient. The second mode is the color table. This is useful for
    bitmaps or for cases where the color table has been custom generated
    on the diagram. When using the color table, the Z scale is still
    useful for determining which numbers map to the 0-255 range of the
    color table. If you set the
    Z scale to autoScale, it will find the
    min and max of the data and set the Z to show all data mapped through
    the color table. If set smaller, some of the values will map to the
    first and last out of range colors. If set larger, it will map the
    values to a smaller and smaller number of the colors in the color
    table.
    It sounds like you really want to be using the color array and not
    the color table. The intensity graph automatically switches for
    you when you write attributes to it, but there is a way to change
    it back the the color array using a popup or attribute.
    Greg McKaskle

  • PE White Balance for separate color tables

    I'm trying to use 24-patch color checker. I already have image collected. But they are not exactly 6500K and 2850K. Can I use the images to create separate color tables ?

    Yes, you can. It is fine if the numbers don't match, as long as they are reasonably close (e.g., for 6500 it's fine if your image is in the 5000 to 7500 range).

  • Sensor analog balance for 2850K color table

    Hello
    I currently try to create a dual illuminant camera profile using DNG Profile Editor 1.0.0.46 beta for our Aptina CMOS MT9P031 based camera.
    Using the DNG SDK 1.4, i'm converting the BAYER pattern images to a DNG with a Embedded Profile which has identity matrices set on the color matrixes and analog balance DNG tags.
    D65 shooting conditions:
    - High-CRI LED based light source set to 6500K @ 300 lx (spectrum fit 96%)
    - CMOS sensor analog gains were adapted to achieve a neutral image at the D65 shooting conditions
    a. Do I have to keep all component gains to 1.0 or adjust for the illumination?
    b. Does it matter what I apply on the embedded camera profile on the AnalogBalance DNG tag?
    Std A shooting conditions:
    - Same light source set to 2850K @ 300 lx (spectrum fit 92%)
    - CMOS sensor analog gains were _not_ adapted to achieve a neutral image. This obviously results in a orange color tint which can be eliminated using the white balance slider on the "Color Matrices" tab of the DNG Profile Editor.
    c. Do I have to adapt the analog gains when shooting for 2850K
    Using the converted DNGs from shooting conditions above, I can create the color table for 6500K using the "Chart" tab, but not the 2850K color. I always receive the error message:
    "Non-neutral gray patches. The gray patch in row 4, column 3, has a significant color cast. Please reshoot the chart carefully to avoid color casts and try again."
    ...but when using the whitebalanace slider on the "Color Matrices" tab in advance of the "Chart" tab, I can tune the Std A image to a perfect neutral image. There is no color cast visible anymore.
    d. Any ideas what I did wrong?
    Kind regards
    blad

    Hi Eric
    Thanks for taking the questions. Some details and clarifications:
    Our analog gains are set to give a neutral image at D65 and we keep them unchanged even if the in-camera white balance algorithm detects a Std. A illuminant. This means the unprocessed RAW image contains a very warm color tint. Obviously, there is much more red than green and blue in the image. Is it correct, that then f.e. apply:
    oNegative->SetAnalogBalance(0.863, 0.599, 0.389);
    -> The values are derived from the red, green and blue components in the 2850K reference image from one of the gray patches on the color checker.
    Thanks for the tip with the missing ColorMatrix values. When I specify a ColorMatrix and AnalogBalance as (described above) I am able to create a color table using the chart tab in Profile Editor the reference image at D65. I keep getting the error for the reference image at 2850K. Did I specify the ColorMatrix the wrong way?
    oProfile->SetCalibrationIlluminant1(lsStandardLightA);
    dng_matrix_3by3 oRGBMatrix( 1.627, -0.448, -0.222,
                               -0.434,  1.787, -0.350,
                               -0.341, -2.014,  3.294);
    dng_matrix_3by3 oXYZ_to_SRGB_D65( 3.2404542, -1.5371385, -0.4985314,
                                     -0.9692660,  1.8760108,  0.0415560,
                                      0.0556434, -0.2040259,  1.0572252 );
    dng_matrix_3by3 oCA = MapWhiteMatrix(StdA_xy_coord(), D65_xy_coord());
    oProfile->SetColorMatrix1(oXYZ_to_SRGB_D65 * Invert(oRGBMatrix) * oCA);
    As soon as I open the DNG with values from above in DNG Profiel Editor I get a cold image with a blue color cast and click-white balance tells me ~3350K/28 instead of 2850K/0.
    Regards
    Daniel

  • How can create color table for "write bmp file.vi"?

    i want to create a color table for a 8 bit bitmap.The color table is the input of "write bmp file.vi". how can i make it?
    thanks!

    > i want to create a color table for a 8 bit bitmap.The color table is
    > the input of "write bmp file.vi". how can i make it?
    > thanks!
    >
    There is a color control on the front panel numerics palette. A color
    in LV is a four byte xRGB formatted number. So you can make an array of
    the color numerics and set them by hand or format the numbers however
    you like. If unwired it will use the LV color palette which is pretty
    much the HTML palette.
    Greg McKaskle

  • Lexmark Z1420 - Color table is missing

    Hi,
    Apologies if this question has been asked a number of times but as you can imagine it can be frustrating when you are unable to print off important documents.
    I am unable to print on my Lexmark Z1420 printer as I keep getting the following message:
    *+Color table is missing. You must uninstall and reinstall the printer software+*
    I have uninstall and reinstall the printer software a number of times and carried out all the current updates but still no luck.
    Does any one have any suggestions on how to resolve this?

    Does anything in these threads help?
    http://discussions.apple.com/thread.jspa?messageID=10696121&#10696121
    http://discussions.apple.com/thread.jspa?messageID=10720060&#10720060
    http://discussions.apple.com/thread.jspa?messageID=10674474&#10674474
    And if you'd like to help sort this out, sending me the /var/log/install.log files available (including any .0, .1 etc. log files) and the /var/log/cups/error_log file at [email protected] would be helpful.
    Message was edited by: John Blanchard1

  • Save for devices color table

    I have a bunch of JPG images that I would like to make a few of the colors transparent for a web page that I'm working on.  For some reason when I go to "Save for web and devices" and choose a format that alows transparancy, the color table is a dark gray color rather then showing the colors in the image and the icons below the color table are disabled.   So I can't choose what color(s) I wanted to make transparent in the image.  What could be the problem, and is there a solution other then reinstalling the program?
    Thanks

    You don't need to mess with a color table.
    Read carefully:
    Create a Photoshop document with a layer (not Background) that's partially erased/deleted (so that it's partially transparent).  Let us know if you need specific instructions on how to do that.
    File - Save As - PNG.
    Yes, that's all there is to it.
    -Noel

  • FCP 10.2 crashes when using a CMYK color table

    So after updating to FCP 10.2 it crashes when I try using the color picker in a CMYK color table. It worked super before so this cannot be a feature. Does anyone have a work around?

    RGB is an option, but imagine you have created a few color palettes for various corporate designs and some of them are using CMYK, you do not want to convert all of them into RGB.
    I hope Apple deliveres a hotfix soon.

Maybe you are looking for