Set intensity of Color Object

Hello All,
I am wondering if there is a was of settin the intensity of a Color object. I have a list of decimal numbers ranging from 0-1 and need to set the color object to white (if number is 0) or black (if number is 1) and grey in between 0-1. However, the intensity or depth of the color grey is to be defined with the value of the decimal number i have.
Does anyone know a way in which i can do this??

I would like to know the same thing, but I'm not sure how to do it either, and I don't quite understand the replies to the original post. I want to set the color (and size, but I figure once I can do the color, I can figure out the other) of an object based on another variable's value (that value can go from 1-100). Say that I want it to go from really dark green to really light green (but never all the way to black or white). Isn't there some kind of 128 or 236 colorscale that I can pick a range from or something? How would i do this?
  public void updateVertexAppearance() {
       //update vertex appearance, changing the size and color based on power.
            this.setColor(java.awt.Color.Something);//some kind of scale here based on power (1<=power<=100).
            this.setHeight((int) Math.round((power + 2)/5));//min/max is 1/20
            this.setWidth((int) Math.round((power + 2)/5));//min/max is 1/20
  }

Similar Messages

  • Dynamically set iChart pen colors at page runtime when query data changes

    I have a page with an iChart (3D Bar Chart) where I am currently allowing the pen colors to set automaticlly inthe diplay template.  However, the SQL Query that supplies the data, will return a different number of rows depending on user selections.  The data is aggregated by type and could possibly return up to 7 rows, a row for each type.  As an example.....
    Query run #1 retuns rows for:
    Type 1
    Type 3
    Type 4
    Type 5
    Query Run #2 returns rows for:
    Type 1
    Type 2
    Type 3
    I would like to set the iChart pen colors so they would aloways be the same for each Type returned by the SQL Query....
    Type 1 - blue
    Type 2 - green
    Type 3 - red
    Type 4 - orange
    Type 5 - pink
    Type 6 - purple
    Type 7 - black
    I would like these colors to be used whether or not query returns data for a specific type or not.  Any help would be greatly appreciated

    OK.  Assuming you are returning the color value or the type value in the Query we can do this.
    First, in your Chart Template, link the value that will determine the color (either the "Color" column or the "Type" column from the query) to the Datalink Columns field on the Data Mapping tab of the Chart Template.
    Then using an applet event (update event) fire a javascript function.  This function will update the pen colors of your chart dynamically.
    Use document.myApplet.getChartObject().getDatalinkValue(PENNUMBER,POINTNUMBER,ATTRIBUTE) where PENNUMBER is the Pen or Row in your query, POINTNUMBER can probably be left at '1', and ATTRIBUTE is the numerical index of the datalink value (probably also 1).
    This will give you either your Color value or your Type value.
    From there set the PenColor of the Chart using document.myApplet.getChartObject().setPenColor(INDEX, NEWVALUE) where INDEX is the actually Pen Number (query row) and NEWVALUE is the new color.  Keep in mind the NEWVALUE is expecting a color object not an English color. 
    You can create a color from an English string by using document.myApplet.createColor("blue").
    Then, don't forget to update the Chart -
    document.myApplet.updateChart(false).  Don't do "true" or else you'll end up in an infinite loop.
    Try that out.

  • How do you set the font color for a specific entire row inside a JTable?

    How do you set the font color for a specific entire row inside a JTable?
    I want to change the font color for only a couple of rows inside a JTable.
    I've seen some ways to possibly do this with an individual cell.
    Clarification on changing the font color in an individual cell would be helpful too if
    there is no easy way to do this for a row.

    hai,
    Try out with this piece of code.Create your table and assign the renderer to each column in the table.
    CellColorRenderer m_CellColorRenderer = new CellColorRenderer();
    for(int i=0;i<your_JTable.getColumnCount();i++)
    your_JTable.getColumnModel().getColumn(i).setCellRenderer(m_CellColorRenderer);
    class CellColorRenderer extends JLabel implements TableCellRenderer
    CellColorRenderer()     
    setOpaque(true);     
    setHorizontalAlignment(LEFT);
    setVerticalAlignment(CENTER);
    setBackground(Color.white);
    setForeground(Color.black);
    protected void setValue(Object value)
         setText((value == null) ? "" : value.toString());
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected, boolean hasFocus, int row,int column)
         if(isSelected == true)
              setForeground(Color.red);
         else
              setForeground(Color.black);
         setValue(value);
         return this;
    regards,
    bala

  • Setting the series color of a bi beans graph based on the data values

    How do I conditionally set the series color of a bi beans graph based on the data values?
    I am using the following code to get the data values and set the series color:
    Graph gr=(Graph)CmdrDashboardP1_pres1.getView();
    DataAccess da=gr.getGraphModel().getDataAccess();
    DataDirector dd=gr.getDataDirector();
    DataMap dm=dd.getDataMap();
    int re=dd.ROW_EDGE;
    int ce=dd.COLUMN_EDGE;
    Object val=da.getValue(re,ce,dm.DATA_TYPE);
    int seriesCount=da.getEdgeCurrentSlice(DataDirector.ROW_EDGE);
    if (val <=45.0)
    gr.getSeries().setColor(new Color(255,0,0),seriesCount);
    I get a NullPointerException from the line of code "Object val=da.getValue(re,ce,dm.DATA_TYPE)." I have tried the code with DATA_UNFORMATTED as well, but get the same exception. When I print the DataMap value of dm the results are [dataUnformatted, dataViewFormat, value, dataIsTotal, dataType].
    Also, I get the error "method <= (java.lang.Object,double) not found in class _CmdrDashboardP1" from the "if (val <=45.0)" code.
    Thanks for any assistance

    How do I conditionally set the series color of a bi beans graph based on the data values?
    I am using the following code to get the data values and set the series color:
    Graph gr=(Graph)CmdrDashboardP1_pres1.getView();
    DataAccess da=gr.getGraphModel().getDataAccess();
    DataDirector dd=gr.getDataDirector();
    DataMap dm=dd.getDataMap();
    int re=dd.ROW_EDGE;
    int ce=dd.COLUMN_EDGE;
    Object val=da.getValue(re,ce,dm.DATA_TYPE);
    int seriesCount=da.getEdgeCurrentSlice(DataDirector.ROW_EDGE);
    if (val <=45.0)
    gr.getSeries().setColor(new Color(255,0,0),seriesCount);
    I get a NullPointerException from the line of code "Object val=da.getValue(re,ce,dm.DATA_TYPE)." I have tried the code with DATA_UNFORMATTED as well, but get the same exception. When I print the DataMap value of dm the results are [dataUnformatted, dataViewFormat, value, dataIsTotal, dataType].
    Also, I get the error "method <= (java.lang.Object,double) not found in class _CmdrDashboardP1" from the "if (val <=45.0)" code.
    Thanks for any assistance

  • How do I set the background color of a page_item?

    I've been pasting "background-color:#5CD65C" in a number of places, like "HTML Table Cell Attributes" under the Label and the Element tabs, but get no results. Can anyone tell me how to set the background color of a cell, please?

    Hi Doug,
    Dynamic Actions is an alternative also, especially if it is conditional.
    Action Set Style
    Fire When Event Result Is True
    Style Name background-color
    Value #5CD65C
    Selection Type DOM Object
    DOM Object your item name
    Set your Condition Type and you have it.
    Jeff
    Edited by: jwellsnh on May 24, 2011 3:55 PM

  • Can't see 'white' colored page number on colored object/paper

    I am using Pages '09 (v 4.3) and am having a devil of a time trying to get a 'white colored' page number to show up over a colored object that is streched over the sheet/paper to provide a color background. The problem seems limited to only when I want to use white, as any other color in the palette will show (assuming that there is enough contrast between the background color and selected page number color). I'm seeing this problem in a sheet where I want to use a black background with white text in the body (no issue there) and a white colored page number. Anyone else seen this? Or perhaps I have missed something simple?

    Peter -
    Is it there when you zoom in? No amount of zoom or lack thereof changes the situaiton.
    Is it there if you increase its point size? Nope.
    Is it there if you change the font? Nope.
    Have you tried using white from the Color Picker? Yes, no matter how white is selected the end result is the same.
    What is the Opacity of the text in the Graphic Inspector? Text does not have an opacity option/selection. Perhaps you are asking what the Opacity is of the solid color I am trying to set as the background, in which case it is 100%.

  • I set my black color to 75, 68, 67, 90 but it resets itself to 0, 0, 0, 100

    Everytime I set the fill/stroke color of objects in a file to 75, 68,67, 90 it resets it to 0, 0, 0, 100. It isn't consistent though... some objects accept the color. What could be going wrong?

    Yes, total ink depends on the paper.  Coated sheet could accept around 285 before pooling.  Depends on the press or digital printer, too.  If you set your Blacks, on screen and print to "accurate", then they will print at 100% Black or whatever percentage thereof.  I do not like the Appearance of Black settings in Adobe software.  To me, it should always be set to "Accurate", but my workflow is 98% print.  If I want a Rich Black, I just create a swatch of whatever combination that is appropriate and I don't have any problems.  So, it comes as a surprise you'd be having some problems.  My only guess was the Preference setting, but your Color Setting may have something to do with it, too.  If you solve it, I'd be interested in knowing what you did to solve it.

  • Is it possible to set a different color to part of a cell?

    Hi all,
    I am have trouble setting cell-specific Renderer.
    I have followed the instructions in the UISwing tutorial
    and extended JTable definition to overload getCellRenderer()
    to return myRenderer
    final JTable tableView = new JTable(dataModel){
    public TableCellRenderer getCellRenderer(int row, int column) {
    TableCellRenderer colorRenderer = new ColorRenderer();
    return(colorRenderer);
    My class definition for ColorRenderer is as follows:
    class ColorRenderer extends JLabel implements TableCellRenderer {
    public ColorRenderer() {
    public Component getTableCellRendererComponent(
    JTable table, Object color,
    boolean isSelected, boolean hasFocus,
    int row, int column) {
    setForeground(Color.blue);
    return this;
    Is it possible to set a different color to part of a cell?
    eg. I have "TEST,CELL,COLOR" as a string in a cell.
    Can I set a different color to the substring "CELL"?
    Your suggestions will be accepted most gratefully!
    Thanks in advance
    -Kalpana

    You should inherit your table cell renderer from a container, for example JPanel, add different JLabels to the panel and color them separately.
    Kurta

  • Setting transparent fill color

    b How can I set the transparent color to a form object from a JavaScript code?
    For example in this case:
    > xfa.resolveNode("this.border.fill.color").value = "255,255,0";
    This line set the object color to yellow. And transparent color? How I have to do?
    Thanks !!!
    Dan

    While XFA supports any color space, the
    usable color space depends on the target. Since your forms are rendering to PDF (or possibly HTML if you're using LiveCycle Forms), you're unfortunately limited to their support which is RGB only.
    In short, you can't set the transparency value of a color when targeting PDF.
    Stefan
    Adobe Systems

  • FormatType="number" sets different background color too

    Hi all!
    I have an af:table element and af:column inside that has formatType="number" to get the right-justified text. But beside right aligning the column values the column becomes gray. I don't like having text columns white and number columns gray in the same table. Is this a deliberate feature?
    I would like to set the background color to white, but background-color property for this column is not considered. If I set the background-color property for af_outputText inside this column I also don't get the desired look.
    Thanks!
    Take care!

    Hi Frank!
    I've created ADF read-only table for my view object. If I run the page immediately after this, all columns are white with gray headers which is OK. Then I change only the formatType property for one column:
    <af:column sortProperty="Mass"
                     sortable="false"
                     headerText="#{bindings.MyView.labels.Mass}"
                     formatType="number">
      <af:outputText value="#{row.Mass}">
      <f:convertNumber groupingUsed="false"
                                pattern="#{bindings.MyView.formats.Mass}"/>
      </af:outputText>
    </af:column>This makes the text in this column to be right aligned but also the column becomes gray.
    Hope to hear some more suggestions from you.
    Thanks, bye!

  • Writing own TableCellRenderer for setting the Background Color of a cell ?

    Hello,
    I am using the JTable and DefaultTableModel for my GUI. I use also only plain text in the rows and columns. I have a method which examine every row wether something is wrong with a string so if something is wrong i want to set the BackgroundColor of this cell with the bad string to a color i can define.
    Do I need to write an own TableCellRenderer for this tiny task?
    Table class has no setBackground(new Color(22,22,22),posRow,posCol);

    http://forum.java.sun.com/thread.jspa?forumID=57&threa
    dID=606504this code is from your ColorRenderer class:
    public void actionPerformed(ActionEvent e)
                   Iterator it = colors.keySet().iterator();
                   while ( it.hasNext() )
                        Point key = (Point)it.next();
                        int row = key.x;
                        int column = key.y;
                        if (column == -1)
                             model.fireTableRowsUpdated(row, row);
                        else if (row == -1)
                             int rows = table.getRowCount();
                             for (int i = 0; i < rows; i++)
                                  model.fireTableCellUpdated(i, column);                              
              }you have set an ActionListener to the ColorRenderer class and put the actionPerformed method in it but compared to a JButton the actionPerformed method is called when i click the JButton but what you do in your code that the actionPerformed method is executed. I have deleted the whole actionPerformed method and the listener and still the cell is displayed with a color so was it for the blinking?
    And the method setBackground is nowhere called or run actively so is this method called internally by the ColorRenderer class? or is this method somehow called recursively as in the method setBackground I can see this method call:
    c.setBackground( (Color)o ); but i think this is another setBackground method right? because the first method i mentioned has 3 parameters not 1 parameter so where is the method setBackground with 3 parameters called actively in your code? i cant find anything. ok after examining again the c.setBackground( (Color)o ); is the one with 3 parameters ;-)
    public void setBackground(Component c, int row, int column)
              { that was set for the previous cell, so reset it here
                   if (c instanceof DefaultTableCellRenderer)
                        c.setBackground( table.getBackground() );
                   //  In case columns have been reordered, convert the column number
                   column = table.convertColumnIndexToModel(column);
                   //  Get cell color
                   Object key = getKey(row, column);
                   Object o = colors.get( key );
                   if (o != null)
                        c.setBackground( (Color)o );
                        return;
                   //  Get row color
                   key = getKey(row, -1);
                   o = colors.get( key );
                   if (o != null)
                        c.setBackground( (Color)o );
                        return;
                   //  Get column color
                   key = getKey(-1, column);
                   o = colors.get( key );
                   if (o != null)
                        c.setBackground( (Color)o );
                        return;
              }using your full code gives me a bug:
    when i double click in the first column to change some text doesnt matter which row then the selected cell gets a red border and the rest of the table freezes. When i exchange the order of the columns move column 1 to 2 and column 2 to 1 then the freezed table is working again?? could you help solving that problem else the cell color setting works fine for me :-) thank you very much!

  • Automatically set the stroke color as fill color

    Hello all,
    I have a file with two squares with red and blue fill colors respectively and transparent surrounding strokes. I'm trying to find a way to automatically set the stroke color of each square to the respective fill color.
    Is there an Illustrator script somewhere that would achieve that? I am not aware of an internal Illustrator command for this purpose.
    Thank you

    I'm not a scripting guy at all, but getting an object's fill color and applying it elsewhere sounds like it should be scriptable. You should post the question in the AI Scripting Forum.
    The hitch I see here is your assertion that your objects have "transparent surrounding strokes." I could be wrong, but I believe there is actually no such thing in Illustrator. Through some simple experimenting, I conclude that an object's stroke set to "no color" by choosing the blank swatch actually becomes a stroke of undetermined, or perhaps zero, weight.
    Take an object with a stroke color and weight and set its stroke to no color. The weight goes away as well. One can't exist without the other, and vice-versa, with repect to stroke weight and color. Now enter a weight for that colorless stroke, and it again receives color; defaulting to black regardless of what it may have been previously.
    Similarly, if you assign a color where there is no weight, a 1-point weight appears by default.
    I'm not sure how/if that plays into your plans, but I just thought I'd ramble on about it here in case it's something you hadn't considered.

  • HELP!! set the cell color in jTable

    I need to set the color of a specific cell in jTable, but, I need to retain the old color in the jTable. It must not reset the whole table.
    would anyone help me in this problem... PLSSSSS its urgent

    A flexible variation on this is to specify formatting options in the JTable's client properties:
    // Use some sort of special "key" to indicate the cell and that you want to set the background color
    String key = "background:" + row + "," + column;
    table.putClientProperty(key, Color.green);You can then write a general table cell renderer that looks for these special formatting options and it doesn't disrupt your existing TableModel in any way:
    public class FormattingTableCellRenderer extends DefaultTableCellRenderer
      public Component getTableCellRendererComponent(JTable table, Object value, int row, int column, ...)
        Component component = super.getTableCellRendererComponent(table, value, row, column, ...);
        // See if the JTable specifies any properties to override the default format
        Color backgroundColor = (Color)table.getClientProperty("background:" + row + "," + column);
        if(backgroundColor != null)
          component.setBackground(backgroundColor);
        return component;
    }Any custom cell renderers you have then simply need to extend FormatTableCellRenderer instead of DefaultTableCellRenderer.
    It's very easy to add formatting options other than background, such as font, to the list of recognised attributes. You'll probably need to make some alterations to get it to recognise selection/focus but hopefully you get the idea.
    Hope this helps.

  • How do i set a multiple colors for a panel

    hi all,
    how do i set a multiple colors for a panel .pl desperately need a solution.
    regards
    bhaskar

    Iam contradicting self !
    Hope this helps !
    java.lang.Object
    |
    --java.awt.Component
    has the paint method ! Take the Graphics Object and call Graphics.setColor( Color.red ) .. and u can draw regular shapes like fillRoundRect. blah blah.. u need t count on the pixels .. I guess..
    An easier choice could be adding labels or panels with a layout of ur choice ..
    venu

  • Using a Variable in SSIS - Error - "Command text was not set for the command object.".

    Hi All,
    I am using a OLE DB Source in my dataflow component and want to select SQL Query from the master table  I have created variables v_Archivequery
    String packageLevel (to store the query).
    <Variable Name="V_Archivequery" DataType="String">
         SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
         FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
         ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
         Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)
        </Variable>
    I am assigning this query to the v_Archivequery variable, "SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
    FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
     ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
    Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)"
    Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, v_Archivequery .
    But when I am generating the package and when running I am getting bewlo errror
     Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E0C  Description: "Command text was not set for the command object.".
    Can Someone guide me whr am going wrong?
    Please let me know where am going wrong?
    Thanks in advance.
    Thankx & regards, Vipin jha MCP

    What happens if you hit Preview button in OLE DB Source Editor? Also you can use the same query by selecting SQL Command option and test.
    Could you try set the Delay Validation = True at Package and re-run ?
    If set the query in variable expression (not in value), then Set Evaluate As Expression = True.
    -Vaibhav Chaudhari

