How to resize listbox's cell Height dynamically?

How to resize listbox's cell Height dynamically?<br /><br />// .fr<br /><br />Class<br />{<br />kMPSListBoxWidgetBoss,               <br />kWidgetListBoxWidgetNewBoss,<br />{<br />...............<br />}     <br />},<br />type MPSListBoxWidget( kViewRsrcType )      : WidgetListBoxWidgetN     <br />(ClassID = kMPSListBoxWidgetBoss)<br />{};<br /><br />MPSListBoxWidget<br />(<br />                                   kMPSEditScrapListCtrlWidgetID + 1,<br />     kSysOwnerDrawListBoxPMRsrcId,<br />     kBindAll,// Frame binding<br />     Frame( 0, 1, 304, 278 )          // Frame<br />     kTrue, kTrue,<br />     1, 0,<br />     150,     // cellheight<br />     0,          // borderwidth<br />     kFalse, kTrue,<br />     kTrue,<br />     kTrue,<br />     kTrue,<br />     kFalse,<br />     kTrue,<br />     kFalse,<br />     0<br />     {<br />       CellPanelWidget<br />      (<br />                 kCellPanelWidgetID, kPMRsrcID_None,<br />          kBindAll,// Frame binding<br />          Frame( 0, 0, 304, 278 )          // Frame<br />          kTrue, kTrue// Visible, Enabled<br />          {<br /><br />          }<br />       )                              <br />}<br /><br />),<br /><br />I am trying to rezie listbox's cell height with InterfacePtr<IListBoxAttributes>. but it doesn't work! Please help!!<br />//     <br /><br />InterfacePtr<IListBoxAttributes> iListBoxAttr(listBox,IID_ILISTBOXATTRIBUTES);<br />if ( iListBoxAttr )<br />{<br />     PMReal rCellHeight          = IMAGEITEM_HEIGHT;<br />        iListBoxAttr->SetCellHeight( rCellHeight );<br />}          .

ListBox is deprecated, use TreeView.
When do you change that attribute, is the listbox already showing and populated with cells?
It could be you're just missing an Invalidate(), but probably you have to clear and rebuild the whole listbox (content). Additionally, do you adjust the size of the cell widgets?
Dirk

