Tables in List Cells?

I have been experimenting with some java swing gui components lately and I want to do the following, but have had no success thus far.
I have a list which I want to post some information in relative to an option the user can select. I can post some numbers in there but I want the following kind of layout in each cell...
| |__________|
|__________|__________|
basically a table in each cell with two columns by two rows and the left most cells merged. Information is obviously going in each cell which I have no problem doing. I tried creating a Vector of tables for the list constructor with no luck.
So any ideas on how this can be achieved would be appreciated. If I happen to be on the right track, I will post the code on what I have done, just basic steps for now please ;-)

public class MyCellRenderer extends JPanel implements ListCellRenderer {
     public MyCellRenderer() {
         setOpaque(true);
     public Component getListCellRendererComponent(
         JList list,
         Object value,
         int index,
         boolean isSelected,
         boolean cellHasFocus)
         // create a set of components using a GridBagLayout or something like
         // you were making any other similar layout.
         setBackground(isSelected ? Color.red : Color.white);
         setForeground(isSelected ? Color.white : Color.black);
         return this;
}

Similar Messages

  • How to get the table/tree/list cell underneath the mouse

    I feel like I must be missing something. How can I find out the tree cell underneath the mouse cursor?
    I am implementing drag and drop from a table to a tree. I need to know which tree cell the user dropped the item on. I can get the drop coordinates (in pixels, I assume) from the drag event, but there doesn't seem to be a way to convert that into the particular cell index. This same question applies to getting the list and table cell under at particular coordinates.
    If there isn't an API for this, has anyone found a reliable workaround (dividing Y by cell height, etc.)
    Thanks,
    Josh

    You need to put event handlers for the D&D events on the Cells that are being created (so you will need to set a custom cell factory). For example, every cell is a Node, and these support properties like 'onDragDroppedProperty', and 'onDragExitedProperty'.
    When you add event handlers to these, you should be notified of items being dragged onto specific Cells of the Tree. A Cell then can be matched with a particular item in the Tree by reading its TreeItem property.
    Also read the documentation for TreeItem. There is a bit there that says:
    "It is important to note however that a TreeItem is not a Node, which means that only the event types defined in TreeItem will be delivered. To listen to general events (for example mouse interactions), it is necessary to add the necessary listeners to the cells contained within the TreeView (by providing a cell factory)."
    Which gives a clear hint at the end that for other interactions, you should add listeners to the Cells.
    Good luck!

  • TextFormatter in list, table and tree cells

    Release 8u40 introduces the TextFormatter concept in the text input field area. It is currently a new property of the TextInputControl class.
    This is defintely a more elegant way to deal with validation than overriding "replaceText(...)".
    Shouldn't this property also be available in list, table and tree cells ?
    Are there plans to do this (before we make our own implementation) ?

    I've got exactly the same problem, +1.
    This shouldn't be to difficult to solve for 8u60 and definitely useful,
    giving access to the text input control in mutable cells could be a one-line workaround !
    Additionally, could a TextFormatter be made shareable between table/list rows
    by NOT using the value/valueConverter properties, but only the filter part in cases
    where the final desired output type is String ?

  • How do I reference a table in a cell so that when I type in a word, other cells in that row are automatically filled in?

    I'm making a cheat sheet for my fantasy football league. To this point I have separate sheets that list players at various positions (the sheets are characterized by the positions they cover i.e. quarterback/running back etc). I also have at the end a table that lists a team abbreviation (identical to how I would reference the team in the other sheets) with that team's bye week and schedule listed.
    I want to be able to type a team name next to a player's name and have that team's information be filled into the cells on the same row, by referencing that table I have at the end.
    Can anyone help? Very much appreciated. Thanks.

    Take a look at VLOOKUP in the iWork Formulas and Functions User Guide.
    You'll also find several discussions here on essentially the same question by searching for VLOOKUP. Also check the More Like This list to the right of these messages.
    Regards,
    Barry
    PS: The iWork Formulas and Functions User Guide may be downloaded via the Help menu in Numbers.
    B

  • How to sort/filter tables and lists like in Excel?