Maybe you are looking for

  • Using An ASD LCD display with a new Mac Mini

    I want to utilize a 17" Apple Studio Display with my new Mac Mini. Does HDMI support the 35-pin Apple Display Connector (ADC)? It would require an adapter with female 35-pin on one side and a male HDMI (DVI) on the other. The Apple DVI to ADC adapter

  • Cancelled promotional code, ridiculous hassle

    On December 11th I got a $25 promotional code for a cancelled order. I felt that was a really generous offer and when an item I had been looking at went on sale, I decided to use it.On 12/21 I price matched the item through a rep by phone and asked i

  • Does track end jump trump chapter or story end jump?

    I have a DVD with 1 menu & 3 tracks. Tracks 1 & 2 each contain l short video (different audio or video formats) and track 3 contains 3 short videos which I have broken into 1 story w/3 chapters. On track 1, there is 1 chapter marker and I have set it

  • Change archive from time 'sysdate-8' crosscheck;

    change archive from time 'sysdate-8' crosscheck; What does this statement do

  • Potential bug in CS4 on Windows 7 Ultimate X64

    Hi there, I'm running Windows 7 Ultimate (64-Bit) and noticed that when I am creating a new site, the directory specified for the Website root and the Images root is shortened by one folder-level. For example, if the website path and image path I sel