Similar Messages

  • How do I resize a single cell in a TableView?

    So I have a tableview, and when a user selects it, I would like to resize that particular cell.
    I have all my code in place in terms of drawing that particular cell when selected, but my only problem is I can't seem to figure out how to resize a single cell. For example, if all my cells have a height of 40, I want the selected cell to have a height of 80. I have tried setFrame, I have tried initWithFrame when creating the cell. I figure I'm missing something pretty simple, but I don't see anything as simple as [cell setHeight] or something like that.
    thanks!

    What Rick says will work. I have done it. In some cases you may need to set the needsDisplay and or needsLayout properties on your custom cell if you have one.

  • Excel 2007. OLAP pivot. How do you resize dropdown width and height?

    Excel 2007. OLAP pivot. How do you resize dropdown width and height?

    hi,
    I'm afraid we can't modify that property in Excel. Someone had suggested to use a custom combo box to replace the built-in drop-down. However it will lose the features which are only available
    for built-in drop-down.
    Hope this
    thread will give you some ideas. Thank you.

  • HT4642 ios numbers:how to make cell height variable with auto line brake setting ?

    ipad numbers; How to make cell height variable with auto line break setting?

    That's strange. I responded earlier and the whole message got trashed. Hence the test post before retyping the entire thing again.
    Thanks for the reply.
    The video clip is a single screen capture video clip. This is what I've found by playing around with this more.
    The original clip resolution is greater than 640x480. If I use QT Pro to convert the original clip to 640x480 and then use either Flip4Mac or PE7, then the resolution looks good.
    Just trying to figure out if should keep all workflow on the MacOS side. There are several different version of Flip4Mac. $49 gives me 640x480, but if I ever want to make it slightly larger then I would need to go with the $99 or HD version.
    I also tried to export to AVI with QT Pro and the import with Windows MovieMaker but it didn't work really good. I liked the simplicity (since PE7 hogs a lot of resources especially through VMWare).

  • How to resize the calendar height and width

    Hi,
    how to re size the calendar height and width...
    Ie i need to fix this calendar region  7 cross 4 format in my page
    Regards,
    Pavan

    If the text exceeds the container, which can happen in a scrollable container where you have to scroll to see some of the text, then the values getContentBounds returns are estimated values. This is because we don't want to force the text to recompose all the way to the end of a very long TextFlow in order to return a value. However, if you want to get the exact amount, and don't mind taking the time to recompose, call textFlow.flowComposer.composeToPosition(), before calling getContentBounds. This forces all the text to recompose to the end, and then getContentBounds will return the fully calculated value instead of estimating.

  • How to specify height dynamically for each showDetailItem

    Hi,
    I'm using JDeveloper 11.1.1.6 version.
    I have the following requirement:
    I have a create page with one <af:region>.
    The <af:region> displays a page with <af:PanelTabbed> component having 4 <af:showdetailItem> components.
    For each tab I would like to specify the height dynamically based on the content of the tab.
    Any pointers would be helpful.
    Thanks
    Ravi

    Hi,
    actually its the parent component (panelTab) that determines the size
    To quote from http://docs.oracle.com/cd/E23943_01/apirefs.1111/e12419/tagdoc/af_showDetailItem.html
    Geometry Management
    This component should never have any width or height specified in its inlineStyle because it will always gets its dimensions from its ancestor component.
    Frank

  • How to resize movie clip dynamically

    how to resize movie clip sccording the stage size and width

    how to resize movie clip sccording the stage size and width

  • How to resize display image item?

    How to resize an image in display image item not in column?
    I find a way to resize it in column which similar to this way
    decode(nvl(dbms_lob.getlength(PLAYER_PIC),0),0,null,
    '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius:
    4px;" '||
    'src="'||
    apex_util.get_blob_file_src('P5_PLAYER_PIC',ROWID)||
    '" height="75" width="75" alt="Player Image" title="Player Image" />')
    detail_img
    but when I try to implement it to display image item which I returned the image from the column, I cant resize it this way, or may be I used wrong syntax, can you please help me finding way to resize it with steps?

    I guess it is because of some carriage returns in your dynamic img tag that is being generated may be not, so make sure there are no breaks half-way through he attributes of the img tag.
    decode(nvl(dbms_lob.getlength(PLAYER_PIC),0),0,null, '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '|| 'src="'|| apex_util.get_blob_file_src('P5_PLAYER_PIC',ROWID)|| '" height="75" width="75" alt="Player Image" title="Player Image" />')  detail_imgand also inspect the element/img to see if the code is rendered correctly
    Thanks

  • To color selected cells in dynamically created table in ALV.

    Hi,
           The requirement is to display a table (whose columns are dynamic) using ALV n to color few cells of the table based on some condition.
    For creating the table dynamically i have used the method cl_alv_table_create=>create_dynamic_table.
    Now for coloring the cells i tried to use the field EMPHASIZE .
    But when I try this method the whole column is getting colored.
    So any suggestions on how to color only particular cells.

    Hi,
    Try this one...
    DATA: gs_layout TYPE slis_layout_alv, "Define layout
    gt_color TYPE lvc_t_scol WITH HEADER LINE. "Define Internal Table for Cell Colouring
    Use below Sample Code after building a Field Catalog:
    gs_layout-coltab_fieldname = 'COLINFO'.
    " 'it' is the final internal table which contain positive & negative value of Field 'MENGE'
    LOOP AT it.
    REFRESH gt_color.
    CLEAR gt_color.
    IF it-menge GE 0.
    CLEAR gt_color.
    gt_color-fname = 'MENGE'.
    gt_color-color-col = cl_gui_resources=>list_col_positive.
    gt_color-color-int = 0.
    APPEND gt_color.
    ELSEIF it-menge LE 0.
    CLEAR gt_color.
    gt_color-fname = 'MENGE'.
    gt_color-color-col = cl_gui_resources=>list_col_negative.
    gt_color-color-int = 0.
    APPEND gt_color.
    ENDIF.
    it-colinfo[] = gt_color[].
    MODIFY it.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = g_repid
    is_layout = gs_layout
    it_fieldcat = ct_fieldcat
    i_save = 'A'
    TABLES
    t_outtab = it
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    Hope this solves your problem.
    Regards,
    Tarun

  • How do I select a cell in a multicolum​n list box and use scroll horizontal on th

    From an event structure, how do I select a cell in a multicolumn list box and use scroll horizontal on the front panel at the same time.  I can select a cell from the multicolumn in an event structure, but I cannot move the scroll bar on the front panel when the program is running.
    Solved!
    Go to Solution.

    I'm assuming you're referring to the scrollbar in the multicolumn listbox. What is your code doing when you select a cell? Can you please post your code so we can see the behavior you're describing? It's possible that you're blocking the event structure, as in performing some long operation in the event that's handling the cell selection. In this case the event structure has to wait until the event completes before being able to respond to the next event. You can configure the event to not lock the front panel while waiting for the event to complete.

  • How to resize image in JSP using JAI ??!!

    Please help me how to resize an JPEG image from my JSP, could I use JAI lib ? how ?

    Hello,
    I had the same problem few months ago ( in that case i used Jimi instead of JAI).
    The answer to your question is: use the java class called "Image".
    Infact you can use JAI just for load or save to disk your image that you have to resize and then use the following code to resize the image :
    Image imgResized = img.getScaledInstance(100,1,Image.SCALE_AREA_AVERAGING);
    The object "img" is the image to resize and the object "imgResized" is the image resized with width equals to 100 and with a right height.
    I used Jimi just to save my image and i think that with JAI there is a method to do this.
    You can use JAI to load in memory your image too so you can avoid problem with MediaTraker class.
    I hope that this can help you.
    Cheers.
    Stefano

  • JList Cell Height Problem

    I am trying to use a customer cell renderer for a JList. It sort of works, but my cell heights are incorrect because when a cell is selected the JPanel returned from my cell renderer need more space to paint on than an unselected list item.
    Sample code below demontrates the problem - use it as the cell renderer for something and make some selections - you can see that when the text is enlarged when the cell is selected, it is not resized to accommodate the larger text.
    I've tried various combinations of setSize, revalidate etc at various points but nothing helps...
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TestListCellRenderer extends JPanel implements ListCellRenderer {
         JLabel l;
         public TestListCellRenderer() {
              setLayout( new BorderLayout() );
              l = new JLabel( );
              setBorder( BorderFactory.createLineBorder( Color.BLACK ) );
              add( l, BorderLayout.NORTH );
         public Component getListCellRendererComponent(
                   JList list,
                   Object value,
                   int index,
                   boolean isSelected,
                   boolean hasFocus ) {
              if( isSelected == false ) {
                   l.setText( value.toString() );
                   l.setFont( new Font( "Serif", Font.BOLD, 12 ) );
              else {
                   l.setText( value.toString() );
                   l.setFont( new Font( "Serif", Font.BOLD, 18 ) );
              return this;
    }

    I came across this thread when I was having a similar problem. I have found a way to get it to work.
    My problem was this: I have a list of news headlines. When I increased the font size of the items in my list I needed to increase the height of each cell in the list so that the headline wouldn't get cut off top and bottom by the restrictive height of the list cell.
    Solution is to use setFixedCellHeight(int height) from the JList class.
    In my case I find set the fixed cell height in 3 places.
    the constructor - when the list is being created
    the cell renderer method - when the list is being rendered
    in an action listener method - to act when a user changes the size of the font.
    The code excerpt below is a chopped down version of the working code but gives you an idea.
    public class NewsWindow implements ListSelectionListener {
         /** Component which holds the headlines */
         public JList list;
         public NewsWindow(Container parent, WindowProperties properties) {
              DefaultListModel listModel = new DefaultListModel();
              list = new JList(listModel);
              list.setCellRenderer(new HeadlineCellRenderer());
              bounceListCellHeight(); // set the correct list cell height up front
         /** when the font size has changed this method is eventually called via a super class */
         public void fontSizeHasChangedListener() {         
         bounceListCellHeight();
         /** THIS METHOD SETS THE HEIGHT OF THE LIST CELLS */     
         public void bounceListCellHeight() {
              int height = getFontMetrics(getNewsFont()).getHeight(); // get the height of the font
              list.setFixedCellHeight(height + 10); // set the cell height
         * Inner class to render the list.
         private class HeadlineCellRenderer extends JLabel implements ListCellRenderer {
              public HeadlineCellRenderer() {
              setOpaque(true);
              public Component getListCellRendererComponent(JList myList, Object value, int index, boolean isSelected, boolean cellHasFocus) {
              bounceListCellHeight(); // call the method to set the list cell height
              setText(getHeadlineText());
              this.revalidate();
              setFont(getNewsFont());
              return this;
    Hope this is of some help.

  • Table cell height not correct

    I have a table with 21 rows. Every other row is used as a separator between the rows with content. These separator rows don't have anything in them and their height is set to 1 in the properties inspector. I'm assuming these heights and widths are in pixels, however, these rows don't appear to be 1px in design view nor on a live web page.They are more like 15px.
    How can I make these rows 1px in height?

    That site has badly malformed code.
    http://tinyurl.com/36z7sc8
    I'm guessing it's cobbled togather from various bits and pieces including the ChronoForm code?
    Regarding the cell heights, the code of a typical cell is:
    <td width="95" height="1"> </td>
    The code between the <td> tags  (known as a non-breaking space) is a space character (pressing the spacebar on your keyboard generates this code in the HTML).
    Removing the space from the code for each <td> will cause your cells to collapse. You may need to prop them open with a 1px high GIF as Murray suggested.

  • Individual cell heights in JList

    hi!
    i'm trying to write a cellrenderer for a JList, which can show different cell heights.
    i.e. in unselected mode, i only want to show a name of a person; in selected mode, i want do show the name of the person AND some other details in the same cell (like the "add and remove programs"-dialog of Windows XP when you select a program to uninstall (it shows then some information about usage etc.))
    if(!isSelected) {
        /* Not selected */
        setPreferredSize(new Dimension(0,25));
        setBackground(Color.BLUE);
    } else {
        /* Selected: */
        setPreferredSize(new Dimension(0,45));
        setBackground(Color.RED);                      
    }i tried this code in the getListCellRendererComponent(...)-method, but the JList only uses the first size (25) ... i tried to set the JList-propertie fixedCellHeight to -1, but no changes....
    does anybody know how i can solve my problem?
    thx a lot & greetz
    swissManu

    thank you for your hints! ... i think i will take some time to develop a Model for my DetailList....
    if you like, you can use my improved code.... here it is:
    here is the mainpart, the DetailList.java
    * Created on 02.12.2004
    package detaillist;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Insets;
    import java.awt.LayoutManager;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.Vector;
    import javax.swing.JPanel;
    * Die Items einer DetailList k�nnen per Klick "aufgeklappt" werden und zeigen
    * anschliessend weitere Deteils zum entsprechenden Item.<br>
    * Um eigene DetailListItem's mit eigener Darstellung zu erstellen kann einfach
    * eine Klasse welche von DetailListItem ableitet erstellt werden.<br>
    * <br>
    * hoverSelection:<br>
    * Mit setHoverSelection(true) wird der Hover-Modus aktiviert. Der Benutzer muss
    * anschliessend nur noch �ber Items mit der Maus fahren um diese aufzuklappen.<br>
    * <br>
    * multiSelection:<br>
    * Per setMultiSelection(true) wird dem Benutzer erm�glicht, mehrere Items auf
    * einmal aufzuklappen.<br>
    * <br>
    * ACHTUNG! hoverSelection & multiSelection k�nnen nicht gleichzeitig aktiviert
    *          sein!
    * @author Manuel Alabor; adapted from Pierre LE LANNIC (weebib)
    * @version 1.1
    public class DetailList extends JPanel {
        /* Eigenschaften: */
        private boolean hoverSelection = false;
        private boolean multiSelection = false;
        /* Objekte: */
        private Vector selectedItems;
        private ItemSelectionListener itemListener;
        public DetailList() {
              super(new ListLayout());
            setOpaque(true);
              setBackground(Color.WHITE);
              itemListener = new ItemSelectionListener();
              selectedItems = new Vector();
         * Setzt das markierte Item und klappt das betreffende auf bzw. zu.<br>
         * Wird ein aufgeklapptes Item nochmals angeklickt, wird dieses zugeklappt.<br>
         * <br>
         * Ist multiSelection == true, so k�nnen mehrere Items auf einmal aufge-
         * klappt sein. Falls multiSelection == false, so wird das bereits offene
         * Item geschlossen.
         * @param item
         private synchronized void setSelectedItem(DetailListItem item) {
              if (item == null) return;
              /* Offenes Item bei erneutem Klick schliessen: */
              // Offenes Item schliessen und aus der selectedItems-Liste entfernen.
              for (int i = 0; i < selectedItems.size(); i++) {
                  DetailListItem selItem = (DetailListItem)selectedItems.get(i);
                  if(item == selItem) {
                      if(item.isExpanded()) {
                          item.setExpanded(false);
                          selectedItems.remove(i);
                          System.out.println(selectedItems.size());
                          return;
              /* Ausgeklappte Items zuklappen wenn ein anderes gew�hlt wurde: */
              // Wenn nicht mehrere offene Items erlaubt sind (!multiSelection),
              // werden hier alle anderen Items zugeklappt (falls vorhanden)
              if(selectedItems.size() > 0 && !multiSelection) {
                  for (int i = 0; i < selectedItems.size(); i++) {
                      DetailListItem tmpItem = (DetailListItem)selectedItems.get(i);
                      if(item != tmpItem) {
                          tmpItem.setExpanded(false);
                          selectedItems.remove(i);
              /* Geklicktes Item ausklappen: */
              item.setExpanded(true);
              selectedItems.add(item);
              System.out.println(selectedItems.size());
          * F�gt dieser DetailList ein neues DetailListItem hinzu.<br>
          * Es wird dem neuen Item automatisch der ItemSelectionListener dieser
          * DetailList zugewiesen.
          * @param newItem
         public void addItem(DetailListItem newItem) {
             newItem.addMouseListener(itemListener);
             add(newItem);
              revalidate();
              repaint();
         /* Anonyme Klassen: */
          * Diese anonyme Klasse fungiert als Klick-Listener f�r die DetailListItem's
          * dieser DetailList.
          * @author Manuel Alabor
         private class ItemSelectionListener extends MouseAdapter {
              public void mouseClicked(MouseEvent e) {
                   Object o = e.getSource();
                   if(!hoverSelection) {
                        if (o instanceof DetailListItem) {
                             setSelectedItem((DetailListItem)o);
             * Erm�glicht einen "Hover"-Effekt welche bewirkt dass ein Item auf-
             * geklappt wird sobald sich der Mauszeiger dar�ber befindet.<br>
             * Ist multiSelection aktiv, wird hier nichts unternommen, auch wenn
             * hoverSelection aktiviert ist.
              public void mouseEntered(MouseEvent e) {
                   if(hoverSelection && !multiSelection) {
                      Object o = e.getSource();
                        if (o instanceof DetailListItem) {
                            // Wenn ein Item offen ist, soll dieses nicht zugeklappt
                            // werden wenn der Benutzer erneut mit dem Cursor auf das
                            // Item f�hrt.
                            if(selectedItems.size() == 1) {
                                if(selectedItems.get(0) != o) {
                                    setSelectedItem((DetailListItem)o);
                             } else {
                                 setSelectedItem((DetailListItem)o);
          * Dieser LayoutManager wird benutzt um alle DetailListItems in einer Listen-
          * Anordnung anzuzeigen.
          * @author Manuel Alabor
         private static class ListLayout implements LayoutManager {
              public void removeLayoutComponent(Component comp) {}
              public void addLayoutComponent(String name, Component comp) {}
              public void layoutContainer(Container target) {
                   synchronized (target.getTreeLock()) {
                        Insets insets = target.getInsets();
                        int nmembers = target.getComponentCount();
                        int x = insets.left;
                        int y = insets.top;
                        for (int i = 0; i < nmembers; i++) {
                             Component m = target.getComponent(i);
                             if (m.isVisible()) {
                                  Dimension d = m.getPreferredSize();
                                  m.setBounds(x, y, target.getWidth(), d.height);
                                  y += d.height;
              public Dimension preferredLayoutSize(Container target) {
                   synchronized (target.getTreeLock()) {
                        Dimension dim = new Dimension(0, 0);
                        int nmembers = target.getComponentCount();
                        for (int i = 0; i < nmembers; i++) {
                             Component m = target.getComponent(i);
                             if (m.isVisible()) {
                                  Dimension d = m.getPreferredSize();
                                  dim.height += d.height;
                                  dim.width = Math.max(dim.width, d.width);
                        Insets insets = target.getInsets();
                        dim.width += insets.left + insets.right;
                        dim.height += insets.top + insets.bottom;
                        return dim;
              public Dimension minimumLayoutSize(Container target) {
                   synchronized (target.getTreeLock()) {
                        Dimension dim = new Dimension(0, 0);
                        int nmembers = target.getComponentCount();
                        for (int i = 0; i < nmembers; i++) {
                             Component m = target.getComponent(i);
                             if (m.isVisible()) {
                                  Dimension d = m.getMinimumSize();
                                  dim.height += d.height;
                                  dim.width = Math.max(dim.width, d.width);
                        Insets insets = target.getInsets();
                        dim.width += insets.left + insets.right;
                        dim.height += insets.top + insets.bottom;
                        return dim;
         /* Getter- & Setter-Methoden: */
        public boolean isHoverSelection() {
            return hoverSelection;
        public void setHoverSelection(boolean hoverSelection) {
            multiSelection = false;
            this.hoverSelection = hoverSelection;
        public boolean isMultiSelection() {
            return hoverSelection;
        public void setMultiSelection(boolean multiSelection) {
            hoverSelection = false;
            this.multiSelection = multiSelection;
    }this is the DetailListItem.java ... the prototype for individual items:
    * Created on 02.12.2004
    package detaillist;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import javax.swing.BorderFactory;
    import javax.swing.Box;
    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    * Ein Standart-Item f�r DetailList.<br>
    * Um eigene Items zu realisieren kann ganz einfach von dieser Klasse abgleitet
    * werden und anschliessend das Item individualisiert werden. (Beispiel siehe
    * DetailListAdressItem)
    * @author Manuel Alabor
    * @version 1.0
    * @see detaillist.DetailListAdressItem
    public abstract class DetailListItem extends JPanel {
        /* Components: */
        protected JLabel lblTitle;
        protected JPanel details;
        private Component margin;
        /* Eigenschaften: */
        protected boolean expanded = false;
        protected int unexpandedHeight = 18;
         * Standart-Konstruktor mit Angabe f�r den Titel sowie ein Symbol.
         * @param text
         * @param icon
        public DetailListItem(String title, String icon) {
            super(new BorderLayout());
            /* Item anpassen: */
            setOpaque(true);
            /* Titel initialisieren: */
            lblTitle = new JLabel(title);
            if(!icon.equals("")) {
                lblTitle.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(icon)));
            /* details-Panel initialisieren & vorbereiten: */
            details = new JPanel();
            margin = Box.createHorizontalStrut(10);
            /* Components anordnen: */
            add(lblTitle, BorderLayout.NORTH);
            add(margin, BorderLayout.WEST);
            add(details, BorderLayout.CENTER);
            update();
         * Verk�rzter Konstruktor ohne angabe f�r ein Symbol.
         * @param text
        public DetailListItem(String text) {
            this(text, "");
         * Klappt das Item entweder auf oder zu.
         private void update() {
              margin.setVisible(expanded);
              details.setVisible(expanded);
              if (expanded) {
                   setBackground(Color.LIGHT_GRAY);
                   setBorder(BorderFactory.createLineBorder(Color.BLACK));
              } else {
                   setBackground(Color.WHITE);
                   setBorder(BorderFactory.createLineBorder(Color.WHITE));
              this.revalidate();
              this.repaint();
          * Im zugeklappten Zustand sollte per unexpandedHeight-Variabel die H�he des
          * Items definiert werden, da es ansonsten jenachdem zu unsch�nen Effekten
          * kommen kann.<br>
          * F�r ein normales Item betr�gt die "Standarth�he" 18pixel.
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            /* H�he: */
            // Wenn das Item nicht ausgeklappt ist, unexpandedHeight als h�he
            // nehmen:
            if(!expanded) {
                dim.height = unexpandedHeight;
            return dim;
        /* Getter- & Setter-Methoden: */
        public String getTitle() {
            return lblTitle.getText();
        public void setTitle(String text) {
            lblTitle.setText(text);
        public boolean isExpanded() {
            return expanded;
        public void setExpanded(boolean expanded) {
            this.expanded = expanded;
            update();
    }here my first basic sample for a item:
    * Created on 02.12.2004
    package detaillist;
    import java.awt.Font;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import com.jgoodies.forms.factories.Borders;
    import com.jgoodies.forms.layout.CellConstraints;
    import com.jgoodies.forms.layout.FormLayout;
    * Ein DetailListItem mit Texteingabe-Feld
    * @author Manuel Alabor
    * @version 1.0
    public class DetailListTextItem extends DetailListItem {
        /* Components: */
        private JTextArea txtText;
         * Standartkonstruktor.
         * @param text
         * @param name
         * @param adress
         * @param email
         * @param photo
        public DetailListTextItem(String title, String icon, String text) {
            super(title, icon);
            unexpandedHeight = 20;  // H�he in zugeklapptem Modus festlegen
            /* lblTitle anpassen: */
            lblTitle.setFont(new Font("Tahoma",Font.BOLD + Font.ITALIC,11));
            lblTitle.setBorder(Borders.createEmptyBorder("1dlu,1dlu,1dlu,1dlu"));
            /* Werte �bernehmen: */
            txtText = new JTextArea(text);
            /* FormLayout f�r details erstellen: */
            details.setLayout(new FormLayout("d:g", "f:30dlu:g"));
            CellConstraints cc = new CellConstraints();
            /* Components hinzuf�gen: */
            details.setBorder(Borders.DLU2_BORDER);
            details.add(new JScrollPane(txtText), cc.xy(1,1));
    }and here a testapp:
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import detaillist.DetailList;
    import detaillist.DetailListItem;
    import detaillist.DetailListTextItem;
    * Created on 02.12.2004
    * @author Manuel Alabor
    public class DetailListTest {
        public static void main(String[] args) {
            JFrame frame = new JFrame();
            JPanel contentPane = (JPanel)frame.getContentPane();
            contentPane.setLayout(new BorderLayout());
            final DetailList list = new DetailList();
            contentPane.add(new JScrollPane(list), BorderLayout.CENTER);
            JButton btnAdd = new JButton("Add Textitem...");
            btnAdd.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent arg0) {
                     DetailListItem item = new DetailListTextItem("Text-Item", "small_gear.png", "Dies ist ein Testitem");
                     list.addItem(item);
            contentPane.add(btnAdd, BorderLayout.SOUTH);
            JPanel options = new JPanel(new BorderLayout());
            final JCheckBox chkHover = new JCheckBox("HoverSelection");
            final JCheckBox chkMulSel = new JCheckBox("MultiSelection");
            chkHover.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    list.setHoverSelection(chkHover.getModel().isSelected());
                    chkMulSel.getModel().setSelected(false);
            options.add(chkHover, BorderLayout.NORTH);
            chkMulSel.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    chkHover.getModel().setSelected(false);
                    list.setMultiSelection(chkMulSel.getModel().isSelected());
            options.add(chkMulSel, BorderLayout.SOUTH);
            contentPane.add(options, BorderLayout.NORTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(262,250);
            frame.setLocation(200,200);
            frame.show();
    }hope you like it :)

  • How to resize media's visual component resolution

    Hello dear:
    How to resize visual component resolution?
    example:
    I have a movie,this movie's resolution is 800*600dpi,I want this movie's visual component is 600*520.
    Thanks

    public Dimension getPreferredSize() {
                   int w = 0, h = 0;
                   if (vc != null) {
                        Dimension size = vc.getPreferredSize();
                        w = size.width;
                        h = size.height;
                   if (cc != null) {
                        Dimension size = cc.getPreferredSize();
                        if (w == 0)
                             w = size.width;
                        h += size.height;
                   if (w < 160)
                        w = 160;
                   return new Dimension(w, h);
    these codes can't change movie's aspect ratio,eg one movie resolution is 600*500,I can't change this movie resolution to 400*400 on playing. The Transcode.java is chanage the movie file resolution, not my expect.
    I wish the one movie resolution is 600*500,this movie full window in the JPanel that resolution is 400*400.

Maybe you are looking for

  • How to use iBook with projector

    Hello. I have a 12" iBook G4. I might be needing to use a projector with it in the near future and I'm not an expert on projector connections and stuff like that. I know my iBook has a video-out and I have the adapter which connects a video cable to

  • Please can someone help me out?????

    I have just got an iphone 3Gs and I am trying yo install itunes 9.2. I have downloaded it from apple but everytime I try to open it I get this message, Apple application support was not found. Apple application support is required to run itunes, plea

  • Menubar submenu centering problems

    I just downloaded the spry widgets today to use the menubar in a webpage. I need the menu items to be centered but the submenus to be on the left. Unfortunately while it works in Firefox it does not work in IE7. In IE the menu items on top are center

  • How to upload Images in Forms 6i

    Dear all, How to upload images in Forms 6i and save it in database. Please anyone help me with example. Thanking you Shekhar

  • Dump with Message "ASSIGN_CAST_WRONG_LENGTH"

    Hi, I have this code where in i am trying to get the Changes log to a report DATA : OFFSET TYPE C. FIELD-SYMBOLS <F_NEW> TYPE ANY. FIELD-SYMBOLS <F_OLD> TYPE ANY. ASSIGN YPLABMSR+OFFSET(IT_TABINFO-INTLEN)   TO <F_NEW> TYPE IT_TABINFO-INTTYPE. ASSIGN