How to make table cell have certain width

Hi
i have 3 cells when i write text in any cell it effects the
width of other cells !!!
how to make every cell have certain? i mean i want to wrap
the text not to effect the cell width
thanks in advance.

Hi Mac,
Try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML><HEAD><TITLE>Home</TITLE>
<META http-equiv=Content-Type content="text/html;
charset=iso-8859-1">
<style>
.text-content-green {
FONT-SIZE: 11px;
COLOR: #a5a834;
LINE-HEIGHT: 20px;
FONT-STYLE: normal;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
TEXT-DECORATION: none;
.text-content-green:hover {
FONT-SIZE: 11px;
COLOR: #AE0B0B;
LINE-HEIGHT: 20px;
FONT-STYLE: normal;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
TEXT-DECORATION:underline;
.margin {
margin: 1px 1px 1px 1px;
border-style: solid;
border-top-width: 1px;
border-left-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-color: gainsboro;
</style
</HEAD>
<BODY topmargin="10px" leftmargin="0" rightmargin="0"
class="body-style">
<TABLE width="729" border="0" cellpadding="0"
cellspacing="0" cellsadding="0" align="center" class="margin">
<TBODY>
<TR>
<TD width="125" valign="top" bgcolor="#f0f0c1">
<table width="125" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="25" height="25" align="middle"></td>
<td width="108" class="text-content-green"><A
class="text-content-green" href="default.html">LEFT
NAV</A></td>
</tr>
<tr>
<td colspan="2" align="middle"></td>
</tr>
<tr>
<td width="25" height="25" align="middle"></td>
<td width="108" class="text-content-green"></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
</table>
</TD>
<TD vAlign=top width=539 bgColor="white" height=471>
<P class="text-content-green" align=left
style="padding-left:5px">Lorem ipsum dolor sit amet, consectetur
adipisicing elit.Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum .
</P>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
HTH
Shanthi

Similar Messages

  • How to make table cells mandatory when visible

    I have a form with two hidden subforms. Each subform contains a table with fields that need to be mandatory when visible.
    The subforms are hidden or revealed based on a selection from a drop-down list.
    I found the below script which works great for making a text field mandatory when visible, but, how do you apply this to cells in a table?
    I can't figure it out.
    if ("RMC-Fort Lupton-FIRE-DOT" == xfa.event.newText)
        Table.FL.presence = "visible";
        Table.FL.TextField1.mandatory ="error";
    else
        Table.FL.presence = "hidden";
        Table.FL.TextField1.mandatory ="disabled";
    if ("RMC-Ault-FIRE-DOT" == xfa.event.newText)
        Table.ALT.presence = "visible";
        Table.ALT.TextField2.mandatory ="error";
    else
        Table.ALT.presence = "hidden";
        Table.ALT.TextField2.mandatory ="disabled";
    Thanks in advance!

    Hi Bibhu,
    Thanks for responding.
    Here is the table structure. Rows 1 through 25 are all the same. Each row has two cells with Radio Buttons named "AsFound" and "AsLeft." Both need to be mandatory when visible. If you need more information, let me know.
    Thanks!
    Kurt

  • How to make table cell drop down menu from an existing range in cell

    Is this possible?? Checked all over the web & coming up empty. Trying to avoid re-typing in contents from previously created tables in the cell format pop-up menu. Please help.

    I don't think there is an easy way to do this unless Yvan comes up with a script for you.
    One option is to select the range of cells and copy/paste to TextEdit (yes, surprisingly it'll take a range of cells) then from TextEdit you can copy/paste each cell's contents one at a time to the popup menu list. Still a pain but it might be easier than other methods. The workflow I found quickest was to position TextEdit near the Inspector pane (which is open to the Cell inspector with your popup in it) and have the top of the Numbers window nearby. Double click on one cell's contents in TextEdit then Cmd-C to copy, click on the Numbers window up in the toolbar to make Numbers active again without selecting a different cell, then put the contents in the inspector (hit + then paste with Cmd-V). Repeat.
    Message was edited by: Badunit

  • How to make table have transportable entries

    Hi Experts,
    how to make table ZFUSTXFACTOR have transportable entries?
    Regards,
    Saleem

    HI,
    In The se11 menu Utilities-->table maintenance generator-->if u already created table maintenance generator then in the tab DIALOG DATA TRANSFER DETAILS check the radio button STANDARD RECORDING ROUTINE.
    Then when ever u save the data in the table it will pop up a screen to create a Transport request.
    Thanks,CSR.
    ***please reward if helpful.

  • How to make editing cell to show up caret and taking keyboard event

    Hello everyone:
    I have the following problem with table editing.
    1. using mouse clicking, the editing cell will have cursor and taking keyboard event.(no problem with it)
    2. just type in data, it will show up in the selected cell, but the editing cell do not have cursor visible and also do not fire the keyboard event.
    I have problem with this one. So how to make editing cell to have caret visible and taking keyboard event.
    Thank you very much!
    --tony                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    you should subclass JTable and overwrite two methods.
    1. protected boolean processKeyBinding(javax.swing.KeyStroke ks,
    java.awt.event.KeyEvent e,
    int condition,
    boolean pressed)
    to store the current keyboard event,
    2.public boolean editCellAt(int row,int column,java.util.EventObject e)
    to fix the problem with isCellEditable and curret position and direct the event into proper place.

  • How to make Tool Strip have a glass effect?

    How to make Tool Strip have a glass effect? Please Help Me As Fast As Possible . Thx .
    Note : Please write as details as Possible because I am new to vb.

    Another possibility extending the Aero Glass effect.
    ToolStrip backcolor has to be transparent.
    Option Strict On
    Imports System.Runtime.InteropServices
    Public Class Form1
    <StructLayout(LayoutKind.Sequential)> _
    Public Structure MARGINS
    Public cxLeftWidth As Integer
    ' width of left border that retains its size
    Public cxRightWidth As Integer
    ' width of right border that retains its size
    Public cyTopHeight As Integer
    ' height of top border that retains its size
    Public cyBottomHeight As Integer
    ' height of bottom border that retains its size
    End Structure
    <DllImport("DwmApi.dll")> _
    Public Shared Function DwmExtendFrameIntoClientArea(hwnd As IntPtr, ByRef pMarInset As MARGINS) As Integer
    End Function
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
    Me.TransparencyKey = Color.Silver
    Me.BackColor = Color.Silver
    Dim BordersWidth As Integer = CInt((Me.Width - Me.ClientRectangle.Width) / 2)
    ToolStrip1.BackColor = Color.Transparent
    Try
    Dim margins As New MARGINS()
    margins.cxLeftWidth = BordersWidth
    margins.cxRightWidth = BordersWidth
    margins.cyTopHeight = ToolStrip1.Height
    margins.cyBottomHeight = BordersWidth
    DwmExtendFrameIntoClientArea(Me.Handle, margins)
    Catch ex As Exception
    End Try
    End Sub
    Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.Resize
    Me.Refresh()
    End Sub
    Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
    Using Brush1 As New SolidBrush(SystemColors.Control)
    e.Graphics.FillRectangle(Brush1, Me.ClientRectangle.Left, Me.ClientRectangle.Top + ToolStrip1.Height, Me.ClientRectangle.Width, Me.ClientRectangle.Height)
    End Using
    End Sub
    End Class
    La vida loca

  • How to make table format

    Hi,
    Im not expert in Oracle Database especially in querying of data's
    My problem is about to be honest i have no idea how to make table format.
    We have a problem in our production instance we raised it in Oracle Support but one of the technical support there is asking about this
    "I want table data of the corresponding batch. Please take help of you DBA and ensure that you are connected to the correct instance, where you have this issue."
    I am only one DBA here in our company and Im still Newbie.
    here is the scripts the he want me to run it
    select batch_id from gme_batch_header bh, mtl_parameters mp
    where batch_no = '115982'
    and organization_code = '101'
    and bh.organization_id = mp.organization_id;
    select *
    FROM gme_batch_header
    WHERE batch_id in (XXXXXX);
    select batch_id, line_type, material_detail_id, inventory_item_id, plan_qty, actual_qty, wip_plan_qty, dtl_um, release_type, phantom_id,
    locator_id, material_requirement_date, move_order_line_id, original_primary_qty, subinventory
    FROM gme_material_details
    WHERE batch_id IN (XXXXXX)
    ORDER BY batch_id, line_type, material_detail_id;
    SELECT 'MMT' as table_name, t.transaction_id as trans_or_rsrv_id, ty.transaction_type_name, h.batch_status, d.batch_id as batch_id, t.transaction_source_id as trans_or_rsrv_source_id, d.line_type, t.trx_source_line_id as material_detail_id,
    t.organization_id, pa.organization_code, t.inventory_item_id, i.segment1 as item_number, t.subinventory_code, t.locator_id, lt.lot_number as lot_number, t.primary_quantity, t.transaction_quantity as trans_or_rsrv_qty, lt.transaction_quantity as lot_qty, t.transaction_uom as trans_or_rsrv_uom, t.secondary_transaction_quantity as sec_qty, t.secondary_uom_code,
    to_char(t.transaction_date, 'DD-MON-YYYY HH24:MI:SS') as trans_or_rsrv_date, t.LPN_ID, t.TRANSFER_LPN_ID, t.transaction_mode, NULL as lock_flag, NULL as process_flag
    FROM mtl_material_transactions t, gme_material_details d, gme_batch_header h, mtl_transaction_lot_numbers lt,
    mtl_lot_numbers lot, mtl_system_items_b i, mtl_transaction_types ty, mtl_parameters pa
    WHERE t.transaction_source_type_id = 5
    AND h.batch_id in (XXXXXX)
    AND t.transaction_source_id = h.batch_id
    AND t.organization_id = h.organization_id
    AND d.batch_id = h.batch_id
    AND d.material_detail_id = t.trx_source_line_id
    AND lt.transaction_id(+) = t.transaction_id -- This join allows us to get the lot number
    AND lot.lot_number(+) = lt.lot_number -- This join allows us to get lot specific info if needed.
    AND lot.organization_id(+) = lt.organization_id
    AND lot.inventory_item_id(+) = lt.inventory_item_id
    AND t.organization_id = i.organization_id
    AND t.inventory_item_id = i.inventory_item_id
    AND t.transaction_type_id = ty.transaction_type_id
    And t.organization_id = pa.organization_id
    UNION ALL
    SELECT 'RSRV' as table_name, reservation_id as trans_or_rsrv_id , NULL, h.batch_status, d.batch_id as batch_id,
    demand_source_header_id as trans_or_rsrv_source_id, d.line_type, demand_source_line_id as material_detail_id,
    r.organization_id, pa.organization_code, r.inventory_item_id, i.segment1 as item_number, r.subinventory_code, r.locator_id, r.lot_number,primary_reservation_quantity, reservation_quantity as trans_or_rsrv_qty, NULL,reservation_uom_code as trans_or_rsrv_uom, secondary_reservation_quantity as sec_qty, r.secondary_uom_code,
    to_char(requirement_date, 'DD-MON-YYYY HH24:MI:SS') as trans_or_rsrv_date, LPN_ID, NULL, NULL, NULL, NULL
    FROM mtl_reservations r, gme_material_details d, gme_batch_header h, mtl_system_items_b i, mtl_parameters pa
    WHERE demand_source_type_id = 5
    AND h.batch_id in (XXXXXX)
    AND demand_source_header_id = h.batch_id
    AND r.organization_id = h.organization_id
    AND d.batch_id = h.batch_id
    AND d.material_detail_id = demand_source_line_id
    AND r.organization_id = i.organization_id
    AND r.inventory_item_id = i.inventory_item_id
    And r.organization_id = pa.organization_id
    UNION ALL
    SELECT 'PPL' as table_name, pending_product_lot_id as trans_or_rsrv_id, NULL, h.batch_status, d.batch_id as batch_id, NULL, d.line_type, d.material_detail_id, h.organization_id, pa.organization_code, d.inventory_item_id, i.segment1 as item_number, NULL, NULL, lot_number, NULL, quantity as trans_or_rsrv_qty, NULL, NULL, secondary_quantity as sec_qty, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    FROM gme_pending_product_lots p, gme_material_details d, gme_batch_header h, mtl_system_items_b i, mtl_parameters pa
    WHERE h.batch_id in (XXXXXX)
    AND p.batch_id = h.batch_id
    AND d.batch_id = h.batch_id
    AND d.material_detail_id = p.material_detail_id
    AND h.organization_id = i.organization_id
    AND d.inventory_item_id = i.inventory_item_id
    And h.organization_id = pa.organization_id
    UNION ALL
    -- Note that there should not be any transactions in MMTT. If there are, they are usually "stuck" there and
    -- need to be processed or deleted
    SELECT 'MMTT' as table_name, t.TRANSACTION_TEMP_ID as trans_or_rsrv_id, ty.transaction_type_name, h.batch_status, d.batch_id as batch_id, t.transaction_source_id as trans_or_rsrv_source_id, d.line_type, t.trx_source_line_id as material_detail_id, t.organization_id, pa.organization_code, t.inventory_item_id, i.segment1 as item_number, t.subinventory_code, t.locator_id, lt.lot_number as lot_number, t.primary_quantity, t.transaction_quantity as trans_or_rsrv_qty, lt.transaction_quantity as lot_qty, t.transaction_uom as trans_or_rsrv_uom, t.secondary_transaction_quantity as sec_qty, t.secondary_uom_code, to_char(t.transaction_date, 'DD-MON-YYYY HH24:MI:SS') as trans_or_rsrv_date,t.LPN_ID, t.TRANSFER_LPN_ID, t.transaction_mode, t.lock_flag, t.process_flag
    FROM mtl_material_transactions_temp t, gme_material_details d, gme_batch_header h,
    mtl_transaction_lots_temp lt, mtl_system_items_b i, mtl_transaction_types ty, mtl_parameters pa --mtl_lot_numbers lot
    WHERE t.transaction_source_type_id = 5
    AND h.batch_id in (XXXXXX)
    AND transaction_source_id = h.batch_id
    AND t.organization_id = h.organization_id
    AND d.batch_id = h.batch_id
    AND d.material_detail_id = trx_source_line_id
    AND lt.TRANSACTION_TEMP_ID (+) = t.TRANSACTION_TEMP_ID -- This join allows us to get the lot number
    --AND lot.lot_number(+) = lt.lot_number
    --AND t.organization_id = lot.organization_id
    AND t.organization_id = i.organization_id
    AND t.inventory_item_id = i.inventory_item_id
    AND t.transaction_type_id = ty.transaction_type_id
    And t.organization_id = pa.organization_id
    UNION ALL
    SELECT 'MTI' as table_name, t.TRANSACTION_INTERFACE_ID as trans_or_rsrv_id, ty.transaction_type_name, h.batch_status, d.batch_id as batch_id, t.transaction_source_id as trans_or_rsrv_source_id, d.line_type, t.trx_source_line_id as material_detail_id, t.organization_id, pa.organization_code, t.inventory_item_id, i.segment1 as item_number, t.subinventory_code, t.locator_id, lt.lot_number as lot_number, t.primary_quantity, t.transaction_quantity as trans_or_rsrv_qty, lt.transaction_quantity as lot_qty, t.transaction_uom as trans_or_rsrv_uom, t.secondary_transaction_quantity as sec_qty, t.secondary_uom_code, to_char(t.transaction_date, 'DD-MON-YYYY HH24:MI:SS') as trans_or_rsrv_date, t.LPN_ID, t.TRANSFER_LPN_ID, t.transaction_mode, to_char(t.lock_flag), to_char(t.process_flag)
    FROM mtl_transactions_interface t, gme_material_details d, gme_batch_header h,
    mtl_transaction_lots_interface lt, mtl_system_items_b i, mtl_transaction_types ty, mtl_parameters pa --mtl_lot_numbers lot
    WHERE t.transaction_source_type_id = 5
    AND h.batch_id in (XXXXXX)
    AND transaction_source_id = h.batch_id
    AND t.organization_id = h.organization_id
    AND d.batch_id = h.batch_id
    AND d.material_detail_id = trx_source_line_id
    AND lt.TRANSACTION_INTERFACE_ID (+) = t.TRANSACTION_INTERFACE_ID -- This join allows us to get the lot number
    --AND lot.lot_number(+) = lt.lot_number
    --AND t.organization_id = lot.organization_id
    AND t.organization_id = i.organization_id
    AND t.inventory_item_id = i.inventory_item_id
    AND t.transaction_type_id = ty.transaction_type_id
    And t.organization_id = pa.organization_id
    ORDER BY batch_id, table_name, line_type, material_detail_id;
    SELECT *
    FROM gme_transaction_pairs
    WHERE batch_id in (XXXXXX);
    I used SQL Developer and connected in our Production instance where the problem is there
    so i run it please see attached file:
    please help how to make table format outpur what are the steps that i need to produce correctly.

    Hi,
    From your post, it seems that you need to upload the results of the query to Oracle Support.
    You can spool the output to a file and upload it.
    Something like...
    SQL>spool output.txt
    SQL>set lines 200
    SQL>set pages 200
    --execute the queries
    SQL>spool off
    I don't know about SQL Developer but tools such as PL/SQL Developer and Toad will allow you to export the query results directly to MS Excel.
    Regards,
    Sujoy

  • How to set table cell renderer in a specific cell?

    how to set table cell renderer in a specific cell?
    i want set a cell to be a button in renderer!
    how to do?
    any link or document can read>?
    thx!

    Take a look at :
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
    It is very interesting, and I think your answer is here.
    Denis

  • Slide duration - How to make one slide have a different duration to another slide?

    Slide duration - How to make one slide have a different duration to another slide?
    EG So one slide has 2 seconds, another 4 another 6
    All I can see is how to make all slides have the same duration
    Any help very much appreciated!
    Brian

    Slide durations are not changeable on a slide-by-slide basis.

  • How to make table as "editable false"

    Dear Forum,
    i am user of jDeveloper jClient/Swing .jpr.
    cutomer table having following attributes-
    1.cust_id (primary key)
    2.cust_name
    3.cust_add
    Suppose customerview bind with jTable1.
    Using ViewObjectEditor, i set "updateable never" for all fields.
    This show error, when data insert into table " cust_id as
    read only".
    Help me, Using jClient Binding how to make Table as "editable false".

    Overriding method prepareEditor() for new table:
    private JTable tableList = new JTable(){
    public Component prepareEditor(TableCellEditor editor, int row, int column) {
    // 1 and 2 column is not editable
    if(column == 0 || column == 1){ return null; }
    return super.prepareEditor(editor, row, column);

  • HOW TO MAKE TABLE CONTROL NON EDITABLE

    hi all
    how to make table control non editable
    Thanks & Regards
    harsha

    Hi,
    Try this code in the PBO inside the module in the LOOP...ENDLOOP.
       IF SY-TCODE EQ 'ZEMPLDISPLAY'.
        LOOP AT SCREEN.
         if screen-name eq 'column1' or screen-name eq 'column2'.  "Give the names of the columns in the table control
          SCREEN-INPUT = '0'.
          MODIFY SCREEN.
        endif.
        ENDLOOP.
      ENDIF.
    Or you can go the Layout of the table control in Change mode and for every column's attributes, make it 'Output' only field. Check  'Output only' field.

  • How to make table that will include controls such as drop list?

    How to make table that will include controls such as drop list?
    I need to create table as Property Browser of ActiveX, that include rows with differnt types such as drop list, color, ...

    Hi Nadav,
    I figured out where I missed your point. When you wrote
    table as Property Browser of ActiveX, that include rows with differnt types such as drop list, color, ...
    I was thinking mixed data-types in a [2d] table!
    Looking at the property browser again it looks like no single LV function can do all of that. It can be developed as a pop-up (like the browser is set-up) and then code all of the elegance using an event structure to control the background color of a string indicator while controling the visability of rings that are only made visable when a mouse down is detected. That will get you pretty close.
    So no, my previous response ws not correct for what you are trying to do if you want to duplicate all of the wistles and bells of the property browser pop-up window.
    Please forgive my distraction.
    Ben 
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to make tables similar to apple site?

    Is anyone aware of any tutorials on how to make tables
    similar to
    http://www.apple.com/support/leopard/
    Thanks!

    Look at the code.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Mike" <[email protected]> wrote in message
    news:[email protected]..
    > Is it all CSS? How is it being done? Anyone point me to
    some tutorials?
    >
    > Thanks.
    >
    > Ken Binney wrote:
    >> And then you will discover there are no tables in
    that layout.
    >>
    >>
    >>
    >>
    >> "John T Smith" <[email protected]>
    wrote in message
    >> news:g0ichc$64f$[email protected]..
    >>> While at that site, tell your browser to show
    you the code... in IE that
    >>> is
    >>> click on the View option and select source
    >>>
    >>> You may also do a File--Save As to save a copy
    of the code to your
    >>> computer to
    >>> view
    >>>
    >>

  • How to make a cell in a JTable to be uneditable and handle events

    I tried many things but failed,How do you make a cell in a JTable to be uneditable and also be able to handle events>Anyone who knows this please help.Thanx

    Hello Klaas2001
    You can add KeyListener ,MouseListener
    Suppose you have set the value of cell using setValueAt()
    table.addKeyListener(this);
    public void keyTyped(KeyEvent src)
    String val="";
    int r= table.getEditingRow();
    int c= table.getEditingColumn();
    val=table.getValueAt(r,c).toString();
    if (r!=-1 && c!=-1)
    TableCellEditor tableCellEditor = table.getCellEditor(r, c);
    tableCellEditor.stopCellEditing();
    table.clearSelection();
    table.setValueAt(val,r,c);
    public void keyReleased(KeyEvent src)
    public void keyPressed(KeyEvent src)
    table.addMouseListener(this);
    public void mouseClicked(MouseEvent e)
    public void mouseEntered(MouseEvent e)
    public void mouseExited(MouseEvent e)
    public void mousePressed(MouseEvent e)
    public void mouseReleased(MouseEvent e)
    if(e.getClickCount()>=2)//Double Click
    table.clearSelection();
    int r= table.getEditingRow();
    int c= table.getEditingColumn();
    if (r!=-1 && c!=-1)
    TableCellEditor tableCellEditor = table.getCellEditor (
    r,c);
    tableCellEditor.stopCellEditing();
    table.clearSelection();
    table.setValueAt("",r,c);
    }//Mouse Released
    You can remove keyListener and Mouse Listener whenever You want to edit
    then add it later.
    Regarding handling events implement javax.swing.event.TableModelListener
    table.getModel().addTableModelListener(this);
    public void tableChanged(javax.swing.event.TableModelEvent source)
    TableModel tabMod = (TableModel)source.getSource();
         switch (source.getType())
    case TableModelEvent.UPDATE:
         break;
         }//Table Changed Method
    //This method gets fired after table cell value is changed.

  • How to make JTree cell renderer respect layout?

    Hi,
    In the JTree tutorial, the first example TreeDemo shows a simple tree.
    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
    If you grab the frame and make it really thin, you get a horizontal scroll bar in the top pane.
    How can I make it so that the tree cells just draw "..." at the end of the string if there is not enough space?
    I know the tree cell renderer uses JLabel, but they never seem to show "...", which is one of the best features of a JLabel. Any help is greatly appreciated!

    Hi,
    I got it working, but I also discovered a Java bug that ruins all this effort!
    Calculating the node's position & width:
    - When child nodes are indented, there is an "L" shaped line drawn... the space to the left of the line's vertical bar is the "leftChildIndent", and the space to the right is the "rightChildIndent". So you add both to get the whole indent.
    - I use label.getPreferredSize().width to figure out the node width, since that includes the icon width, the icon-text gap, and the font metrics.
    Example program:
    - This program models how I want it to look... Always expanded and automatic "..." when the scroll pane is not big enough.
    Bug found:
    - There is a runnable example below. Just run it and after a couple seconds, move the split pane to the right.
    - I use a timer to add a new node every 1 second. The new nodes get stuck being too small, and the original nodes don't have this problem.
    // =====================================================
    * Adaptation of TreeDemo to allow for tree nodes that show "..."
    * when there is not enough space to display the whole label.
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JTree;
    import javax.swing.Timer;
    import javax.swing.UIManager;
    import javax.swing.event.TreeExpansionEvent;
    import javax.swing.event.TreeWillExpandListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.ExpandVetoException;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreeSelectionModel;
    public class TreeDemo extends JPanel {
        private JTree tree;
        protected class EllipsesTreeCellRenderer implements TreeCellRenderer {
            Integer leftIndent = (Integer) UIManager.get("Tree.leftChildIndent");
            Integer rightIndent = (Integer) UIManager.get("Tree.rightChildIndent");
            int indent = leftIndent.intValue() + rightIndent.intValue();
            JLabel label = new JLabel();
            DefaultTreeCellRenderer r = new DefaultTreeCellRenderer();
            public Component getTreeCellRendererComponent(JTree tree, Object value,
                    boolean selected, boolean expanded, boolean leaf, int row,
                    boolean hasFocus) {
                label.setText("why hello there why hello there why hello there");
                if (selected) {
                    label.setForeground(r.getTextSelectionColor());
                    label.setBackground(r.getBackgroundSelectionColor());
                } else {
                    label.setForeground(r.getTextNonSelectionColor());
                    label.setBackground(r.getBackgroundNonSelectionColor());
                if (leaf) {
                    label.setIcon(r.getLeafIcon());
                } else if (expanded) {
                    label.setIcon(r.getOpenIcon());
                } else {
                    label.setIcon(r.getClosedIcon());
                label.setComponentOrientation(tree.getComponentOrientation());
                int labelWidth = label.getPreferredSize().width;
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
                int level = node.getLevel();
                if (!tree.isRootVisible()) {
                    --level;
                int indentWidth = indent * level;
                int rendererWidth = labelWidth + indentWidth;
                // This is zero the first few times getTreeCellRenderer is called
                // because the tree is not yet visible.
                int maxWidth = (int) tree.getVisibleRect().getWidth();
                if (maxWidth > 0) {
                    if (rendererWidth > maxWidth) {
                        // figure out how much space "..." will consume.
                        label.setText(label.getText() + "...");
                        maxWidth = maxWidth
                                - (label.getPreferredSize().width - labelWidth);
                        label.setText(label.getText());
                        // chop off characters until "..." fits in the visible
                        // portion.
                        if (maxWidth > 0) {
                            while (rendererWidth > maxWidth
                                    && label.getText().length() > 1) {
                                label.setText(label.getText().substring(0,
                                        label.getText().length() - 2));
                                rendererWidth = indentWidth
                                        + label.getPreferredSize().width;
                            label.setText(label.getText() + "...");
                return label;
        public TreeDemo() {
            super(new GridLayout(1, 0));
            //Create the nodes.
            final DefaultMutableTreeNode top = new DefaultMutableTreeNode("");
            createNodes(top);
            //Create a tree that allows one selection at a time.
            tree = new JTree(top);
            tree.getSelectionModel().setSelectionMode(
                    TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setCellRenderer(new EllipsesTreeCellRenderer());
            tree.addTreeWillExpandListener(new TreeWillExpandListener() {
                public void treeWillExpand(TreeExpansionEvent event) {
                public void treeWillCollapse(TreeExpansionEvent event)
                        throws ExpandVetoException {
                    throw new ExpandVetoException(event);
            for (int i = tree.getRowCount(); i >= 0; i--) {
                tree.expandRow(i);
            //Create the scroll pane and add the tree to it.
            JScrollPane treeView = new JScrollPane(tree);
            //Add the scroll panes to a split pane.
            JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
            splitPane.setTopComponent(treeView);
            splitPane.setBottomComponent(new JLabel(""));
            Dimension minimumSize = new Dimension(0, 0);
            treeView.setMinimumSize(minimumSize);
            splitPane.setDividerLocation(200); //XXX: ignored in some releases
            //of Swing. bug 4101306
            //workaround for bug 4101306:
            //treeView.setPreferredSize(new Dimension(100, 100));
            // Makes tree nodes appear cut-off initially.
            splitPane.setPreferredSize(new Dimension(500, 300));
            //Add the split pane to this panel.
            add(splitPane);
            // Adds a new node every 1 second
            Timer timer = new Timer(1000, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
                    DefaultMutableTreeNode child = new DefaultMutableTreeNode("");
                    model.insertNodeInto(child, top, 0);
                    for (int i = tree.getRowCount(); i >= 0; i--) {
                        tree.expandRow(i);
            timer.start();
        private void createNodes(DefaultMutableTreeNode top) {
            DefaultMutableTreeNode category = null;
            DefaultMutableTreeNode book = null;
            category = new DefaultMutableTreeNode("");
            top.add(category);
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
         * Create the GUI and show it. For thread safety, this method should be
         * invoked from the event-dispatching thread.
        private static void createAndShowGUI() {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception e) {
                System.err.println("Couldn't use system look and feel.");
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("TreeDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            TreeDemo newContentPane = new TreeDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

Maybe you are looking for

  • How to Print GIF image in XML RTF Report

    Hi All, I have one requirement like to print the GIF image in Oracle Report. The report is an XML Report. The image file stored in database, the table is fnd_attached_docs_form_vl. select distinct file_name from fnd_attached_docs_form_vl Front end Na

  • How to to connect 5.1 digtal speak

    i get ?CREATIVE Audigy 2 Value?(oem) and i get a 5. digtal speaker but i get a problem to to connect tham the cable the come with the speaker(yamaha tss) dount match the card what cable shold i buy

  • Atan2 equivalent in a Formula Node?

    Does anyone have an atan2 (2-input inverse arctangent) equivalent for use in a Formula Node? I was surprised to see that such a common function wasn't supported in Formula Nodes. Without it, my easily readable Formula Node equations get junked and be

  • PSE 11 - How disable Save in Version Set

    How can I default the Save in Version Set checkbox to unchecked so I do not have to remember to uncheck it when I save. I _never_ want to create a version set. Thanks.

  • Rules for messages in iCloud preferences not working.

    I have set up a rule that all emails addressed to my alias are forwarded to a sprecific folder, this is not working, any ideas?