JTable - Setting multiple columns with different color

Building excel type functionality in Java.
I have a database table like this
id PK
min_x
max_x
min_y
max_y
color
1. I need to create a JTable having 50 colums and 50 rows.
2. I need to select mouse selection color.
3. On mouse selection I have to change the Background-color or foreground-color of JTable cells and on click of save button I need to get the data in following manner column start of particular color as min_x, column end of particular color as max_x, row start of particular color as min_y, row end of particular color as max_y, and bg or foreground color.
can some one tell me is there a way to do this. Or any other way to implement this functionality.

Crossposted:
http://forum.java.sun.com/thread.jsp?thread=541598&forum=422&message=2625937
http://forum.java.sun.com/thread.jsp?thread=541597&forum=57&message=2625933
http://forum.java.sun.com/thread.jsp?thread=541595&forum=31&message=2625929
http://forum.java.sun.com/thread.jsp?thread=541594&forum=54&message=2625922

Similar Messages

  • Subquery multiple columns with Different operand

    Hi ,
    i have 2 tables as below ,
    table 1 ,
    date            number    value
    20-10-13      1234       500
    21-10-13      1235       800
    19-10-13     1234       600
    19-10-13     1234       700
    20-10-13      1235       500
    10-10-11      1235       600
    20-10-13      1236       500
    19-10-12      1236       700
    table 2 ,
    date            number
    20-10-13      1234
    20-10-13      1236
    how to get the values from the table one when only the number=number in table 2 and start date >= date in table 2 ,
    result should be ,
    date            number    value
    20-10-13      1234       500
    21-10-13      1235       800
    20-10-13      1235       500
    20-10-13      1236       500

    where table1.number=table2.number
       and table1.date >= table2.date
    You might want to read up:
    http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_10002.htm#sthref6662

  • I have a question about the calendar on the ipad2. I have multiple calendars in different colors. Some of the events are filled in with color. Others are just listed with a colored dot in front of the event. Any ideas why events ar showing up differently?

    I have an ipad2 and my question is about the calendar. I set up multiple calendars with different colors. Some of the events show up in filled color. Others only show with a colored dot in front of the event. I can't figure out why some show up one way and others show up differently? Any thoughts?

    On mine the ones that show on a coloured background are all-day events, the ones with dots and just timed events.

  • Display of text of different rows with different color - JTable

    Hi all !
    I have struck in a problem. I have to display the different rows with different color in the JTable. I have created an arraylist in the model class, which stores color of all the rows. Now in renderer class, I am just picking up color from the arraylist, taking rowIndex as index for arraylist. I used to set foreground color for each row in the renderer class. The problem is that it is not showing all the rows properly, sometimes it show all the rows correctly, but as i resize the window/panel, it starts behaving abnormally, some text is painted properly, but other aren't.
    Does anybody have any solution regarding this problem.
    One thing i want to mention is that in getTableCellRendererComponent() method, i used to retrive the color everytime, and setting the foreground color of the text. Is this a right approach or some other technique have to be followed.
    here is code of renderer class ---
    import java.awt.*;
    import javax.swing.*;
    * Renderer to plot stage record table.
    public class ExStageCellRenderer extends javax.swing.table.DefaultTableCellRenderer
        Color curColor;
         * returns component to be painted, overridding this method from
         * DefaultCellRenderer
         * @param table
         *            table whose component has to be plotted
         * @param value
         *            value of that particular cell
         * @param isSelected
         *            is Cell selected
         * @param hasFocus
         *            has the cell got focus
         * @param row
         *            row of the cell
         * @param column
         *            column of the cell
         * @return painted component
        public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
                int column)
            Component component = super.getTableCellRendererComponent (table, value, isSelected, hasFocus, row, column);
            ExStageDataModel model = (ExStageDataModel)table.getModel ();       
            if (curColor instanceof Color) {
                    curColor = model.getColor(row);
                } else {
                    // If color unknown, use table's foreground color
                    curColor = table.getForeground();
            String tooltip = "";
            StringBuffer stringBuffer = new StringBuffer ();
            for (int i = 0; i < table.getColumnCount (); i++)
                    Object Value = table.getValueAt (row, i);
                    if (Value == null) continue;
                    stringBuffer.append (Value.toString () + "    ");
            tooltip += stringBuffer.toString ();
            tooltip = tooltip.trim ();
            ((JComponent) component).setToolTipText (tooltip);
            if (column == 1)
                this.setHorizontalAlignment (SwingConstants.CENTER);
            else if (column == 0 || column == 4 || column == 5)
                this.setHorizontalAlignment (SwingConstants.LEFT);
            else
                this.setHorizontalAlignment (SwingConstants.RIGHT);
            // LOOK!! should turn tip off if there is none !!
            component.setForeground (this.curColor);
            //System.out.println("render : " + component.getBounds ());
            //component.validate ();
            component.update (component.getGraphics ());
            return component;
    Waiting for reply....
    Code snooker

    Hmm, why are you doing the curColor instanceof? What does this accomplish? I don't see any reason to ask what it was before; all you should be interested in here is what you want it to be now.
    All you should have to do is say:
    this.setForeground(model.getColor(row));I also don't see why you're doing the update() -- JTable is going to do that for you at the appropriate time, you have no idea if now is the right time to do it or not. In fact it probably isn't, you're probably updating the previously-drawn cell with your new color and alignment, which may be the strange behavior you're seeing.
    Also, I don't see why you're doing the super. All that's going to do is return "this", so why not just use "this"?
    Well, without knowing your larger code or exactly what you're trying to accomplish, maybe I'm just missing something.
    I've just recently been working on a program where I had some similar requirements -- different foreground and background colors and alignment -- and I found it much cleaner to create a class to hold all this data, and then create a default renderer for that class. Then I made some constructors for this "attribute" class that let me set whatever I need, like
    public CellAttrib(String s,Color c,int alignment,Border border)
      this.s=s;
      this.c=c;
      this.border=border;
    // with suitable defaults ...
    pubic CellAtrtrib(String s)
      this.s=s;
      this.c=Color.BLACK;
      this.border=null;
    }Then the renderer just queried the cell-attributes class, as in:
    setForeground(value.getColor());
    setHorizontalAlignment(value.getAlignment());
    setBorder(value.getBorder);

  • BO xi 3.1 u2013 schedule a template for multiple reports with different column

    Hi,
    I need to migrate the existing reports from SQL Server Reporting Services to BO, and the column order in the report is very important to the clients since clients have existing code to ingest these reports into their database. Now I want to schedule a single template with different parameters for all reports in BO, or create a single template with lot of parameters for all reports. My question is how I might use one template to create multiple reports with different column orders in the reports?
    For example, client A has the following column order in their report: firstName, LastName, DateBirth, SSN. Client B has the following column order in their report: SSN, DateBirth, LastName, FirstName. Can I use one template to create these multiple reports?
    Thanks!

    Hi,
    The only approach I can think of is to create a template report which uses variables
    For each column you would need to variable
    v_columnAName and v_columnAValue
    v_columnAName would have a if statement in it
    =if([client]="clientA" or [client]="clientC";NameOf([firstName]);if([client]="clientB";NameOf([SSN]);NameOf([lastName]));
    v_columnA would have a if statement in it
    =if([client]="clientA" or [client]="clientC";[firstName];if([client]="clientB";[SSN],[lastName]));
    This would only work when you had a small set of clients.
    This might be more managable if it was done in the universe
    Regards
    Alan

  • On a chart, can we set portions of a chart with different colors

    My application involves with fuel cell conditioning during which the V-I curve with go many cycles. I want to distinguish these cycles with different colors but don't know whether it's doable because I think if we set a color, it will set the whole line with the same color. Or if we can stop the line after one cycle and start the second cycle as a new line, then it will be a new color. Anyone can give some suggestion about how it can work? Thanks in advance.
    Guangde

    By bundling multiple points together you can get different plots on a waveform graph.  And +Inf plots nothing.  I attached an example that plots a random number.  When the boolean button is switched, it switches to the other plot line, thus another color.  This was only done for 2 different colors, but the case structure and the cluster could be expanded for more than 2 colors.
    Message Edited by Ravens Fan on 08-24-2007 10:43 PM
    Attachments:
    Untitled 1.vi ‏14 KB
    Example_BD.png ‏12 KB

  • Not able to color different rows with different colors in a column of table

    Hi,
    I am trying to to display different rows with different colors in a column of the table based on some decode condition.
    I have gone through the following threads :
    Can we colour the rows in the column of a table
    Changing Color of a value in a column
    This is what i have done :
    1.Added the following code to custom.xss(changed the name to Custom.xss as suggested in one of the above threads) --- in path ---- jdev\myhtml\OA_HTML\cabo\styles
    <style selector=".1">
    <includeStyle name="DefaultFontFamily"/>
    <property name="font-size">11pt</property>
    <property name="font-weight">Bolder</property>
    <property name="color">#008000</property>
    <property name="text-indent">3px</property>
    </style>
    <style selector=".2">
    <includeStyle name="DefaultFontFamily"/>
    <property name="font-size">11pt</property>
    <property name="font-weight">Bolder</property>
    <property name="color">#FFFF00</property>
    <property name="text-indent">3px</property>
    </style>
    2. Sql query of the VO is :
    select comments,role ,decode(role,'REQUESTER','1','2') Colorattr from xxat_sars_action_history where request_id = :1 and event_name = :2 and action_code <> 'PENDING'
    order by sequence_num desc
    3. Coded the following in the process request of the controller:
    OATableBean table = (OATableBean)webBean.findIndexedChildRecursive("CommentsTB");
    OAMessageStyledTextBean roleBN = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("role");
    OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(roleBN,"Colorattr");
    roleBN.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);
    where 1 and 2 form the colors ( i have even tried with 'Red' and 'Yellow'...as it was not working replaced with 1 and 2)
    4.The query returns data fine with corresponding 1 and 2 values.
    But different colors are not getting reflecting on to the UI.
    I am testing this on my local jdev.
    Please do let me know if i am missing something.
    Thanks ,
    Sushma.

    Any Clues please.....
    Thanks,
    Sushma.

  • Design a single template for multiple reports with different column order

    Hi,
    I need to migrate the existing reports from SQL Server Reporting Services to Crystal Report 2008, and the column order in the report is very important to the clients since clients have existing code to ingest these reports into their database. Now I want to create a single template with lot of parameters for all reports. My question is how I might use one template to create multiple reports with different column orders in the reports?
    For example, client A has the following column order in their report: firstName, LastName, DateBirth, SSN. Client B has the following column order in their report: SSN, DateBirth, LastName, FirstName. Can I use one template to create these multiple reports?
    Thanks in advance.

    -As I mentioned you can find Template Field object in Insert menu of crystal report Designer 2008.
    As soon as you select Template Field object you will be able to see a box beside ur mouse cursor. Drag and drop this box at required place. Now when you place this object in report you will get some thing like this "<TemplateField1>" listed under Formula Fields tree. Double click "<TemplateField1>" formula to add your conditions.
    -I have not tested it for large amount of Customers. However as the number of customer increases the number of conditions will get increased.
    For the customer that want the same ordering of columns you can put those customers under one condition.
        for Example...
              if(?Client in ['clientA','clientA']) then
                        <TableName>.<Field>......
    -What do you mean be 40 columns? Do you mean 40 fields or you want to show 40 columns in report? Please elaborate.
    Regards,
    Amrita
    Edited by: Amrita Singh on May 21, 2009 7:54 AM

  • How to color single column cells with different colors in classic report based different conditions

    Hi ,
      Am working on Oracle Apex 4.2 version. Am trying to generate a  classic report with different cell colors based on the conditions.
      I tried the solution provided in the below link.
      https://forums.oracle.com/message/9518723#9518723.
      I tried the same query given in that link.
       SELECT e.*,
      CASE
        WHEN sal < 1000
        THEN 'red'
        WHEN sal BETWEEN 1000 AND 2000
        THEN 'yellow'
        WHEN sal > 2000
        THEN 'green'
      END the_color
    FROM emp e
      And, I hidded the column 'the_color' in Report Attributes,
              the Column Template1 has the code , <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#">#COLUMN_VALUE#</td>.
    After this, what are the steps did I miss here. Because am not getting the report which I need.
    Kindly do provide solution.
    Thanks,
    yashu.

    SAL column values should visible with different color based on the conditions. Same way i did in my report it was working for me. Please refer the below links for more information,
    https://forums.oracle.com/thread/1047891
    http://dbswh.webhop.net/htmldb/f?p=BLOG:READ:0::::ARTICLE:351800346145832
    Thanks
    Lakshmi

  • How can I edit multiple clips with different frame rates on the same timeline

    how can I edit multiple clips with different frame rates on the same timeline

    You do not want to edit material from different frame rates on one timeline. You CAN do this, but it is a very bad idea - and this is why.
    Once you establish the sequence frame rate - lets say it is PAL material at 25fps, any material that you drop into the sequence other than 25 fps will have to be changed to play at 25 fps. If the material you add is NTSC (29.97), FCP will DROP 5 frames per sec to bring the frame rate down to 25 fps. Which 5 get thrown away? Every 6th one. This yields a funky cadence that becomes even more complex as as there are also interlaced fields (DV/NTSC is an interlaced format). Oh, and by the way, the image sizes are different as well. DV/PAL has 576 lines of resolution and DV/NTSC has 480. FCP has to scale up the NTSC to fit the PAL frame.
    You do not want FCP adjusting these things on the fly. You want to do a thoughtful (and time consuming) conversion so that you end up with all your material in one format with the best possible image from the conversion process. Compressor can do an adequate job with Frame Controls turned on. The Natress Standards Conversion FCP plugin is another way to go. A third option is to find a post house that can do the conversion for you using a hardware based process.
    The good news is, once everything is in the same format, editing it will be painless and the output process very quick.
    Whatever frame rate/ image size you select, I'd suggest using ProRes for the codec. It is 4:2:2 color and will withstand color correction and composting with much more grace than any variant of DV based codecs.
    Have fun.
    x

  • How to use a USER_DATASTORE to index multiple columns in different tables

    I would appreciate if somebody can give an example or point to links with examples on how to use USER_DATASTORE on multiple columns in different tables. THe Oracle Text documentation only shows multiple columns in the same table.
    Thanks in advance.

    I am not sure why your getting the wrong results but you should seriously reconsider the approach your are taking. Using functions like this is very ineffecient and should be avoided at all cost.

  • XY Graph overlay multi plot with different colors

    Hi,
    I want to do a cyclic X-Y plot in a for loop and plot the graph for each cycle in different colors.
    I want a plot like XYgraph2 but with different colors and probably even without that tracing line. How do i modify my diagram?
    Thank you for your time and efforts.
    SUCHIT
    Suchit Shah
    Graduate Student
    Electrical & Computer Engineering,
    Northeastern University,
    BOSTON
    MA 02115
    Certified LabVIEW Associate Developer
    Solved!
    Go to Solution.
    Attachments:
    block dia.JPG ‏45 KB
    front dia.JPG ‏122 KB

    Hi all! This is my first post
    My name is Francesco and I'm programming a keithley for measure some FET
    using labview 8.6. I plot my output data on a XY graph but I have several curves,
    one for each value of Vgs. Looking in your forum I've found the code
    MultiplePlots.vi (21 kb) posted by Darin.K about a month ago that use Multiple
    plots and it is perfect for my goal because with this I can plot every curve with a
    different color. The only problem is that I like to plot my data in real time.
    The code, however, use a Loop with N=50, accumulates the values on the edge
    and plot at the end of the Loop the entire line.
    My question is if someone can explain me how to modify the code to plot the line
    point by point, so in real time and not at the end o the loop because I need to see
    the current values during the measurement and not only at the end.
    I think that I need to move the XYgraph inside the loop. I try but without lucky.
    Can anyone help me?
    thanks and sorry for my very bad english.
         Francesco

  • IPad 2 Built-in Calendar App - Adding new calanders with different colors

    I have an iPad 2, i've read the user guide and still can not figure out how to add a new calendar in the 'built-in app'. I want to separate my events with different colors it is shown like that in the user guide, but it doesn't explain how to do it.

    Do you have a Google, Exchange or MobileMe email account? If you have one of those accounts, I think you can add them in the Mail settings.
    I Googled this and you can look through it and see what you can find.
    http://www.google.com/search?q=add+calendars+to+iPad&ie=utf-8&oe=utf-8&aq=t&rls= org.mozilla:en-US:official&client=firefox-a
    Other than my Exchange calendar, all of my other calendars were set up on my Mac with iCal. I copied this from this support article ...
    http://support.apple.com/kb/ht1296
    Calendars
    To sync calendars with your computer, choose "Sync Calendars" or "Sync iCal Calendars."
    You can sync calendars with:
    Microsoft Outlook 2003, Microsoft Outlook 2007, Microsoft 2010 (Windows XP, Windows Vista, or Windows 7)
    iCal (Mac OS X)
    Microsoft Entourage 2004, Microsoft Entourage 2008
        Note:  If using Microsoft Entourage, use Microsoft Entourage 2008 12.1.2 or later if syncing with Mac OS X v10.6 or later. If you would like to sync data on your Mac with Entourage, enable syncing between Entourage and Address Book.
    Microsoft Outlook 2011 for Mac
        Note: If using Microsoft Outlook 2011 for Mac to sync calendars you must update to Microsoft Office 2011 for Mac Service Pack 1 or later.
    Notes:
    When syncing calendars, you can sync all calendars or sync specific calendars.
    You can limit the data that is synced to only events that have occurred in the last 30 days.   The option can be changed to any number of days.

  • Unable to use two af:tables with differing coloring (skins)?

    Im trying to configure the Siebel Self-Services application and customize the skinning. I have some problems though, because i need to show two af:tables on the same page, but with different coloring. One with black background and white text (both header and body) and one with white background and black text. I have tried to use styleClass:es, but the css parameters set for the af table are overriding the ones set in the stylesheets.
    Anyone having an idea how to overcome this?
    Thanks
    /Jon-Erik

    Hi,
    if the styleClass name is table1 then the skin selector would be something like
    .table1 af|table
    or .afTable.af|table
    I don't see how this can be overriden. If you assumption is that the style class reference must be to a CSS definition on the page then this indeed does not work. The styleClass name is kind of a named identifier for the component to skin and is used to further qualify the component to skin
    Frank

  • IPad 1 display with different color line

    My iPad display shows with different colors here &amp; there. Is that defect? Some web page is ok. But most of time you can see that.

    Mountpa-
    Your iPad may be defective, but is probably out of warranty.  An Apple Store may exchange it for a flat rate.  Look for an iPad repair center for a less expensive repair. You can find an Apple Authorized Repair Center at <Apple Authorized Repair Centers>, but non-Apple repair centers may be less expensive still.
    First check to see if your color happens to be part of your iPad's wallpaper.  Go to Settings-Brightness & Wallpaper to see how it is currently set.
    One thing you can try is to reset (reboot) your iPad.  Hold both the Home and Sleep buttons for several seconds until the Apple logo appears.  Ignore the "Slide to power off" arrow.  The iPad will restart after a couple of minutes.  Resetting this way will not hurt anything, and sometimes clears up mysterious problems.
    Fred

Maybe you are looking for

  • How to get 2nd line in smartforms using template

    how to get 2nd line in smartforms main window using template. i have also defined loop .

  • BP Catalogue No is not copied from draft to actual document

    Hi, I wanted to display both BP Catalogue No and Item code on the PO and I found SAP Note 1059015 explaining how to do this: creating UDF, writing the query, FMS, etc. Some POs are added for non-stock items and the same item code is used for more tha

  • Sync RFC scenario

    Hi, I need a synchronous RFC scenario. My requirement si jsut to run a UDF in mapping and give teh response back to RFC. What can be the best reciever side which gives the response back to RFC. Remrmber, I just need to call a mapping. File is not pos

  • Hey, Adobe? A simple, heartfelt request from an accessibility driven designer

    First - I adore Captivate, anyone wishing to troll the product please start your own thread. Now - my  heartfelt request - which has already been sent a a feature request. (I ask those who also work in accessibility environments to add this request f

  • Does SAP or Oracle have an issue with these type of processors?

    Does SAP or Oracle have an issue with these type of processors? Intel Xeon X5260 & E5450    vs    Intel Itanium       PROCESSORS I want a Sales / Marketing URL link or white papers that talks about processor recommendations. SAP GUI  7.20