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
Similar Messages
-
How to merge cells in report designer
Hello BW Experts,
How to merge cells in report designer.
Thanks in advance
BWerHi BWer,
I had to check for some details from Development.
You also need to have FEP 14 for the BI 7.x tools on SAP GUI 6.40, which was just released on Friday. You can find it at service.sap.com/swdc. In the format menu, you will now see a "Link Cells" option.
With the link cells option, you cannot merge across row patterns. That means that you will probably have to make some changes to your report before you can merge the cells, based on what you described.
I imagine that you started out with a report section something like the following (dashes added for formatting purposes):
G0 Header ...
G1 Header -
Controlling Area
Detail -
Func Area
And then moved controlling area to the right to the same column as functional area:
G0 Header ...
G1 Header -
Controlling Area
Detail -
Func Area
Resulting in an output that would look like:
CA1000
FA ABCA
FA ABCB
FA ABCC
CA2000
FA ABCA
FA ABCB
FA ABCC
As shown above, these cells cannot be merged because they cross row patterns. You would instead need to move the controlling area member down to the same row as functional area:
G0 Header ...
G1 Header
Detail -
Controlling Area Func Area
You can now merge these cells, resulting in an output that would look like the following:
CA1000 FA ABCA
CA1000 FA ABCB
CA1000 FA ABCC
CA2000 FA ABCA
CA2000 FA ABCB
CA2000 FA ABCC
To merge the cells, you would simply highligh both cells with your cursor and then select the option from the menu.
Regards,
Katie -
How to Merge Cells in Template in Smartform??
Hi,
Can somebody pls tell me how to merge cells vertically in to single cell in a Template in Smartforms..
Regards,
RushikeshHi Rushikesh,
SAP does not directly provide option of merging the cells intemplate...Check out following
to do the needful.
1. Double click on the template node and go to table painter.
2. say you want to merge two cells C1 & C2
3. Click on the pencil icon above table painter to get plus type cursor now click on
any cell from C1 or C2. The cell turns black indicating the selction .
4. Right click -> Delete -> Cell. C1 is deleted.
5. Again click on the pencil icon to get back the arrow cursor.
6. Now take pointer on the boundary of cell C2. You the icon changes indicating
the cell boundary can adjusted as per req. Do the necessary adjustment .
7. Save and activating.
Hope this helps you...
Enjoy SAP.
Pankaj Singh.. -
How to merge cells in Visio 2013
Hi im created a grid in visio
i want to merge some cells in table
How to merge cells ?
ThanksHi,
As far as I know, the Grid is shape in Visio, we could not merge the cells like Excel. Please try the workaround:
Select the cells that need to merge>Format the shape> Choose no line
Select the cells> right click> group
Hope it's helpful.
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
How to merge cells in excel using X++ in AX 2009
Hi all,
How to merge cells in excel using X++ in AX 2009?
for example i have 3 cells (A3:C3) i need to merge this 3 cells using X++
can any one sujjest please
Thanks in advanceHi,
WinForm technology does not support X++ related cases.
I just checked this link
http://msdn.microsoft.com/en-us/library/aa867122.aspx and haven't found a related forum.
I'll move your case to where is the forum for so that you may get some help about this.
Regards,
Barry Wang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
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 advancePranav_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 to Merge Cells in a JTable?
First, a brief background. I have a 1.3.1 Swing application, and have a custom table framework that is extended from Swing. My table model manages row classes. Each row class has its own collection of renderers and editors. Renderers and editors are never shared; each cell has its own. My custom table asks each row for the renderer/editor as needed. This allows the GUI programmer to customize every cell of a row class, down to the renderer/editor, including which cells are editable. Essentially, my custom table framework puts all the brains into row classes. Each screen has its own row class. So, it's very granular but very powerful. However, I need more power.
I need a way to merge cells across columns (column spanning). These merged cells do NOT need to be editable for now. I don't know how I can get the table to render one cell across others in the same row. I suspect this is largely a painting issue, and could really use some help.
Thanks!
AndyThanks for the direction, Ian! That got me on my way.
I subclassed BasicTableUI and copy-pasted the private methods into my subclass, and made them protected. I then modified the paintCell( ) method to change the rendering for the particular table row I'm interested in (test case).
To make the first cell span the entire row, I changed the width of the painting rectangle to be the width of the table, instead of the width of the cell. I also had to NOT render any other cells in that row, so they wouldn't "interfere" with the first renderer. In other words, if I allow cell 3 to be rendered, it will prevent cell 0 from spanning, since cell 3 is rendered AFTER cell 0.
Here's an example of my proof-of-concept (POC):
// For row 5, only render cell 0
if (row == 5) {
if (column == 0) {
rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y, table.getWidth(), cellRect.height, true);
return;
}You can see that only cell 0 will be rendered, and it will be as wide as the table.
My next step will be to experiment with multiple spans in the same row, and then having a cell in the middle span the entire row. I'll post my results for the sake of posterity. -
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.
-
How to merge cells in SmartForms?
Dear Experts,
How can I merge cells (Row wise adjecents cells)in a table of smart forms..
thanks in adv....
Moderator message: Please post your questions in the right forum and give more meaningful titles in the future.
Edited by: kishan P on Oct 11, 2010 3:39 PMIf you are using table, then realign the table my adding 2 cells in a row. Go to Main window==> table==> table tab==> click on details.. Now you will get the row details. Choose the row where you wants the merge. Let us consider you wants to merge cell 3 (2cm) & 4 (1 cm). then put 2 +1 = 3 cm for cell 3 and delete cell 4. Note: content will be deleted for this
-
How to merge cells in AdvancedDatagrid?
Hi All,
I am using advanced datagrid in my project to show hierarchical data.
we have a requirement to merge related cells so that it will look like below (just like row span in html table)
1
1.1
1.2
1.3
2
2.1
2.2
2.3
For column header it can be done by AdvancedDataGridColumGroup. So there must be some solution to merge cells to create the same effect for row.
Anyone has any idea on how to achieve this?
Thanks!!!Check out the rendererProviders property on AdvancedDataGrid. It lets you dynamicaly determine what renderer to use at runtime based on the data being rendered. It takes a list of AdvancedDataGridRenderer instances, and those instnces have properties for colSpan and rowSpan.
-
Hi
I have some problem with JTable that have merged cell.
Have you got any examples for JTable with merged cell.
Thank in advancecheck this....there are plenty of examples....
http://www2.gol.com/users/tame/swing/examples/JTableExamples4.html -
Hi all !
I have a listview. Now, i want to merge cell on listView and insert richtextbox to merge it.
Thanks!Hi vulc.le,
It depends on how you display data in the ListView, I would suggest you reading Magnus's article:
#WPF/MVVM: Merging Cells In a ListView
http://social.technet.microsoft.com/wiki/contents/articles/24663.wpfmvvm-merging-cells-in-a-listview.aspx
He used an ItemsControl in the CellTemplate of the GridViewColumn to display a list of several countries in the same cell
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to merge cells in tables if SmartForms like colspan/rowspan in HTML
Hi!
Is it possible to merge cells in a tables in SmartForms like colspan/rowspan parameters in HTML?
Both horisontal and vertical merging needed both in header and in body of the table.
Thanks!No it is not possible.
For merging purpose we have to create seperate windows for that col or rows. -
How to merge cell in DefaultTableModel/JTable?
I searched a lot and got some answers for this Q. but many of them referred to links which give 404 error. I want to make table like this:
Can I make this in Java?looks like I'm the kucky one:
http://www.java2s.com/Code/Java/Swing-Components/multipleRowHeaderExample.htm
bye
TPD -
Merging cells in JTable...help
Can someone give me some direction into how I can handle this....
After hours of poking around, I figured out all i needed was an extended BasicTableUI class. With the help of tames MergedCell example, I havepulled out what I need out of his class and stripped it down alot to what I needed. hopefully this will help others also...
package foo;
import java.lang.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.plaf.basic.*;
/*This class extends BasicTableUI class which is responsible for drawing the cells in a JTable
Functionality has been added to this class to allow a column cell to be spanned, or merged across
the entire length of the table.*/
See the paintRow() method to define when and how to span the cells.
public class LogicTableUI extends BasicTableUI
public void paint(Graphics g, JComponent c)
//get the rectangle bounds of the current graphic to be drawn
Rectangle oldClipBounds = g.getClipBounds();
//makes a new rectangle the same size as the current rectangle
Rectangle clipBounds = new Rectangle(oldClipBounds);
//gets the width of all combined columns and assigns to tableWidth
int tableWidth = table.getColumnModel().getTotalColumnWidth();
//sets the width of the new rectangle to equal the either the current rect size of the table width
clipBounds.width = Math.min(clipBounds.width, tableWidth);
//Sets the current clip to the rectangle specified by the given coordinates
g.setClip(clipBounds);
//define the first and last rows that are visible
int firstIndex = table.rowAtPoint(new Point(0, clipBounds.y));
int lastIndex = table.getRowCount()-1;
//define a rowRect. This is a rectangle spanning the entire visible part of the table
Rectangle rowRect = new Rectangle(0,0,tableWidth, table.getRowHeight() + table.getRowMargin());
rowRect.y = firstIndex*rowRect.height;
//for every row that is visible, paint it
for (int index = firstIndex; index <= lastIndex; index++)
//is the clipBounds of the current object to be drawn in this row?
if (rowRect.intersects(clipBounds))
paintRow(g, index);
//move to next row
rowRect.y += rowRect.height;
g.setClip(oldClipBounds);
private void paintRow(Graphics g, int row)
//define rect as the current graphic objects bounds
Rectangle rect = g.getClipBounds();
//the graphic has not been drawn yet
boolean drawn = false;
//define how many columns we have to draw for this row
int numColumns = table.getColumnCount();
//for every column in the row, paint it
for (int column = 0; column < numColumns; column++)
//define cellRect
Rectangle cellRect = table.getCellRect(row,column,true);
int cellRow;
int cellColumn;
cellRow = row;
cellColumn = column;
if (cellRect.intersects(rect))
drawn = true;
DefinitionTableModel tblmod = (DefinitionTableModel) table.getModel();
try
LogicGroup grp = tblmod.getLogicGroupByRow(cellRow);
//is this a statement row? If so, apply special treatment to the cell,
//otherwise paint the cell normally
if (grp.getEnd()==cellRow)
//We are on a row we want to span. If its the 1st column, increase
//the width of the rectangle to span the entire table width and
//call paintCell. Otherwise, do not even paint the cell.
if (cellColumn==0)
cellRect.width=table.getColumnModel().getTotalColumnWidth();
paintCell(g, cellRect, cellRow, cellColumn);
else
paintCell(g, cellRect, cellRow, cellColumn);
catch(Exception e)
e.printStackTrace();
else
if (drawn)
break;
private void paintCell(Graphics g, Rectangle cellRect, int row, int column)
int spacingHeight = table.getRowMargin();
int spacingWidth = table.getColumnModel().getColumnMargin();
Color c = g.getColor();
g.setColor(table.getGridColor());
g.drawRect(cellRect.x,cellRect.y,cellRect.width-1,cellRect.height-1);
g.setColor(c);
cellRect.setBounds(cellRect.x + spacingWidth/2, cellRect.y + spacingHeight/2,
cellRect.width - spacingWidth, cellRect.height - spacingHeight);
if (table.isEditing() && table.getEditingRow()==row &&
table.getEditingColumn()==column)
Component component = table.getEditorComponent();
component.setBounds(cellRect);
component.validate();
else
TableCellRenderer renderer = table.getCellRenderer(row, column);
Component component = table.prepareRenderer(renderer, row, column);
if (component.getParent() == null)
rendererPane.add(component);
rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y,
cellRect.width, cellRect.height, true);
//end of class
Maybe you are looking for
-
Hi I am trying to migrate EJB2.x code from JBoss to Weblogic 10.3.4. The entity bean description in my weblogic-ejb.jar looks like below. <weblogic-enterprise-bean> <ejb-name>UserProfile</ejb-name> <entity-descriptor> <persistence> <persistence-use>
-
Hi all. I have a problem with webutil on the server-side. On my client-machine (operating system windows xp service pack2) everything it is ok. But when I run webutil on the server (operating system Linux), I have this message error: "The webutil obj
-
Why is it impossible to see an appointment "time" in ical/maverick OS on macbook air?
Why is it impossible to see an appointment "time" in ical/maverick? How could this be a good thing when looking at appointments at a glance in day view and you come to a screeching stop because the TIME is invisible, while in month view time isn't t
-
can i use sum in where clause eg select from table_name id_klient,name,lastname,sum(number_of_products) from Klients k,Sales s where k.id_klient=s.id_klient and sum(number_of_products)>100
-
Extracting material classification data for given sales order
Hi Experts, Requirement is I Need to display a report with material and its characteristics values for given sales order. Please let me know if there is any FM/standard tables involved to display the below fields. Sales order number, Sales order line