Creating Multi-Column API radiogroup based on LOV

Hi everyone!
I was wondering whether or not it is possible to create a 3 column radiogroup based on the APEX_ITEM.RADIOGROUP API in APEX 3.0?
For instance, my radiogroup is based on a user's interest level and is supposed to look like: oTest oProduction oBoth
The values returned by whichever button is selected is based on a table value.
I'm having trouble making this multi column instead of 1 column with multiple rows. I need to set these up with an LOV similar to STATIC2:Test;TEST,Production;PROD,Both;BOTH
I also cannot create this radio group as a page item because they must display based on a query issued by a report region on this page.
Any ideas // suggestions?
Thanks,
Eric
Edited by: user11685190 on Oct 12, 2009 9:50 AM

Andy,
I'm actually going to have a radiogroup within the report column itself. The suggestion you gave is actually why I'm mixed up as to how to do this....I've always used Apex page items to create my radiogroups, and then you can simply add the LOV and change the number of columns and it's all set up for you.
This radio group is actually going to be within a row queried by the report. The report is essentially a 'checkbox selection screen' that also allows the user to select which interest level they hold for each selection (interest level is represented by this 3-option radio group). Therefore what you're going to see on the screen is ( [] represent checkboxes, o represent radio buttons):
Banner INB
[]Planned Outage Notification oTest oProduction oBoth
[]Unplanned Outage Notification oTest oProduction oBoth
Banner Self Service
[]Planned Outage Notification oTest oProduction oBoth
[]Unplanned Outage Notification oTest oProduction oBoth
My question was mainly geared towards whether or not you can add a static LOV to an API radiogroup (apex_item.radiogroup(1,interest_lvl,blah)), so that it could look like:
apex_item.radiogroup(1,1:2:3, NULL, 'Test':'Production':'Both') as result.
The only documentation I can find deals with issuing a single return value to these API radiogroups. I actually need a three column API radiogroup that hold's three different values based on which group member the user selects. If you can only issue one return value per group, I would have to define three under the same global variable except changing the return value and displayed text for each...such as:
apex_item.radiogroup(1,1,NULL,'Test') || apex_item.radiogroup(1,2,NULL,'Production') || apex_item.radiogroup(1,3,NULL,'Both) which will hopefully display as: oTest oProduction oBoth
I'm going to have to concatenate some &nbsps in between so my radio group buttons and labels are actually seperated, but this may be the right idea.
I'm going to toy around with this a little more today, I'll post my results.
Thanks for your quick responses!
Eric

Similar Messages

  • Repeat to create multi-column table

    I'm trying to use a spry:repeat directive to create a
    two-column table. What I would like to have generated as a result
    of the repeat is something like the following:
    <table>
    <tr>
    <td>row[0] data</td>
    <td>row[1] data</td>
    <tr>
    <tr>
    <td>row[2] data</td>
    <td>row[3] data</td>
    <tr>
    </table>
    Using the spry:test directive it's easy to get only the even
    rows in the first TD element, but I can't figure out how to
    reference the data element for the second TD in each table row.
    Here's what my HTML looks like:
    <div id="thumbContainer" spry:region="dsPhotos">
    <table border="0" cellpadding="0" cellspacing="0">
    <tr align="center" valign="middle" spry:repeat="dsPhotos"
    spry:test="loadThumb({ds_RowNumber}, {ds_RowCount})">
    <td width="85" height="85"><img
    src="thumbnails/{filename}" /></td>
    <td width="85" height="85"><img
    src="thumbnails/{filename}" /></td>
    </tr>
    </table>
    </div>
    The loadThumb function returns true for every other row. That
    works correctly and I see the even-numbered items in the two
    columns of each row. I've tried replacing the contents of the
    second img src attribute with every imaginable combination of
    dsPhotos.getData() and I can't find the magic combo that gets me
    the filename of the *next* row. I did try different usages of the
    ds_RowNumberPlus1 data reference but wasn't able to get that to
    work either. I verified that if I create two separate tables and
    use floating div's to get them to appear side-by-side and use
    separate spry:test functions to get the even and odd rows, I can
    iterate the data set twice and get the right contents in each
    table, but I would like to be able to solve this with a single
    table and a single iteration of the data set. Can anyone shed some
    light on how I should reference the n+1th row in my HTML table
    definition above?
    Thanks,
    Steve

    XE provides the browser-based interface for 'convenience'. You could always switch to SQLPlus or use the SQL Window and enter it manually. You could do this after the table has been created by using a documented syntax such as this sample
    ALTER TABLE sales
    ADD CONSTRAINT sales_pk PRIMARY KEY (prod_id, cust_id) DISABLE;
    found at http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses002.htm#i1002629
    The referenced doc also shows how to create the constraint at the same time as the table.

  • Urgent - Report Column based on LOV - Value not found in LOV

    Hi All,
    Recently, we have upgraded to HTMLDB 2.0 from HTMLDB 1.5.
    I have a SQL report. One of the columns is based upon LOV - Display as Text (Based on LOV, does not save state).
    For the "Ids" of the report, it should display the corresponding "Names" from the LOV.
    But, for the cases, where no record exist in LOV for some Id, then it is directly showing the Id instead of "-" (which i have specified in Display Null Text) in the report column attributes.
    Before upgrade, it was working fine.
    Any idea where is the issue.
    Please help.
    Thanks in advance,
    Monika

    Hi,
    Can anybody help me in sorting out this issue please.
    For your reference, i have made a test case on
    http://apex.oracle.com/pls/otn/f?p=20451:4:3519837362944582:::::
    Here, there are 2 tables
    1. MY_EMP_COUNTRY(emoid, empname, cntry_id)
    2. MY_COUNTRY_LOOKUP(id, name,active)
    LOV is created on table 2
    select name d, id r
    from my_country_lookup
    where active = 'Y'
    And, on the page a SQL report is created
    select empname, cntry_id
    from my_emp_country
    where, cntry_id is based upon the LOV.
    Since, in lookup table, cntry_id = 4 is set inactive, it is not picked up by the LOV and hence on the report instead of showing the NULL text it is showing the cntry_id (4).
    The attributes of report column cntry id -
    Named LOV = CNTRY_LOV
    Display Null = YES
    NULL text = -
    Display Extra Value = YES
    Am I missing anything.
    thanks,
    Monika

  • How to filter the Rest Api data based on Taxanomy columns

    Hi Everyone,
    We are using SharePoint2010 Standard Edition.
    I wanted get the library details through REST Api. I am using as below:
    https://SiteUrl/_vti_bin/listdata.svc/Documents?$filter=Title eq 'SharePointDoc'
    Here I am able to get the info regarding "SharePointDoc". But when I am trying to get the details from Taxonomy filter, it didn't.
    Can anyone please tell me how can we filter based on Taxanomy fields.
    Thanks in Advance
    Krishnasandeep

    Hi,
    I understand that you wanted to filter the Rest Api data based on Taxanomy columns.
    Per my knowledge, in SharePoint 2010 , not all types of column are available via REST, most annoyingly managed metadata columns are amongst this group of unsupported column types.
    However, in SharePoint 2013, we can filter list items based on taxonomy (managed metadata) columns.
    Taxonomy fields can be now called via REST API using CAML query in REST calls.
    Here is a great blog for your reference:
    http://www.cleverworkarounds.com/2013/09/23/how-to-filter-on-a-managed-metadata-column-via-rest-in-sharepoint-2013/comment-page-1/
    You’d better to change the REST calls and the CAML query to check whether it works in SharePoint 2010.
    More information:
    http://platinumdogs.me/2013/03/14/sharepoint-adventures-with-the-rest-api-part-1/
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Column based on LOV in a classic report

    In a classic report i want to display a value coming from an lov, based on the value of a column. I can't seem to make this work however, not even on apex.oracle.com. I too am on apex 4.1.
    What i've tried is to set the column to display as text, based on lov. I've tried named static and dynamic lovs, and tried to supply an own lov definition, both static and dynamic. Even apex_item doesn't seem to work.
    As a test, i has set this up on apex.oracle.com:
    Classic report:
    Region source:
    select status, descr, apex_item.text_from_lov(status, 'lov_status') status2
    from
    select 15 status, 'test for status 1' descr from dual
    union all
    select 30 status, 'test for status 2' descr from dual
    union all
    select 45 status, 'test for status 3' descr from dual
    Column attributes for column status:
    Display As: Display as Text (based on LOV, does not save state)
    List of Values -> Named LOV: LOV_STATUS
    LOV_STATUS (shared components -> lists of values):
    this is a static lov, with these values:
    15;'Status One'
    30;'Status Two'
    45;'Status Three'
    60;'Status Four'
    (which could also be used as a non-named lov like: STATIC2:15;'Status One',30;'Status Two',45;'Status Three',60;'Status Four')
    Both column status as status2 simply keep displaying their value, and not the 'display value' i'd expect coming from the lov.
    I could use decode or case, yes. But using an lov keeps it cleaner, especially when there are more than 3 or 4 values, and could be reused in more reports.
    Am i using or doing this wrong?

    Hi Tom,
    revert the order of your LOV items ( so first description and then ID ),
    like for example :
    STATIC2:'Status One';15,'Status Two';30,'Status Three';45,'Status Four';60
    That does the trick ( tried it ).
    If you want to see an example check page 2 of the only app on apex.oracle.com
    WS : bklerk
    User : demo
    PWD : demo123
    Regards
    Bas

  • Bug: Report Column based on LOV character string buffer too small error

    When using a column type of "Display as Text (based on LOV, does not save state)" with a result set that is rather large causes a character or string buffer too small oracle error.
    See the below page for an example.
    The example page below has a single report off a table called "HUGE_TABLE" which has two columns: display and code
    Code contains a number between 0 and 100000.
    Display contains the number in code appended to a block of text.
    When I display the report with no Display As Text (based on LOV does not save state) it displays fine.
    If I make the "Code" column display as text based on LOV and make the LOV
    "SELECT display, code FROM huge_table"
    I get the error you see on the page.
    http://apex.oracle.com/pls/otn/f?p=32149:1
    Thanks.

    Thanks for your help Scott.
    So from what I've gathered from my own tests and the discussions you linked me to the LOVs based on SQL queries are being converted into "static LOV" strings before being used.
    As such they are limited to the PL/SQL VARCHAR2 max size of 32767
    Which means given the static reduction of the string 'STATIC:' that we have 32760 characters left.
    Which is where your SUM( LENGTH( display ) + LENGTH( return ) + 2 ) comes in.
    In short, if:
    sum( length( display ) + length( return ) + 2 ) + 7 > 32767
    would evaluate to true then you have a problem. :)
    I'll use this to track down my problems and switch them over to inline queries.
    Thanks.
    Cheers,
    Joe

  • Report "Display Text (Based on LOV)" columns don't like colons - Bug?

    This is a bit hard to explain in text, so I've built a sample app: http://apex.oracle.com/pls/otn/f?p=9608:1
    The app has two pages, which demonstrate two related bugs in the handling of Report "Display as Text (based on LOV)" columns.
    Basically, if the LOV query returns a string that contains colon characters (":") in the display column, the values are matched up correctly, but the colons are stripped from the display.
    If the LOV query returns a string that contains colon characters in the return value column, then the matching fails entirely.
    Removing the colon characters eliminates the problem.
    We actually ran into this in a production environment, after an upgrade from Apex 3.0.0 to 3.2.1. The behavior definitely did not occur in Apex 3.0, but was added at some point between the two versions.

    The colon is actually part of our data (the field in question is a URN namespace).
    And yes, I understand the function of the colon in Apex URL parameter passing. However, I wouldn't expect that sort of parsing to be used against the results returned from an LOV query.
    Also, the LOV is fine in of itself -- a select list based on the LOV displays & returns the expected values. It's only when I use a report column based on an LOV that this behavior creeps in.
    We've found a (fairly painful) workaround -- altering both the report query and the LOV query to to do something like replace(column, ':', '_') -- but that's a manual change to a large number of pages for us.
    This behavior is new to version 3.2.1. It didn't happen in version 3.0.

  • Sorting report by column based on LOV problem...

    All,
    I have an issue with a report I have written.
    I have an LOV based on a sql where which returns an ID as a return value and a CODE as a display value.
    Lets say the LOV returns the following results:
    Return, Display
    1, V
    2, A
    3, T
    When I click on the item column heading to sort the report based on that column the records are in the order 1, 2, 3 and not A, T, V.
    So it looks like it is sorting the results based on the return value and not the display value.
    Is this a feature of displaying items based on LOVs in reports and then sorting on them or am I missing something.
    Hopefully, someone can help me out here as it is driving me mad.
    Regards
    ChrisR

    Chris,
    This didn't change in 3.1 and that is definitely not a bug but a feature. The solution I
    propose is a simple workaround for the special cases of LOV display columns or columns
    where you have an image but still want to do sorting.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/apex/f?p=107:7
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to create multi-reports based on one user parameter - URGENT!

    Hi, can any one help me? I want to create multi-reports at one time and each of the reports should be generated based on a parameter :subid. The db schema is like this:
    table projects(sub_id, project_id, value, builder_code)
    The main query is "select builder_code, sum(value) from projects group by builder_code where sub_id = :subid".
    The subid will be from the same table: select distinct sub_id from projects.
    What i hope to do is to create each report for each sub_id (subscription id) one by one.
    Thanks a lot.

    Hi Sean,
    Yes, bursting was introduced in Oracle9i Reports. For 6i, the only option may be to write a utility, which keeps submitting the same command to run the report, but every time with a new subscription ID. The query inside the report will be the same as you suggested in your first post:
    select builder_code, sum(value) from projects group by builder_code where sub_id = :subid
    You utility will have to fetch all the subid's from the table, and keep submitting the report request with each subid (the report requests with different subid's can be either submitted one by one, or all at the same time).
    Navneet.

  • How to create a horizontal multi column menu?

    We are trying to create a horizontal menu, just like the one at Oracle site ( [http://www.oracle.com/us/index.html] ) with links in multiple columns in each menu item. Can you please suggest how to do it? We have tried using the navigation model but could only create single column menus.

    Put the links in a form and set the rows and columns properties of the Form.
    See the options on this page:
    http://jdevadf.oracle.com/adf-richclient-demo/faces/visualDesigns/formLayout.jspx

  • How do i create a Multi column Dynamic list using Swing?

    Hi,
    I need to be able to do a file search (in a separate thread) on the hard drive and display the results in a multi column List control .
    Jtable seems to be rather 'static'y. i.e load data in once. and maybe reload it again later. But i need to load one row in at a time as the search progresses.
    Also any row can be deleted or moved to another position.
    CListCtrl in MFC allows me to do this handily.
    But Is there a way to do this using Swing?
    havent seen anything that says JList can do this.
    TIA

    Hi Jacob.
    I would use JTable for that. I did not exactly understand what you meant by JTable being "static"y.
    Anyway, I would have the thread update the data in the tablemodel behind the table and invoke "fireTableRowsInserted" (may be after every insert or after inserting a chunk of rows). I had a sample something similar to what you are working on. Let me know if you need the sample.
    HTH.
    Regards,
    Vijay

  • How to create multi level reports?

    The report I have created contains 25 columns and is to wide. I would like to create a multi level report in the fashion of below:
    Col 1 Col 2 Col 3
    Row1 Row1 Row1
    Row2 Row2 Row2
    Col 5 Col 6 Col 7
    Row1 Row1 Row1
    Row2 Row2 Row2
    I am assuming this needs to be done by modifying html in a template.
    I have cut up a normal report to try and illistrate what I am thinking.
    http://i71.photobucket.com/albums/i124/breinhar/multirow.jpg
    I greatly appreciate the help. Thanks.

    Hi,
    OK - I've put together a horizontal scrolling report template for a Theme 12/Standard report: [http://apex.oracle.com/pls/otn/f?p=33642:198]
    To create this, you need to:
    1 - Through Shared Components, Templates - create a new Report Template based on a copy of the existing Standard report template.
    2 - When you have your new template, edit it.
    3 - In the template's "Before Rows" setting, replace what's there with the following:
    &lt;style type="text/css"&gt;
    #table1 th {white-space: nowrap}
    #table1 td {white-space: nowrap}
    #table2 th {white-space: nowrap}
    #table2 td {white-space: nowrap}
    &lt;/style&gt;
    &lt;table cellpadding="0" cellspacing="0" summary="" style="padding:0px; border-collapse:collapse;"&gt;#TOP_PAGINATION#
    &lt;tr&gt;&lt;td&gt;
      &lt;tr&gt;
        &lt;td style="vertical-align:top; background-color:#EFEFEF; padding:0px; border:1px solid darkgray;"&gt;
          &lt;div id="d1" style="background-color:white; margin:0px; border:0px; padding:0px;"&gt;
          &lt;/div&gt;
        &lt;/td&gt;
        &lt;td style="vertical-align:top; padding:0px; border:1px solid darkgray;"&gt;
          &lt;div id="d2" style="overflow-X:scroll; margin:0px; border:0px; padding:0px; border-right:1px solid darkgray;"&gt;
    &lt;table cellpadding="0" border="0" cellspacing="0" summary="" class="t12Standard" id="table2"&gt;4 - In the template's "After Rows" setting, replace what's there with the following:
          &lt;/div&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;&lt;div class="t12bottom"&gt;#EXTERNAL_LINK##CSV_LINK#&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;#PAGINATION#&lt;/table&gt;
    &lt;script type="text/javascript"&gt;
    var d1 = document.getElementById("d1");
    var t2 = document.getElementById("table2");
    var t1 = t2.cloneNode(false);
    t1.style.width = "100%";
    t1.id = "table1";
    d1.appendChild(t1);
    var t2Rows = t2.rows;
    var k;
    var r;
    var c;
    for (k = 0; k &lt; t2Rows.length; k++)
    r = document.createElement("TR");
    t1.appendChild(r);
    c = t2Rows[k].cells[0].cloneNode(true);
    r.appendChild(c);
    t2Rows[k].deleteCell(0);
    d1.innerHTML += "";
    &lt;/script&gt;5 - On your report's Report Attributes, change the template used for the report from "Standard" to your new one
    6 - Also on the report's Report Attributes, set "Enable Partial Page Refresh" to No - this is required as we need the javascript in the template to be run whenever pagination happens and Partial Page Refresh does not seem to allow us the means to trigger javascript
    7 - Finally, on the report region's Region Footer, add in:
    &lt;style type="text/css"&gt;
    #d1 {width:75px;}
    #d2 {width:500px;}
    &lt;/style&gt;#d1 refers to the width of the frozen column and #d2 is the width of the rest of the report - you can adjust these figures as required.
    The template contains two DIV tags - d1 and d2. Initially, d1 is empty and d2 contains the report. The javascript moves the first cell in each row from d2 to d1. The styles then add the scrolling functionality.
    Andy

  • How To Create Multi Row Edit Forms in a JSP

    Hi, Could someone tell me how can i create multi edit rows in BC4J JSP edit page.
    Thanks
    Sirisha

    Refer to
    BC4J Multi-Row Extension API which provides multiple row operations to BC4J-based web application.
    http://sourceforge.net/docman/display_doc.php?docid=19393&group_id=87369
    http://radio.weblogs.com/0118231/2005/04/20.html#a529

  • Multi Column Report - printing Across and then Down

    Is there any setup option for a multi column report to go across and then down instead of down & across as a default. The problem I am experiencing is that some where and some how the two columns are not horizontally aligned properly - neither in the
    report view nor in the exported PDF. 
    The added difficulty is the problems created by this misaligned labels while printing on a custom paper that is smaller in size. Though I can setup the custom dimensions and get the desired 4x2 labels on the screen the printing doesn't sit in proper places
    on a preformatted paper.
    Is there any solution(s). Thanks in advance.

    Hi Christal,
    Based on my understanding, you want to make multi columns go across then down in the report.
    For your requirement, on query level, we should add an additional field(DisplayColumn) in the dataset, the field indicates the column in which the corresponding records will display. When designing a report, we add a group in the report, then insert some
    tablixes into the detail row. Within the nested tablix, we specify filter expression based on the value of DisplayColumn field. So that we can decide which data should display on which column. When previewing the report, you can find the report displays like
    newsletter-style. Besides, if we design the report like this, the report can supports all renders. For detail information about how to design the report step by step, please refer to this article:
    Creating Multiple-Column Reports [SSRS] .
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Determine the best width for ListCellRenderer - Multi-column combo box

    Currently, I am having a multi column combo box. In order for the column to align properly during show popup, I use box layout to do so. However, the short coming for box layout is that, the size for each column is fixed. This makes me have a difficulty, when I have a long string to be displayed. The problem is shown through the following screen shoot.
    http://i.imgur.com/4Nfc6.png
    This is because in 2nd column,
    1) All the 3 rows must be in same size so that they are aligned.
    2) But 1st row and 2nd row cell renderer, do not know 3rd row is holding such a long string.
    The code (2 files) to demo this problem is as follow. Is there any way the size of the cell will be adjusted automatically? Yet, all the row will be aligned properly.
    ResultSetCellRenderer.java
    package javaapplication24;
    import java.awt.Color;
    import java.awt.Component;
    import javaapplication24.NewJFrame.ResultType;
    import javax.swing.JList;
    import javax.swing.ListCellRenderer;
    import javax.swing.UIManager;
    * @author yccheok
    public class ResultSetCellRenderer extends javax.swing.JPanel implements ListCellRenderer {
        /** Creates new form ResultSetCellRenderer */
        public ResultSetCellRenderer() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
            jLabel1.setText("jLabel1");
            jLabel1.setMaximumSize(new java.awt.Dimension(88, 14));
            jLabel1.setMinimumSize(new java.awt.Dimension(88, 14));
            jLabel1.setPreferredSize(new java.awt.Dimension(88, 14));
            add(jLabel1);
            jLabel2.setText("jLabel2");
            jLabel2.setMaximumSize(new java.awt.Dimension(100, 14));
            jLabel2.setMinimumSize(new java.awt.Dimension(200, 14));
            jLabel2.setPreferredSize(new java.awt.Dimension(100, 14));
            add(jLabel2);
        }// </editor-fold>
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        // End of variables declaration
        // Do not use static, so that our on-the-fly look n feel change will work.
        private final Color cfc  = UIManager.getColor("ComboBox.foreground");
        private final Color cbc  = UIManager.getColor("ComboBox.background");
        private final Color csfc = UIManager.getColor("ComboBox.selectionForeground");
        private final Color csbc = UIManager.getColor("ComboBox.selectionBackground");
        private final Color cdfc = UIManager.getColor("ComboBox.disabledForeground");
        // For Nimbus look n feel.
        private final Color nimbus_csfc;
             Color c = UIManager.getColor("ComboBox:\"ComboBox.renderer\"[Selected].textForeground");
             // Pretty interesting. Applying "c" directly on the component will not
             // work. I have the create a new instance of Color based on "c" to make
             // it works.
             nimbus_csfc = c != null ? new Color(c.getRed(), c.getGreen(), c.getBlue()) : null;
        private final Color nimbus_csbc;
            Color c = UIManager.getColor("ComboBox:\"ComboBox.renderer\"[Selected].background");
             // Pretty interesting. Applying "c" directly on the component will not
             // work. I have the create a new instance of Color based on "c" to make
             // it works.
            nimbus_csbc = c != null ? new Color(c.getRed(), c.getGreen(), c.getBlue()) : null;
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            final Color _csbc = csbc != null ? csbc : nimbus_csbc;
            final Color _csfc = csfc != null ? csfc : nimbus_csfc;
            this.setBackground(isSelected ? _csbc : cbc);
            this.setForeground(isSelected ? _csfc : cfc);
            jLabel1.setBackground(isSelected ? _csbc : cbc);
            jLabel1.setForeground(isSelected ? _csfc : cfc);
            jLabel2.setBackground(isSelected ? _csbc : cbc);
            jLabel2.setForeground(isSelected ? _csfc : cfc);
            final ResultType result = (ResultType)value;
            jLabel1.setText(result.symbol);
            jLabel2.setText(result.name);
            return this;
    NewJFrame.java
    package javaapplication24;
    import java.awt.Container;
    import java.awt.Dimension;
    import javax.swing.JComboBox;
    import javax.swing.JList;
    import javax.swing.JScrollBar;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    import javax.swing.event.PopupMenuEvent;
    import javax.swing.event.PopupMenuListener;
    import javax.swing.plaf.basic.BasicComboPopup;
    * @author yccheok
    public class NewJFrame extends javax.swing.JFrame {
        public static class ResultType {
             * The symbol.
            public final String symbol;
             * The name.
            public final String name;
            public ResultType(String symbol, String name) {
                this.symbol = symbol;
                this.name = name;
            @Override
            public String toString() {
                return symbol;
        /** Creates new form NewJFrame */
        public NewJFrame() {
            initComponents();
            this.jComboBox1.addPopupMenuListener(this.getPopupMenuListener());
            this.jComboBox1.setRenderer(new ResultSetCellRenderer());
            this.jComboBox1.addItem(new ResultType("Number 1", "Normal"));
            this.jComboBox1.addItem(new ResultType("Number 2", "Normal"));
            this.jComboBox1.addItem(new ResultType("Number 3", "A VERY VERY VERY VERY long text"));
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jComboBox1 = new javax.swing.JComboBox();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBox1ActionPerformed(evt);
            getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, -1));
            pack();
        }// </editor-fold>
        private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
        * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    final NewJFrame frame = new NewJFrame();
                    frame.setVisible(true);
        private PopupMenuListener getPopupMenuListener() {
            return new PopupMenuListener() {
                @Override
                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                    // We will have a much wider drop down list.
                    adjustPopupWidth(jComboBox1);
                @Override
                public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                @Override
                public void popupMenuCanceled(PopupMenuEvent e) {
         * Adjust popup for combo box, so that horizontal scrollbar will not display.
         * Resize JComboBox dropdown doesn't work without customized ListCellRenderer
         * http://www.camick.com/java/source/BoundsPopupMenuListener.java
         * @param comboBox The combo box
        public static void adjustPopupWidth(JComboBox comboBox) {
            if (comboBox.getItemCount() == 0) return;
            Object comp = comboBox.getAccessibleContext().getAccessibleChild(0);
            if (!(comp instanceof BasicComboPopup)) {
                return;
            BasicComboPopup popup = (BasicComboPopup)comp;
            JList list = popup.getList();
            JScrollPane scrollPane = getScrollPane(popup);
            // Just to be paranoid enough.
            if (list == null || scrollPane == null) {
                return;
            //  Determine the maximimum width to use:
            //  a) determine the popup preferred width
            //  b) ensure width is not less than the scroll pane width
            int popupWidth = list.getPreferredSize().width
                            + 5  // make sure horizontal scrollbar doesn't appear
                            + getScrollBarWidth(popup, scrollPane);
            Dimension scrollPaneSize = scrollPane.getPreferredSize();
            popupWidth = Math.max(popupWidth, scrollPaneSize.width);
            //  Adjust the width
            scrollPaneSize.width = popupWidth;
            scrollPane.setPreferredSize(scrollPaneSize);
            scrollPane.setMaximumSize(scrollPaneSize);
         *  I can't find any property on the scrollBar to determine if it will be
         *  displayed or not so use brute force to determine this.
        private static int getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane) {
            int scrollBarWidth = 0;
            JComboBox comboBox = (JComboBox)popup.getInvoker();
            if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) {
                JScrollBar vertical = scrollPane.getVerticalScrollBar();
                scrollBarWidth = vertical.getPreferredSize().width;
            return scrollBarWidth;
         *  Get the scroll pane used by the popup so its bounds can be adjusted
        private static JScrollPane getScrollPane(BasicComboPopup popup) {
            JList list = popup.getList();
            Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list);
            return (JScrollPane)c;
        // Variables declaration - do not modify
        private javax.swing.JComboBox jComboBox1;
        // End of variables declaration
    }Edited by: yccheok on Jan 13, 2011 9:35 AM

    Are these two lines intentionally or is it just a mismatch?
    jLabel2.setMaximumSize(new java.awt.Dimension(100, 14));
    jLabel2.setMinimumSize(new java.awt.Dimension(200, 14));
    2) But 1st row and 2nd row cell renderer, do not know 3rd row is holding such a long string.There is only one cell renderer for all rows, so no need for the rows to know each other.
    To calculate the exact maximum width of column two, you have to check each entry.
    If you can do this BEFORE creating the combo, you could do this in a loop similar to this pseudo code
    FontMetrics fm= jComboBox1.getFontMetrics(jComboBox1.getFont());
    foreach (column2String) {
      int length= fm.stringWidth(column2String);
      if (length>max) max= length;
    }Now you have a max value to dimension jLabel2 in your renderer.
    If you don't fill your combo in one go, but rather at runtime, you have to check at each
    jComboBox1.addItem(...)
    whether the string for label2 is extending the current max, redefine max, and repaint the combo.
    This second approach I haven't done so far, but that's how I would try.

Maybe you are looking for

  • How to configure jar files in BAT file

    hi to all .I have one doubt. how to configure the no.fo jar files in BAT file. can any one help me thanks

  • Looking for Director author in Dallas area

    I have been trying to find a Director Author in the Dallas area, but haven't found one yet. Does anyone know of someone?

  • Passing values in table from one component to another component in gp

    hai all,   I have a table with 5 rows in a view in component1.I need to pass the values in the table from component1 to table in component2.Plz help me with coding of interface controller of both component. Thanks in advance regards Sharanya.R

  • Reduce number retries for an automated activity on a fault-message

    Hi everyone, is it possible to reduce the number of retries if an automated activity gets a fault response? With correcting my logical destinations it was possible for me to achieve communication to a webservice outside the netweaver. Now I tried the

  • JTable & Combo Box

    Hello I have 2 combo box in the Jtable. Whenever there is something selected in the first drop down i have to repopulate the second combo box. JTable.populateData(ArrayList); Column renderer /editor TableColumn column1 = tablePane.getTable().getColum