Merge/split cell in jtable

I am working a swing application by which user can create a layout by merging or splitting cells (as well as adding deleting). And get an html out of it.
But I found it is hard to do so with JTable.
I found a few of messages on this board, but still did not come out with a solution.
Does anyone have a solution?
thanks
Long

check this....there are plenty of examples....
http://www2.gol.com/users/tame/swing/examples/JTableExamples4.html

Similar Messages

  • Merge table cells of JTable

    Can we merge two cells of JTable, the way we do it in html using rowspan and colspan?

    no, that's unsupported. There are some (partly oldish, google should help) experiments out there - but beware: they all require tweaks on the level of the ui-delegates which isn't a real option most of the time.
    Cheers
    Jeanette

  • Merge & split cells

    If I select three cells in a row and then merge them into one, and then decide to split them back to their original arrangement, I can only split the merged cell into two equal cells.
    This seems nuts to me.
    Is there any way to get the merged cell to split back into the original 3 cells?

    Shuncle wrote:
    In the meantime, I will try not to merge any cells I may want to split later.
    Not to take this too far off topic, but the design of Numbers includes several non-reversible features (assuming "undo" is not available or would undo more than you want). For example, enter the text "March 1" in a cell preset to the text format. If you later set the cell's format to automatic, the cell data is irreversibly set to a date.
    More than once, I've selected a group of cells & accidentally made changes like this, usually when the selection is larger than what shows in the document window, & only too late to use "undo" noticed what had happened. (Should you be wondering, "March 1" means something entirely different from a date in a spreadsheet used to record cues for musical events!)
    So I've learned to be very careful when making any of these changes, & to backup my Numbers spreadsheets more frequently than I would other documents.

  • Merging/splitting cells is inappropriate

    Sigh. Pages is cloning the awful way that Word does the table cell merge/split ... it really should follow the FrameMaker model ... try merging three cells, then split them again ... it's just about impossible to get the table back to its previous form. FM, on the other hand, treats a "merge" as a "disable boundaries" command, which means the cell boundaries are still there, just not active so all the contents get mushed together. When the "split" is applied, all the original boundaries return so you have a nice clean and lined-up table again.

    What you need to do is unmerge the cells, not split them. Then you can move it and remerge with the other cells.
    With the cells selected, just click on Merge Cells again and they should now be individual cells. Then move and reselect the cells you want to merge.

  • How to merge cell in jtable

    i want to merge the cell in the jtable , as one cell requires more space than other kindly tell me how to do so

    Try http://codeguru.earthweb.com/java/articles/139.shtml

  • Merge cells in JTable.......

    Plz some help me out ......i want to merge two consecutive cells of a row in one cell in JTable......... how to do that.....give some code if possible....

    Well, as a new member you should learn to search the forum first before posting questions. Using keywords like "jtable merge cell" will find other postings on this topic. Some with solutions some without, so you will need to read a few and decide on the approach you want to take.

  • Merging Cells in  JTable

    I want to merge cells of JTable. I searched on net about this and found that there is no direct API available for doing this.
    After visiting many forums I found that jp.gr.java_conf.tame.swing.table package is needed to merge cells. Where will I get this package from and is this package for free? Other packages for merging cells will also do.
    Thanks in advance

    Pranav_Tipnis wrote:
    I found that jp.gr.java_conf.tame.swing.table package is needed to merge cells. Where will I get this package from and is this package for free? Yes, this package is for free. You get it from here: [http://www.codeguru.com/java/articles/137_tame1.zip]
    However, the component is complicated and difficult to adapt and debug in case you need special functionality.

  • How do I split cells in Numbers 3.2?

    How do I split cells in Numbers 3.2?

    Hey big one,
    I don't believe you can split cells in Numbers 3.2. It has not been not considered a good practice because it can lead to trouble down the line. This is true about merging also. I used to do a lot of that in '09. What I have found that I can generally get the looks I am after (getting text to span multiple columns for instance) by turning off "wrap text in cell" and playing with the justification.
    Hope this is in some way helpful.
    quinn

  • Merge multiple cells and rows

    Hello,
    I am trying to merge multiple cells and have found that I can do thi easily by selecting the adjancent row cells and using the TABLE - MERGE CELLS command.  However, If I want to apply the same merge to multiple rows, I can find noquick way to do this other than selecting each set of cells and using the TABLE - MERGE CELLS command each time.  Here is an example of what I want to do:
    Here is the Numbers spreadsheet as normal:
    Here is cell B2 and C2 merged:
    Now what I want to do is the same process for rows 3 to 10.  However, when I try to select the section and use the TABLE - MERGE CELLS command, I get on large cell rather than split rows of merged cells as seen below:
    Any idea how I can or if I can accomplish this task?
    Thanks in advance,
    OriginalGumshoe

    You may also use this script :
    --{code}
    --[SCRIPT merge_row_by_row]
    Enregistrer le script en tant que Script : merge_row_by_row.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Utilisateurs:<votreCompte>:Bibliothèque:Scripts:Applications :Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner le bloc de cellules à traiter.
    Aller au menu Scripts , choisir Numbers puis choisir “merge_row_by_row”
    Le script fusionne les cellules de chaque ligne appartenant à la sélection.
    --=====
    L’aide du Finder explique:
    L’Utilitaire AppleScript permet d’activer le Menu des scripts :
    Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case “Afficher le menu des scripts dans la barre de menus”.
    Sous 10.6.x,
    aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
    puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
    --=====
    Save the script as a Script: merge_row_by_row.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select the range of cells to treat
    Go to the Scripts Menu, choose Numbers, then choose “merge_row_by_row”
    The script merge the cells of every row included in the selection.
    --=====
    The Finder’s Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the “Show Script Menu in menu bar” checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2011/12/18
    --=====
    on run
              local dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2, r
              my activateGUIscripting()
              set {dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
              tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
                        repeat with r from rowNum1 to rowNum2
                                  set selection range to range (name of cell colNum1 of row r & " : " & name of cell colNum2 of row r)
                                  my selectmenu("Numbers", 6, 23) -- Merge cells
                        end repeat
              end tell
    end run
    --=====
    set { dName, sName, tName,  rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    on get_SelParams()
              local d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2
              tell application "Numbers" to tell document 1
                        set d_Name to its name
                        set s_Name to ""
                        repeat with i from 1 to the count of sheets
                                  tell sheet i to set maybe to the count of (tables whose selection range is not missing value)
                                  if maybe is not 0 then
                                            set s_Name to name of sheet i
                                            exit repeat
                                  end if -- maybe is not 0
                        end repeat
                        if s_Name is "" then
                                  if my parleAnglais() then
                                            error "No sheet has a selected table embedding at least one selected cell !"
                                  else
                                            error "Aucune feuille ne contient une table ayant au moins une cellule sélectionnée !"
                                  end if
                        end if
                        tell sheet s_Name to tell (first table where selection range is not missing value)
                                  tell selection range
                                            set {top_left, bottom_right} to {name of first cell, name of last cell}
                                  end tell
                                  set t_Name to its name
                                  tell cell top_left to set {row_Num1, col_Num1} to {address of its row, address of its column}
                                  if top_left is bottom_right then
                                            set {row_Num2, col_Num2} to {row_Num1, col_Num1}
                                  else
                                            tell cell bottom_right to set {row_Num2, col_Num2} to {address of its row, address of its column}
                                  end if
                        end tell -- sheet…
                        return {d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2}
              end tell -- Numbers
    end get_SelParams
    --=====
    on parleAnglais()
              local z
              try
                        tell application "Numbers" to set z to localized string "Cancel"
              on error
                        set z to "Cancel"
              end try
              return (z is not "Annuler")
    end parleAnglais
    --=====
    on decoupe(t, d)
              local oTIDs, l
              set oTIDs to AppleScript's text item delimiters
              set AppleScript's text item delimiters to d
              set l to text items of t
              set AppleScript's text item delimiters to oTIDs
              return l
    end decoupe
    --=====
    on activateGUIscripting()
      (* to be sure than GUI scripting will be active *)
              tell application "System Events"
                        if not (UI elements enabled) then set (UI elements enabled) to true
              end tell
    end activateGUIscripting
    --=====
    my selectMenu("Pages",5, 12)
    ==== Uses GUIscripting ====
    on selectmenu(theApp, mt, mi)
      activate application theApp
              tell application "System Events" to tell application process theApp to tell menu bar 1 to ¬
                        tell menu bar item mt to tell menu 1 to click menu item mi
    end selectmenu
    --=====
    --[/SCRIPT]
    --{code}
    Yvan KOENIG (VALLAURIS, France) dimanche 18 décembre 2011 22:21:24
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How to merge two cells in a row

    hi freinds,
    how to merge two cells in alv grid using oops.
    for eg ,in the first row there is text premraj
             n in the second row there is cheguri
              my requriment is two merge the two cells ie to remove the horizontal line between them
    thanks & regards,
    premraj

    Well, as a new member you should learn to search the forum first before posting questions. Using keywords like "jtable merge cell" will find other postings on this topic. Some with solutions some without, so you will need to read a few and decide on the approach you want to take.

  • Pages - merging horizontal cells

    Hi, I have been supplied a files with addresses and property details. Each address is split up into 8 cells (A-H). Whilst I can select each row individually (horizontally) and merge the cells - is there a way of selecting the whole table BUT just merger each row. When I select all the cells and merge it puts all the info into one cell? thanks

    What version of Pages?
    And what was the original file? Pages or something else?
    Most other software lets you convert text to tables and tables to text, but not the latest Pages 5. So you will have to do what you want elsewhere.
    It is a matter of working out what you have, what your end result is, and the individual steps you are going to have to take from one to the other.
    Show us a sample of the original and then the same sample formatted the way you want it and for what purpose.
    Peter

  • How to merge the cells on a  tittle's report

    Hi there!
    Considering a simple obiee report composed of a title and a pivot table. At the same time, the title is composed of a logo and a sentence. If I export it to excel, the logo in the title and the sentence are allocated to separated cells. Do you know how to merge the cells on the tittle?
    Any help will be GREATLY appreciated.
    Thank you very much indeeed!!!
    PS. Oracle Business Intelligence 11.1.1.6.4

    Hi There,
    I am also facing same issue. Please let me know if any one has solved it.
    Thanks in advance.

  • How to change the Background color of a cell in JTable

    hi!
    Actually i want to change the background color of few cells in JTable
    is there any method to make this change in JTable ?
    and also is it possible to have 5 rows with single column and 5 rows with 3 columns in a single JTable

    i want to change the background color of few cells in JTableDepending on your requirements for the coloring of cells it may be easier to override the prepareRenderer() method of JTable:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=610474

  • Change the background color of a cell in JTable

    Hi all,
    How can I change the background color of individual cell in JTable. I need to construct my own TableCellRenderer or not? I'm now using the DefaultTableCellRenderer now.
    Thx

    You could create your own renderer or you could try something like:
    table = new JTable(model)
         public TableCellRenderer getCellRenderer(int row, int column)
              DefaultTableCellRenderer tcr =
               (DefaultTableCellRenderer)super.getCellRenderer(row, column);
              if (row == 1 && column == 1)
                   tcr.setBackground(Color.green);
              else
                   tcr.setBackground(Color.red);
              return tcr;
    };

  • How can I get right data in a cell of JTable when table  enter editing

    how can I get right data in a cell of JTable when table enter editing

    how can I get right data in a cell of JTable when table enter editing

Maybe you are looking for