    Hi.
    I used to keep track of my expenses in Excel and had a nice table or list (I forget what it's officially called) with a header row where when I clicked on the header of a particular column it would let me sort and filter- for example, I have a column called "category" and I could click on the header for that column and select a filter so that I only saw travel expenses and then the sum below would only reflect how much I spent on travel. I could also click on the "date" column header and "sort ascending" to put everything in chronological order. That was awesome.
    I got a new mac and thought I could keep updating and using this file in Numbers and wouldn't have to buy MS Office. But when I opened the file and saved it as a numbers file, I find that I've lost the ability to sort or filter. The cell at the bottom that has the SUM still works but the header row does nothing. I've seen some other threads about this but I don't really understand them so please forgive me if this is repetitive. Someone suggested hovering the cursor over a column header and a triangle pops up- that is not happening- I think that's in an old version of Numbers. How can I do those things I listed above- sort and filter my entire table? Right now I can only see the total sum of everything in the table but I often need to just add up one category of expenses.
    I don't really know all the math stuff, like formulas. My brain has trouble following that stuff. It was so simple in Excel. Is there anyway to get my header row back to how it was in Excel? If not, if you are able to guide me through some more complicated way to do it I would really appreciate it and I hope I can follow it.
    Thank you for your time.
    -Rebs

    I want to understand how to make the sum cell only show the total of visible rows...
    I don't think you can do that directly.  SUM will include hidden rows. But you can use SUMIF and SUMIFS.
    An example using SUMIF:
    An example using SUMIFS:
    Instead of putting SUMIF and SUMIFS in a separate summary table, you could also put them in Footer Rows of your data table.
    SG

  • How create temporary table from list of values

    Can you anybody advise me how can I create temporary table from list of values? I have list of values and need create temporary table for next use with command JOIN etc.
    Thank you for help

    NO, you can not create temporary table in oracle on the fly ( Like #Tabels in SQl Server or Sybase ) , you will have to use the GTT i.e Global Temporary Tables
    check the following link GTT :
    to flush the tables after commit
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT DELETE ROWS;In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
    so to keep rows in Table after commit
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT PRESERVE ROWS;

  • How do you have the bottom stroke of a table show up using Table Styles and Cell Styles only?

    I am using InDesign CS6, and I want to create a Table Style that has the bottom stroke show up, but does not have a table border, such as:
    However, whenever I try to change the Table or Cell strokes so that the last stroke shows up, I get the entire table border, or some strange combination of borders:
    Does anyone have any insight on how I can get the bottom stroke to show up while preserving my other stroke properties? Since I work with long documents, it's necessary to be able to control all of my tables through Table Styles and Cell Styles, and not by manually changing each and every table with the Stroke palette.
    For reference, here are the my current Table Style properties and the resulting table:

    Michael Murphy is the InDesign style-meister. He wrote "Adobe InDesign Styles" for Adobe Press, and did a great Lynda.com title on InDesign styling. Here's what he says in the book:
    "As mentioned at the beginning of this chapter, with all the power of table and cell styles, it is important to understand not only how they work and what they can do for you, but also to understand their limitations.
    "Two formatting features missing in table and cell styles have already been discussed: You will always have to set the column width and row height of cells when applying a table style for the first time, and you will always have to convert body rows to header and/or footer rows every time you apply a table style for first time or update the table's data....
    "But there's another kind of limitation that's important to keep in mind as you are designing tables: It is very easy to design a table that cannot be completely defined by a table style. In many cases, you'll need to define an extra cell style or two that lets you complete for formatting. [my emphasis]."
    So I think that's what you have to do: Apply another cell style on top of the cells at the bottom of the table after applying the table style.

  • How do i set the background of the table( not of cell / row / column).

    How do i set the background of the table( not of cell / row / column).
    What happens when i load the applet the table is blank and displays the background color is gray which we want to be white.
    We tried using the setBackGround but it is not working maybe we are not using it properly. Any help would be gr8.
    Thanks in advance.

    I don't understand very well, but i guess that the background is gray when the table content's empty, isn't it?
    When the table model is empty, the JTable doesn't paint, so its container displays its background (often gray).
    In this case, what you must do is force the table to paint, even if the model is empty. So, you have to create your own table and override three methods :
    public class MyTable extends JTable
    //specify the preferred and minum size when empty
    myPreferredWidth = 200;
    myPreferredHeigth =200;
    myMinimunWidth = ...;
    myMinimunHeigth = ...;
    public Dimension getPreferredSize()
    if(getModel().getRowCount() < 1)
    return new Dimension(myPreferredWidth, myPreferredHeigth);
    else
    return super.getPreferredSize();
    public Dimension getMinimumSize()
    if( getModel().getRowCount() > 0)
    return new Dimension(myMinimunWidth, myMinimunHeigth);
    else
    return super.getMinimumSize();
    protected void paintComponent(Graphics g)
    if (getModel().getRowCount<1 && isOpaque()) { //paint background
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    else super.paintComponent(g);
    }

  • ListCellFactory - how to access an object's data associated with list cell?

    I am new to javafx and building a sample app to learn the basics. The app has a list view control and used listcellfactory to create listcells. Each list cell is composed of few labels and image. I populated list view with listViewItems function, where in it sends object[]; I have my own object with data that needs to be populated in the list cell. I have hard coded the object[] and that size is reflected in list view items size. However, I am not able to populate the object data in individual labels.
    In the following code, I can only get the string representation of the object and I am unable to figure out how to individually access the object's data. Please help me with this.
    function listCellFactory(): javafx.scene.control.ListCell {
    var listCell: javafx.scene.control.ListCell;
    def offerLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def descriptionLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def friendLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def offerImgView: javafx.scene.image.ImageView = javafx.scene.image.ImageView {
    image: imagetrial
    fitWidth: 300.0
    fitHeight: 250.0
    def offerVerticalBox: javafx.scene.layout.VBox = javafx.scene.layout.VBox {
    content: [ offerLbl, descriptionLbl, friendLbl, offerImgView, ]
    spacing: 6.0
    listCell = javafx.scene.control.ListCell {
    node: offerVerticalBox
    return listCell
    }

    If I understand you question, it should be (listCell.data as YourClassName)
    Edited by: AigarsP on Oct 21, 2010 2:10 PM

  • Power Pivot Slicer options not showing in the Pivot Table Field list

    Excel 2013. In all the tutorials I watch when you create a Pivot Table using Power Pivot there are Slicer options in the
    Pivot Table Fields list.  Slicer Horizontal, Slicer Vertical These do not show for me.   I see Filters, Value, Row, Column only.   Is there a setting I need to turn on?   When I click on PowerPivot
    at the top, the first icon on the bar is Manage Data model, not Powerpivot as I have seen on some of the youtube tutorials.   Thank you in advance.

    Thank you for trying but it's not what I am after.  I understand how to use Slicers with pivot tables.   My question relates to Pivot Tables created using PowerPivot.   Directly under the Pivot Fields list on the right is a section where
    you choose what you want to pivot  i.e  Filters, Values, Rows, Columns.   These are standard with any pivot table.  When I watch videos on PowerPivot there are 2 additional options in the section.  Slicer Vertical, Slicers Horizontal.
     The video comments  they only show in when creating a pivot table using PowerPivot.  These 2 options are not there for me.  I don't know why. It maybe the version of office I am using which is Microsoft Office Plus 2013. I'd like them
    included.  Appreciate you taking the time to help.  

  • Query on renderering list cell.

    Hi,
    How to render a list cell with an imageicon and icon at the same time thus, the cell is displayed in three parts, ImageIcon, Icon, String?
    I have written a list cell renderer as follows.
    class ProductListRenderer extends DefaultListCellRenderer {
    private ImageIcon icon = null;
    public ProductListRenderer(ImageIcon i) {
    super();
    this.icon = i;
    public Component getListCellRendererComponent(JList list,
    Object value,
    int index,
    boolean isSelected,
    boolean hasFocus) {
                   String productGroupName = "";
                   ColorSwatch cs = null;
                   if ( value instanceof ProductGroup )
                        ProductGroup productGroup = (ProductGroup)value;
                        productGroupName = productGroup.getName();
                        if( productGroup.getColor() != null )
                             cs = new ColorSwatch();
                             cs.setColor(productGroup.getColor());
                   }else
                        productGroupName = "unkown product";
    JLabel label = (JLabel) super.getListCellRendererComponent(list, productGroupName, index, isSelected, hasFocus);
                   if(cs != null)
                        label.setIcon(cs);
                   }else // use default
         label.setIcon(icon);
    return (label);
    }// end of getListCellRendererComponent
    }// end of ProductListRenderer
    In which, the label is used to render the list cell either by and image icon (icon) or by a customerized icon (cs), by the label.setIcon() method. How could I render the list with both the icon and cs?
    Thanks in advance for any ideas and inputs.
    Wing

    richardmd was correct when he/she said
    And you only need to create/layout the components upon instantiation,
    not every time you want to render itYou should not be doing all that work in the getListCellRendererComponent() method. This work should be done within your constructor.class ProductListRenderer extends DefaultListCellRenderer
      private JLabel icon1;
      private JLabel icon2;
      private JLabel text;
      public ProductListRenderer(ImageIcon i)
        super();
        // make the components
        icon1 = new JLabel(i);
        icon2 = new JLabel(anotherIcon);
        text = new JLabel("");
        // configure the listCellRenderer   
        setLayout(new FlowLayout());
        add(icon1);
        add(icon2);
        add(text);
      public Component getListCellRendererComponent(JList list,
                                                    Object value,
                                                    int index,
                                                    boolean isSelected,
                                                    boolean hasFocus)
        // configure the 3 JLabels
        // setText(), setForeground(), setIcon(), ect...
    }If you want to use the JPanel, which you were returning in your example, then do this:class ProductListRenderer extends JPanel implements ListCellRenderer
      // same idea as the above example
      public Component getListCellRendererComponent(JList list,
                                                    Object value,
                                                    int index,
                                                    boolean isSelected,
                                                    boolean hasFocus)
      { /* your code */ }

  • Is it planned to add feature for creating tables and lists in Adobe Edge Reflow?

    First of all, thank you very much guys for all your work!
    In my opinion Adobe Edge Reflow is missing quite important features, like creating tables and lists. For me it's a reason why I can't switch to Reflow. Any plans for implementing these? Is there any place where I can see the list of planned feature implementation? Didn't find it.

    Missing tables is a big one for me too, especially when doing data-grids. My last prototype was using multiple responsive data-grids where I used the simpler essential/optional hide column approach, instead of stacking or scrolling the data. I had used Reflow in the past for basic content prototypes... but had to do this one by hand... took longer. Using divs for this did not collapse properly in all the browsers, plus the back-end team use widgets that only generate tables. Here is the example:
    http://www.topwebworks.com/assets/test/prototype/riocompass_prototype_v1

  • Table sIngle Markable cell

    Hi friends,
    I got a task to find the X and Y coordinates of a table cell  using Table Single Markable cell.......
    Is it possible to get X,Y coordinates  using the above API.....
    Is there any alternative for this......
    please code me and help me....
    Thanks &Regards
    Shravan kumar

    Hi shravan..
    Go thru this link..
    https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDTableSingleMarkableCell.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9214b1e5-0601-0010-fdb0-ec32d43b06e0
    Urs GS...

  • How do I make the text in a List cell wrapover?

    The problem with the code below is that TextFormt does not support wordWrap which is supported by TextField(which, unfortunately has no effect on a List component).
    var lb = new TextFormat();
         lb.bold = true;
         lb.align = TextFieldAutoSize.
         lb.color = 0x000066;
    var sqsL:List = new List();
         sqsL.rowHeight = 44;
         sqsL.setSize(204.8,176);
         sqsL.setRendererStyle("textFormat", lb);

    Here is a solution. The key to the solution is the class MutliLineCell which extends the CellRenderer.
    //Main.as : Main classs
    package{
        import fl.controls.List;
        import fl.core.UIComponent;
        import flash.display.Sprite;
        public class Main extends Sprite{
                private var sqsL:List
                  public function Main(){
                          var longText;string = "This text is too long to fit in a List cell. A class, MultiLineCell class as been created to wrap it"
                          sqsL = new List();
                          sqsL.rowHeight = 44;
                          sqsL.setSize(200,176)
                          sqsL.setStyle('cellRenderer',MultiLineCell)
                          addChild(sqsL);
                          sqsL.addItem(longText);
    //The MultiLine cell renderer
    package {
        import fl.controls.listClasses.CellRenderer;
        public class MultiLineCell extends CellRenderer  {
              public function MultiLineCell(){
                  textField.wordWrap = true;
                  textField.autoSize = "left";
              override protected function drawLayout():void {           
                  textField.width = this.width;
                  super.drawLayout();

  • Nested Repeat Region (How to convert from table to list)

    Sorry, i am really no PHP hero :-(
    i created a menu with the "nested repeat region" wizzard. Now i want to change the HTML from TABLE to LIST.
    I thought i just need to delete <table>- and <td>-tags, replace <tr> with <ul> and that's it. (But ist's NOT!)
    This is my code:
    ------- START ----------------
    <ul id="nav">
          <?php do { ?>      
              <li><?php echo $row_master1waa_page_top['top_name']; ?></li>
            <?php
      if ($totalRows_master1waa_page_top>0) {
        $nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);
        mysql_select_db($database_WAA);
        $detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());
        $row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);
        $totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);
        $nested_sw = false;
        if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) {
          do { //Nested repeat
    ?>
              <ul>
                <li>  <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>
              </ul>
              <?php
          } while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next
    ?>
            <?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>
    </ul>  
    ------- END -----
    The problem is located in line 3. the result is a list like this:
    <ul id="nav">
         <li>xxx</li>
         <li>xxx</li>
              <ul>
                    <li>xxx</li>
                    <li>xxx</li>
              </ul>
         <li>xxx</li>
    </ul>
    Of course it will not work. I need the nested list inserted like this:
    <ul id="nav">
         <li>xxx</li>
         <li>xxx
              <ul>
                    <li>xxx</li>
                    <li>xxx</li>
              </ul>
          </li>
         <li>xxx</li>
    </ul>
    Can someone please help me changing my code to get this result?

    Hi,
    I had trouble replying. I may be of some assistance until one of the Guru's get on.
    The whole thing works on loops based inside do and while
    EX.
    <?php
              do{    //end php, use html
    ?>
    I can repeat anthing here in HTML!
    <?php } while ( /* some critera exist ex: i<5 */      ); ?>
    so, your 'options' tag or LI' tags should only exist inside the first loop, check your { }
    The entire LIST  would repeat if you add the UL tags inside the nested loop area
    You may find it easier to reaplace the table with div tags and then indent the sub or nested loop with a class
    I don't have time to test this but try this:
    <ul id="nav">
    <ul>
    <?php do { ?>      
      <li><?php echo $row_master1waa_page_top['top_name']; ?></li>
    <?php
      if ($totalRows_master1waa_page_top>0) {
        $nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);
        mysql_select_db($database_WAA);
        $detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());
        $row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);
        $totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);
        $nested_sw = false;
        if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) { ?>
       <ul>
      <?php  do { //Nested repeat ?>   
                   <li>  <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>
            <?php } while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next ?>
        </ul>
    <?php 
    ?>
            <?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>
    </ul>
    Hit me back if its close but wonky..
    J

Maybe you are looking for

  • I unregistered my phone number with my apple id and now i need to register it back

    I went from an iPhone 4 to a Samsung Galaxy s4.  When I made the switch I was unable to receive text messages from iPhone users, so I "unregistered" my phone number from my apple id.  I also called tech support and they had to remove the license from

  • How to have dynamic number of items uploaded using LSMW

    Hello Experts, I have a requirement where i need to upload the data for quality notifications. One Quality notification can have any number of items. i.e. One Quality notification can have 3 items and the other can have 2. I have got an excel sheet c

  • Where are the Palm Desktop executable​/settings stored?

    Palm Desktop 4.1.4E on Treo 650  Had to re-load from website, and now it wants me to start over.  If possible, I would like to populate the desktop with my previous settings. Thank you Post relates to: Treo 650 (Cingular)

  • CDI-23564 error when generating FORM.

    Hi, After installing Designer 6.0 and Patchset 1 (6.0.3.5) ,when generating FORM , system always prompt that it could not load CFG60.DLL. Had check that CFG60.DLL exists in orant/BIN and also in Window registry. Reformatted hard disk, change hard dis

  • Control which events are synced with iPad?

    I have iCloud set up on my Mac/iPad, and it is successfully syncing my calendar events. However, I don't want minor recurring events that I have on my Mac calendar to be popping up alarms and cluttering up the calendar on my iPad. How do I control wh