Multiple Columns and List Order with Color

I am trying to take this code and enhance it by:
1. It currently displays the output in a 5 column vertical format
output1 output2 output3...
I want it to display in a scrolling 5 column vertical format
output1  output4
output2  output5
output3  output6
based on the number of data points
2. I want the first column background to be blue, the next white, the next blue, the next white, the last blue.
Any way to accomplish this..appreciate any help.
Leo
Code:
<table width="100%" border="0" cellpadding="7" cellspacing="0">
<tr>
<td colspan="5" align="left" valign="top" bgcolor="#CC6699">
<span class="datetextwhite"><a name="THURSDAY"> </a><span class="style6">Thursday, October 29th: PRE-CONFERENCE INTENSIVES</span></span></td>
</tr>
     <TR>
     <CFOUTPUT QUERY="q_daysschedule">
          <TD valign=top><span class="bodytextbold"><span class="style16"><font face="Verdana, Arial, Helvetica, sans-serif">#q_daysschedule.time#</font></span></span><br /><span class="topNavigationBar"><a href="session.cfm?ID=201" class="topNavigationBar">#q_daysschedule.Title#</a></span></TD>
          <CFIF q_daysschedule.CurrentRow MOD 5 IS 0>
               </TR>
               <TR></TR>
          </CFIF>
     </CFOUTPUT>
<tr>

I find these problems easier to solve if I rearrange my data into an array.  Something like this:
DataArray = ArrayNew(2);
Cols = 5;
Outputs = "output1,output2,etc";
Rows = Round(ListLen(Outputs) / Cols + .5);    // 32 outputs would give you 7 rows
for (ii = 1; ii lt cols; ii = ii + 1) {
for (j = 1; j lte Rows; j = j + 1) {
DataArray[ii][j] = ListFirst(Outputs);
Outputs = ListRestOutputs;
} // rows
}  // cols
// Last Column
for (ii = 1; ii lte ListLen(Outputs); ii = ii + 1 )
DataArray[cols][ii] = ListGetAt(outputs, ii);
// put spaces in blank rows
for (j = ii; j lte rows; j = j + 1)
DataArray[cols][j] = " ";
Output like this
<cfoutput>
<cfloop from = "1" to = cols index = "ThisRow">
<cfloop from = "1" to = rows index = "ThisCol">
#DataArray[ThisCol][ThisRow]#
closing tags, formatting etc

Similar Messages

  • Multiple columns and rows in MessageService

    I am attempting to create a message (via MessageService) which has multiple lines of data, and each line has multiple data columns.
    Background:  My program reads data from a web store, and creates Sales Orders in SBO.  A single run might process multiple orders.  When all orders have been entered, the program should send a (single) message to a list of recipients.  The message will have one line of data for each sales order produced.  Each line will contain two fields: the linked SBO sales order number, and the unlinked web order number.
    When the message is initially created, I'm defining the multiple columns and initializing the data lines:
    pMessageDataColumns = oMessage.MessageDataColumns
    pMessageDataColumn = pMessageDataColumns.Add()
    pMessageDataColumn.ColumnName = "SalesOrder"
    pMessageDataColumn.Link = BoYesNoEnum.tYES
    pMessageDataColumn = pMessageDataColumns.Add()
    pMessageDataColumn.ColumnName = "WebOrder"
    pMessageDataColumn.Link = BoYesNoEnum.tNO
    oLines = pMessageDataColumn.MessageDataLines()
    Later, as each Sales Order is processed, I'm attempting to inject the two data values into the message data:
    oLine = oLines.Add()
    oLine.Value = Str(pOrd.DocNum)
    oLine.Object = 17
    oLine.ObjectKey = Str(pOrd.DocEntry)
    oLine = oLines.Add()
    oLine.Value = pOrd.WebOrder
    The above code would be invoked for each Sales Order processed.  However, it generates an "Internal error (-5002) occurred" when the message is ultimately sent.
    The SDK documentation states:
    The MessageDataLine is a child data structure related to the MessageDataColumn. It contains the value of a specified cell in the Data table, which is defined by its column number (vtIndex of Item of MessageDataColumns) and row number (vtIndex of Item of MessageDataLines).
    I guess I don't understand the relationship between adding a "line" in my data display versus adding data into a "column".  It appears that the "oLines.Add()" is used to bump across the columns of the data.  If so, how do I advance to the next entire row of data in the message?
    Thanks, Dave

        Class Item
            Public ItemCode As String
            Public Dscription As String
        End Class
    Dim ItemCodes as new list( of item)
    Dim one as new item
    one.ItemCode = "ItemCode"
    one. Dscription ="Name of Item"
    itemcodes.add (one)
            Try
                Dim oCmpSvc As SAPbobsCOM.CompanyService = _ocmp.GetCompanyService()
                Dim oMsgSvc As SAPbobsCOM.MessagesService = oCmpSvc.GetBusinessService(ServiceTypes.MessagesService)
                Dim oMsg As SAPbobsCOM.Message = oMsgSvc.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage)
                oMsg.Subject = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                oMsg.Text = Msg
                Dim oMsgDataColumn As SAPbobsCOM.MessageDataColumn
                If ItemCodes.Count > 0 Then
                    oMsgDataColumn = oMsg.MessageDataColumns.Add()
                    oMsgDataColumn.ColumnName = "Product / Item Code"
                    oMsgDataColumn.Link = BoYesNoEnum.tYES
                    For Each oneitem As Item In ItemCodes
                        Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
                        oMsgDataLine.Object = "4"
                        oMsgDataLine.ObjectKey = oneitem.ItemCode
                        oMsgDataLine.Value = oneitem.Dscription
                    Next
                    oMsgDataColumn = oMsg.MessageDataColumns.Add()
                    oMsgDataColumn.ColumnName = "Description"
                    oMsgDataColumn.Link = BoYesNoEnum.tNO
                    For Each oneitem As Item In ItemCodes
                        Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
                        oMsgDataLine.Value = oneitem.Dscription
                    Next
                End If
                        Dim oMsgRecipient As SAPbobsCOM.Recipient = oMsg.RecipientCollection.Add()
                        oMsgRecipient.UserCode = "manager"
                        oMsgRecipient.SendInternal = BoYesNoEnum.tYES
                        oMsgRecipient.SendEmail = BoYesNoEnum.tNO
                oMsgSvc.SendMessage(oMsg)
                MsgBox("SAP B1 internal Message sent...")
            Catch ex As Exception
                MsgBox("Unable to send SAP B1 internal message. Error:" + ex.Message)
            End Try
        End Sub

  • Edit back to back sales and purchase order with dropped ship warehouse

    Hi
    Our Client request to be able to edit back to back sales and purchase order with Drop Shipped WH which is frequently required according to their business nature in overseas trading.
    Kedalene Chong

    Hi Daniel,
    In the PO Ship To address field, the database/company address will appear until a warehouse is selected. Once a WH is selected, that is the address that will appear. If there is no WH address, the company address is indicated in the field (note: no company name just the address).
    If you want a different address/name, you can type it into the ShipTo address field and the PLD template will use whatever is in the field.
    If it is because there is no company name on the PO - does this mean you want a different company name than the one in the PO header. If this is the case and the ShipTo address & company name is always the same, you can update the PLD template by changing the ST address field to Text and enter the company name & address you want on the PO. This will appear on every PO regardless of what is in SAP. If you want the company name to always be the same, add a text field above the ST address field and fill in the company name; the address will be pulled from the PO Logistics ST field (per the first paragraph above).
    If this is not what you want, please explain in more detail what you would like to do.
    Heather

  • Create Multiple Signature and Date fields with a custom Toolbar Button

    First off, thanks in advance!  I am a scripting newbie and I am trudging my way through with very little experience with scripting of any kind.  I am good at taking other's scripts and forming them into something I need, but I can't seem to find anything to do what I want.
    Using Adobe Acrobat X, I am trying to create a toolbar button that I can press to create multiple signature and date fields with predetermined locations.
    Below is the script I have that is working to create just a single signature box, but I can't seem to figure out the exact syntax to have that same button create multiple fields.  In total it is 9 signature fields and 9 date fields need to be created.  If you can just give me an example of what the button would look like with multiple scripts?  I was assuming I would set up multiple variables and then in the cExec property of the toolbar button I could just call out all of those variables? 
    var sigswm = "addField('sigSWM', 'signature', '0', [108, 198, 494.64, 72])"
    app.addToolButton({cName: "dotbutton", cExec: sigswm, cLabel: "Place Signature and Date Blocks",});
    Thanks in advance for any help you can provide.
    Billy Sweeney

    Thanks!  That was probably the only thing I didn't try.
    I do have one more question.  What I want is when the signature field is clicked it fills out a specific date field. I beleive the script I want would be:
    var currentTime = new Date()
        var month = currentTime.getMonth() + 1
        var day = currentTime.getDate()
        var year = currentTime.getFullYear()
        var signingTime = day +"/"+month+"/"+year
        var f = this.getField("dateSWM"); 
        f.value = signingTime;
    I found this on another thread that mentioned it could be placed in the Signed tab of the signature properties dialog.  I am assuming it would be placed in my button script file as a setAction script for each signature, but I am not real sure exactly where or how?

  • Order by multiple columns and ROWNUM

    Hi -
    I am trying to use rownum in colloboration with order by multiple columns but I guess I am doing something wrong
    and I am always getting a single row per emp_id rather than getting single row for a particular emp_id,role_id,inst_id,exp_date.
    Below is the table ddl and data insertion script.
    ====
    create table tab_details
    (emp_id varchar2(50),
    role_id integer,
    inst_id integer,
    exp_date date,
    chk_ind char(1),
    trans_type char(1),
    trans_date date);
    insert all
    into tab_details values ('JBRAMS',12,4556,'07/15/2011','Y','U','05/21/2011')
    into tab_details values ('JBRAMS',12,4556,'07/15/2011','N','U','05/22/2011')
    into tab_details values ('JBRAMS',12,4556,'07/15/2011','N','D','05/23/2011')
    into tab_details values ('JBRAMS',12,4556,'07/15/2011','N','U','05/24/2011')
    into tab_details values ('KCASOT',98,9001,'08/03/2011','Y','U','04/11/2011')
    into tab_details values ('KCASOT',98,9001,'08/03/2011','N','U','04/12/2011')
    into tab_details values ('KCASOT',98,9001,'08/03/2011','N','U','04/13/2011')
    into tab_details values ('JBRAMS',43,7875,'06/28/2011','Y','U','03/19/2011')
    into tab_details values ('JBRAMS',43,7875,'06/28/2011','N','U','03/20/2011')
    into tab_details values ('BHAYEN',28,4098,'07/01/2011','Y','U','02/13/2011')
    into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','U','02/14/2011')
    into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','D','02/15/2011')
    into tab_details values ('BHAYEN',28,4098,'07/01/2011','Y','U','02/16/2011')
    into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','U','02/17/2011')
    into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','U','02/18/2011')
    select * from dual;
    commit;
    ====
    So for the first four rows inserted above, I need only following row:
    'JBRAMS',12,4556,'07/15/2011','N','U','05/22/2011'
    Basically, I need only the rows with chk_ind='N' and trans_type<>'D' and if there is a row with
    chk_ind='N' and trans_type='U' after trans_type='D" for a emp_id,role_id,inst_id,exp_date then it should be ignored.
    Following are the only rows I am looking for:
    'JBRAMS',12,4556,'07/15/2011','N','U','05/22/2011'
    'KCASOT',98,9001,'08/03/2011','N','U','04/12/2011'
    'JBRAMS',43,7875,'06/28/2011','N','U','03/20/2011'
    'BHAYEN',28,4098,'07/01/2011','N','U','02/14/2011'
    'BHAYEN',28,4098,'07/01/2011','N','U','02/17/2011'
    Please share your thought over this.
    Thanks,
    -Seenu

    Hi, Seenu,
    Seenu001 wrote:
    Hi -
    I am trying to use rownum in colloboration with order by multiple columns but I guess I am doing something wrong
    and I am always getting a single row per emp_id rather than getting single row for a particular emp_id,role_id,inst_id,exp_date.Thanks for posting the CREATE TABLE and INSERT statements. It would help if you posted your query, too: even if it's not qute right, it could help to understand the problem, and modifying it might be more efficient than writing a completely new query.
    What are the multiple columns you are sorting on? Why isn't trans_date enough?
    Here's one way:
    WITH     got_okay     AS
         SELECT     t.*
         ,     CASE
                   WHEN  LAG (chk_ind)    OVER ( PARTITION BY  emp_id
                                     ,           role_id
                                     ,           inst_id
                                     ,           exp_date
                                     ORDER BY      trans_date
                                      ) = 'N'
                   AND   LAG (trans_type) OVER ( PARTITION BY  emp_id
                                     ,           role_id
                                     ,           inst_id
                                     ,           exp_date
                                     ORDER BY      trans_date
                                      ) IN ('D', 'U')
                   THEN  0
                   ELSE  1
              END          AS okay
         FROM     tab_details     t
    SELECT       *     -- or list all columns except d_cnt
    FROM       got_okay
    WHERE       chk_ind     = 'N'
    AND       trans_type     != 'D'
    AND       (     trans_type     != 'U'
           OR     okay          = 1
    ;

  • FO and blanket order with shceduling agreeement, distinction

    dear sirs,
    What is the difference between Blanket Purchase Order and the
    Framework Order.
    how the payment is beeing doen for the same 2 order
    with flow (along with Transaction cods)

    PO
    Create PR (ME51N) ->Create PO (ME21N/ME57/58/ME59N) -> GR (MIGO) -> Enter Invoice (MIRO)
    Blanket PO
    Create PO  (ME21N/ME57/58/ME59N) -> Enter Invoice (MIRO)
    A scheduling agreement is a different docuement type to a PO. 
    A SA is created in two steps.  First the agreement document is created which contains pricing and contract information such as
    Vendor
    Material
    Target Quantity
    Validity period
    A delivery schedule is then created automatically in a subsequent step by an MRP run when the materials source list references the SA agreement
    The delivery schedule is made of individual schedules lines representing demand for each item.

  • Please help! How can I validate Radio Buttons and List Menu with PHP.

    Hello everyone, I have been learning PHP step by step and
    making little projects.
    The point is I find it easy to learn by doing "practical
    projects."
    I have been reading the David Powers's Book on PHP Solutions
    and it's really great, however there is nothing mentioned regarding
    Validating Radio buttons. I know the book cannot cover every aspect
    of PHP and maybe someone in here can help.
    I have been learning how to process HTML forms with PHP.
    The problem is every book or tutorial I have read or
    encountered fall short on validation.
    I'm wondering how I can learn to validate Radio Buttons and
    Select List Menu.
    I have managed to create validation for all other fields but
    have no clue as to how I can get validation for Radio Buttons and
    List Menu.
    I would also like an error message echoed when the user does
    not click a button or make a selection and try to submit the form.
    I would appreciate any help.
    Patrick

    It's not that default value is "None." In fact it's not. It
    will only be
    "none" when the form is submitted.
    Also if your submit button is names 'send' then
    $_POST['send'] will only be
    set if the form was submitted.
    Make sure you didn't hit the refresh button on your browser
    which usually
    reposts the information. Also make sure you did not reach the
    form from
    another form with the same button names.
    Otherwise paste the snippet.
    Also you can check what fields are set in the post array by
    adding this to
    the top of (or anywhere on) your page:
    print_r($_POST);
    Cosmo
    "Webethics" <[email protected]> wrote in
    message
    news:[email protected]...
    >
    quote:
    Originally posted by:
    Newsgroup User
    > Off the top of my head this should be no different than
    your radio buttons
    > except that 'productSelection' will always fail the
    !isset check when the
    > form is submitted since the default value is "None", and
    therefore always
    > set. :-)
    >
    > So how about this..?
    > <?php
    > if (isset($_POST['send']) and
    ($_POST['productSelection'] == "None"))
    > {echo "Please select a product.";}
    > ?>
    >
    >
    >
    >
    > "Webethics" <[email protected]> wrote
    in message
    > news:[email protected]...
    > > Another question - how do i applied the code you
    just showed me to
    > > select
    > > menu
    > > or select list?
    > >
    > > This is the list:
    > >
    > > <div class="problemProduct">
    > > <label for="productSelection"><span
    class="product_label">Product
    > > Name.</span></label>
    > > <select name="productSelection" id="products"
    class="selection">
    > > <option value="None">-------------Select a
    product----------</option>
    > > <option value="Everex DVD Burner">Everex DVD
    Burner</option>
    > > <option value="Vidia DVD Burner">Vidia DVD
    Burner</option>
    > > <option value="Excerion Super Drive">Excerion
    Super Drive</option>
    > > <option value="Maxille Optical Multi
    Burner">Maxille Optical Multi
    > > Burner</option>
    > > <option value="Pavilion HD Drives">Pavilion
    HD Drives</option>
    > > </select>
    > > </div>
    > >
    > > I thought I could just change the name is the code
    from operatingSystem
    > > to
    > > productSelection.
    > >
    > > Something like this:
    > >
    > > From this:
    > >
    > > <?php
    > > if (isset($_POST[send]) and
    !isset($_POST['operatingSystem']))
    > > {echo "Please select an operating system.";}
    > > ?>
    > >
    > > To this:
    > >
    > > <?php
    > > if (isset($_POST[send]) and
    !isset($_POST['productSelection']))
    > > {echo "Please select an operating system.";}
    > > ?>
    > >
    > > But this does not work, any ideas?
    > >
    > > Patrick
    > >
    >
    >
    >
    >
    > Hey, I tried this about but as you mentioned, since the
    default product
    > value
    > is "None" an error message appears when the page loads.
    >
    > Is there a way to code this things so that even though
    the default value
    > is
    > "None" there ia no error message untle you hit the
    submit?
    >
    > When I applied the code, it messes up the previous code,
    now the operating
    > system is requiring an entry on page load.
    >
    > When I remove the code from the list menu everything
    goes back to normal.
    >
    > I know this is a little much but I have no other
    alternatives.
    >
    > Patrick
    >

  • Dynamic gallery with 3 columns and 5 rows with paging

    guyz, i am new to spry and i need your help. i want to create
    a dynamic gallery with data source as xml. i want to create a
    gallery with 3 columns and 5 rows.Basically a wallpaper page where
    there would be 15 wallpapers in a page with a link of downloading
    wallpapers with resolution 800x600,1024x768 and 1280x1024.
    for example if there are 63 wallpapers for a section , then
    there would be 5 pages with 5th page having only 3 wallpapers.
    everytime a wallpaper is added to xml, it automatically adds
    it up in html...
    plz help....i really want to create this asap and i cant find
    any help...

    thanks a ton for your response.... Meanwhile i figured out
    the solution myself using photogallery tutorial where div fixes the
    width and the next repeated element get shifted to another
    line.....
    now i am struck with another problem.
    i need to give substring to a particular data on xml.
    for example i have the following xml
    <movies>
    <data>
    Important Note: These online forums are for user-to-user
    discussions of Adobe products, and are not an official customer
    support channel for Adobe. If you require direct assistance, or
    prefer to contact Adobe support staff directly, please contact
    Adobe support.
    </data>
    </movies>
    i want to display only first 50 characters of data tag.....
    whats the code/syntax to do so.....

  • Black and white photo with color added back

    I want to be able to turn a photo black and white, then add color back in, say for instance a ball turned back to red only.  How can I do that in elements 11?  It's driving me crazy!  Help

    You need to duplicate your color photo. 
    1. Open your color photo in PSE11 Full Edit expert tab (A raw photo will open in camera raw so click the open image button too send it to the PSE interface)
    2. On the Top menu click Layer >>Duplicate Layer >>OK
    3. On the top menu click Enhance >>Convert to Black & White >>OK
    4. If you can’t see the layers pallet to the right click Window >>Layers
    5. In the layers pallet click add layer mask (the icon with a small circle)
    6. Make sure your foreground color is set to black then select the brush tool
    7. Click the mouse over the area where you wish to reveal color and use like an eraser to reveal the background below
    8. To correct errors switch the foreground color to white, then switch back to black and continue
    9. Save as PSD to preserve your layers and if you wish make a jpeg copy from the PSD file using File >> Save As
    N.B. if your brush is too big or too small you can use the square bracket keys to adjust the size up or down.
    The smart brush tool has black & white options but it does involve making selections which can be more tricky than using the ordinary brush.

  • Lost ability to right click multiple files and choose 'open with'

    In XP I can select a bunch of mp3 files, for example, right click and choose 'open with...' whatever application I want.
    In windows 7 I only get 'open with' in the context menu on single files. How do I enable 'open with' for a selection of files? Please tell me Windows 7 hasn't disabled this useful behaviour.

    Hi,
    You can change the register key to realize the function.
    For example, your mp3 player is windows media player, you can copy the following content (without quote) to the notepad and save it with the “.reg” extension.
    The context is below:
    Warning: While this procedure might solve the issue or problem, serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk. For more information about modifying the registry, see Microsoft support article 256986.
    “Windows Registry Editor Version 5.00
    [HKEY_CLASSES_ROOT\*\shell]
    [HKEY_CLASSES_ROOT\*\shell\open with]
    @="open with player"
    [HKEY_CLASSES_ROOT\*\shell\open with\command]
    @="\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\" \"%1\""
    [HKEY_CLASSES_ROOT\*\shell\removeproperties]
    "ProgrammaticAccessOnly"="Apartment"
    [HKEY_CLASSES_ROOT\*\shell\removeproperties\DropTarget]
    "CLSID"="{09a28848-0e97-4cef-b950-cea037161155}" ”
    You should change the bold text with the path of your player. After you’ve changed the key, you can right click the chosen MP3 files and choose “open with player” to play the music.
    If you still have some problems, please post here.

  • WL6.1 inserts columns in wrong order with random nulls

    I'm in the process of migrating a WL5.1 EJB app to WL6.1 and I've come across a
    very frustrating and strange error. While executing my app, one of my session
    beans calls a (callable statement) stored procedure on SQL Server 7.0, but when
    it trys to insert a row in the database it inserts a few of the columns in the
    wrong order and one of the columns, oddly, is all of the sudden NULL.
    I've checked and double checked all SQL code and SPs on SQL Server and everything
    is correct. Plus, the app works perfectly on WL5.1. PLEASE HELP!
    Kindest regards,
    Paul

    Jane:
    I just created a test project with the Portfolio-Color theme. I selected text for the link item instead of the default button. I then created 10 slideshow links, placing them in two columns of 5 each. 1-5 and 6-10. After aligning by eye I was able to navigate down each column in order. However, when I dragged 10 video clips into a similar menu the navigation order went all over the place as you experienced. I've tried using the regular buttons with snap to grid enabled for importing. It appears that that theme wants to import across the top row first and then the bottom next. With only 5 items it puts two on the top and 3 on the bottom.
    You may have to go with three menus: the top menu has two folders, slideshows 1-5 and slideshows 6-10. Then place your slideshows in each folder accordingly and let it do the placement, either text wise or button wise.
    Either that or find a new theme what will work better with 10 items on a page.

  • Multiple column in List item

    Hellow all
    I have 3 Column Code,Name,Salary
    I want a list item which show all 3 Data in one list item
    The picture will Clear you my Requirement
    Linkhttp://h1.ripway.com/Sharry2/ok.bmp
    Regards
    Shahzaib

    You want a static list_item or a dynamic list item, which is populated by a select statement??
    If you want a statis list item you can add your values from property palette; if you want a dynamic list item, I don't know if it is possible, because I have tried only with one column; you can try by make a concatenation of your columns separated by ','; for example you can try this code:
    select col1||','||col2||','||col3 as your_column_name
    from your table
    where your conditionIf you use create_group_from_query built_in, make sure to write column name 2 times, because one is for value of list item and the other is for label.
    Hope it helps you,
    Fabrizio
    If this answer is helpful or correct, please mark it. Thanks.

  • Problem in showing multiple columns and rows in horizontal wrap as like as

    I am trying to implement the ListView in my application as like as in windows.
    But i am able to show single row by this code snippet.
    What should i do to show  the multiple row ,multiple coloumns in JList.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    public class JListExample extends JFrame
        private class Value
            Value(String value, Icon image)
                this.value = value;
                this.image = image;
            String value;
            Icon image;
        private Icon getIcon(String name)
            return new ImageIcon(name);
        public JListExample()
            super("Simple JList Example");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            final Value[] VALUES =
                new Value("the road", getIcon("10.jpg")),
                new Value("trees",  getIcon("11.jpg")),
                new Value("stooges",  getIcon("12.jpg")),
                new Value("bauld tires",  getIcon("13.jpg")),
                new Value("bvot tires",  getIcon("14.jpg")),
                new Value("volt tires",  getIcon("15.jpg")),
                new Value("send tires",  getIcon("17.jpg")),
            JList list = new JList(VALUES);
            list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
            list.setVisibleRowCount(1);
            list.setCellRenderer(new SimpleCellRenderer());
            list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                if (evt.getValueIsAdjusting())
                return;
                System.out.println("Selected from " + evt.getFirstIndex()
                    + " to " + evt.getLastIndex());
            JScrollPane ListViewer = new JScrollPane(list);
            getContentPane().add(ListViewer);
            setBounds(0,0,600,600);
            //pack();
        public static void main(String[] args)
            try
                new JListExample().setVisible(true);
            catch (Exception e)
                e.printStackTrace(System.out);
        class SimpleCellRenderer extends JLabel implements ListCellRenderer
            public SimpleCellRenderer()
                setOpaque(true);
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
                Value val = (Value)value;
                setText(val.value);
                setIcon(val.image);
                //setBackground(isSelected ? Color.red : (index & 1)  ==0 ?                 Color.cyan : Color.green);
                //setForeground(isSelected ? Color.white : Color.black);
                return this;
    }

    I know this is an old topic, but I found the solution and thought I'd share it! By default, a JList only has 1 visible row. To allow the number of rows to expand dynamically, throw this in.
    this.imageList.setVisibleRowCount(-1);My code looks like this. It centers each image and centers the text under the image and wraps images horizontally.
        ListCellRenderer renderer = new ImageListCellRenderer();
        this.imageList.setCellRenderer(renderer);
        DefaultListModel listModel = new DefaultListModel();
        this.imageList.setVisibleRowCount(-1);
        this.imageList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        this.imageList.setModel(listModel);and the renderer
    public class ImageListCellRenderer extends DefaultListCellRenderer { 
      public Component getListCellRendererComponent(JList list, Object value, int
          index, boolean isSelected, boolean hasFocus) {
        JLabel label = (JLabel)super.getListCellRendererComponent(list, value,
            index, isSelected, hasFocus);
        if (value instanceof File) {
          File imageFile = (File)value;
          String path = imageFile.getAbsolutePath();
          Image image = Toolkit.getDefaultToolkit().getImage(path);
          image = image.getScaledInstance(100, 100, Image.SCALE_DEFAULT);
          ImageIcon imageIcon = new ImageIcon(image);
          label.setIcon(imageIcon);
          label.setText(path.substring(path.lastIndexOf(File.separatorChar) + 1));
          label.setVerticalTextPosition(SwingConstants.BOTTOM);
          label.setHorizontalAlignment(SwingConstants.CENTER);
          label.setHorizontalTextPosition(SwingConstants.CENTER);
        else {
          label.setIcon(null);
        return label;
    }I need to work on this to improve performance, but it works!

  • SELECT columns and OUTPUT pad with chars.

    Hi,
    I need to select a column from a table where if it is of length=16 or less, I will output with '0' behind the string to a total of 19 chars fixed.
    Eg. the column contains '1122334455', i will output as '1122334455000000000'
    Thanks in advance.
    regards,
    Tony

    Hi,
    Using a predicate to test the length of your string (where your_col <= 16) might give you problems selecting the data.
    It is genarally best to put code which alters the presentation of the data in the select list if you can, so the following is more flexible and doesn't impact the rest of your query.
      1  select str
      2       , length(str) as len
      3       , case when length(str)<=16 then rpad(str, 19, '0')
      4              else str end as padded
      5* from t
    SQL> /
    STR                         LEN PADDED
    thisisshort                  11 thisisshort00000000
    thisisalotlonger             16 thisisalotlonger000
    thisisverymuchlonger         20 thisisverymuchlonger
    3 rows selected.

  • CSS3 Multiple columns and Internet Exploder

    I developed a web page that needs a two-column layout and decided to use CSS3 to describe the columns: Really simple:
    .twocol {
              border-style: solid;
              border-width: 7px;
              border-color: #0476ac;
              -webkit-border-radius: 20px;
              -moz-border-radius: 20px;
              border-radius: 20px;
      -moz-column-count: 2;
              -moz-column-gap: 20px;
              -webkit-column-count: 2;
              -webkit-column-gap: 20px;
              column-count: 2;
              column-gap: 20px;
              padding: 10px;
              height: 300px;
    The CSS in bold describes the two column layout I want.
    Looked at in Internet Exploiter version 9 and it failed. And, since text was missing I did the "old skool" method:
    .colLeft {
              width: 410px;
    .colRight {
              width: 410px;
              float: right;
    Then in HTML:
    <section class="twocol">
    <div class="colRight">
    <p>Right column stuff goes here</p>
    </div>
    <div class="colLeft">
    <p>Left column stuff goes here</p>
    </div>
    </section>
    I commented out the stuff in bold in my stylesheet.
    Here is my question:
    Since I am using the HTML5 Shiv, ought not that to have created support for the multi-column declarations in CSS3 or is that just too complex?

    Well I sure wish Microsoft would give me the ability to check on Exploiter 10…
    (on My Macintosh).
    The two column definition worked on Safari 5.1.7 (which is certainly not the latest version)
    It worked just fine on Chrome 24.0.1312.57, which is close to current.
    It worked just fine on Firefox 19.0.
    Of course I didn't try 3 column or four column.
    Of course, just "north" of that is an "Amazon Scroller," which does not work on IE 8 or below… IE 7 reports an error with the script, but doesn't say which one (could be jQuery or it could be the amazon_scroller.js script). I have read (with interest) Al Sparber's commentary about jQuery and I am beginning to think he is right. However, many of these fun tools work brilliantly and are wonderful ways to please a client.
    If I could do a challenge throwdown for Al, I'd love to see him modify his horizontal glider to do what the scroller is doing and loop the images (please understand, this is something Al and I have discussed before and that I highly recommend his tools).
    I think Nancy gets the nod for "solver" here, though Al is always very helpful.

Maybe you are looking for

  • Printing a PDF page in A4 size resizes to A5

    Hi, I am trying to print a PDF file, which somehow succeeds; However the printed page shows the PDF in A5 format. the same pdf printed with acroread32 shows in expected A4 size. Can anyone imagine why? Here is the code: private void printPdf(File fil

  • Passing values from function to unbound field on report

    i've created a function to calculate certain values. i would like those values to be assigned to fields i've put on the report (these fields have no source) at runtime. how is this done. i've tried the ':' used for binding variables (parameters)...bu

  • Losing portelt session after every request

    Using bwa wl portal server 8.1 on wxp sp2 Hello all We wrote some JSR 168 compliant portlets and deployed them accoring to the bea doc. Basically our portlets seem to work. However, there are some issues that could be tracked down to one problem: Som

  • Flash Player 11 Bugs

    Just purchased ThinkPad E420. IE9, Windows7. Adobe Flash Player 11 is installed, but I keep being told to install it. Can't view some websites, youtube . . . Any solutions? Thanks

  • How to deploy the new version of webPart in SharePoint Server 2010

    Hi friend's ....I want to deploy the new version of webPart in SharePoint Server 2010. Is there any way for this....? In SharePoint sever 2013 there is version feature available for the apps..Same thing i want in SharePoint Server 2010 for webpart. P