How to fill the data in JTable at runtime
Hi all,
I am having a JButton and also a JTable.
Now my problem is that intitially am setting the value of each column in the table to zero.
But when I click the JButton i have to fill the JTable with all the new values.
Please hepl me out solving this problem.
I am really struck.
Regards
RAKESH SAGAR
If other suggested links give you nothing - take a look at:
http://forum.java.sun.com/thread.jspa?threadID=699117
It seems Tjirpovf have code somewhat similar what you are asking for ("reply 5" - fill table with data from GUI). And you might even find my answer to his question useful ("reply 7" - fill table with data from file and save table data to file).
Similar Messages
-
How to fill the data in extraction queue (LBWQ)?
Hi,
I modified the structure of datasource 2LIS_02_SCL (change an append structure), since an error occurs when I check the datasource, I deleted the the deltaqueue in RSA7, before that, I also checked the extractorqueue, it was empty.
But when I excute OLI3BW to fill the extractor queue, it happens nothing.
How can I fill the data in extractor queue so that I can extract data from R3 to BW?
Thanks .
RegardsWhta u have done is Filling setup tables not the extractor queu......
Could you please tell whether ur load is delta load or Full load?
Khaja -
How to enter the values in JTable in runtime
how to enter the values in JTable in runtime
Basically you need a vector of vectors or an array of arrays. Example (off the top of my head):
With Arrays
String[] cols = { "colone", "coltwo", "colthree", "colfour", "colfive" };
String[] numbers = { "one", "two", "three", "four", "five" };
String[] letters = { "A", "B", "C", "D", "E" };
String[][] data = { numbers, letters };
//make sure that the table has a scroll pane wrapped around it otherwise the header is not displayed
JScrollPane scroll = new JScrollPane(new JTable(data, cols));
With Vectors
Vector cols = new Vector();
cols.addElement("colone");
cols.addElement("coltwo");
cols.addElement("colthree");
cols.addElement("colfour");
cols.addElement("colfive");
Vector numbers = new Vector();
numbers.addElement("one");
numbers.addElement("two");
numbers.addElement("three");
numbers.addElement("four");
numbers.addElement("five");
Vector letters = new Vector();
numbers.addElement("A");
numbers.addElement("B");
numbers.addElement("C");
numbers.addElement("E");
numbers.addElement("F");
Vector data = new Vector();
data.addElement(numbers);
data.addElement(letters);
//make sure that the table has a scroll pane wrapped around it otherwise the header is not displayed
JScrollPane scroll = new JScrollPane(new JTable(data, cols));The array or vector can be easily populated at runtime.
Regards
Riz -
How to fill the data of two different tables into one?
Hi Experts,
I have two tables named CDHDR and CDSHW(structure). I have extracted the data from these two tables through two function modules named CHANGEDDOCUMENT_HEADER and CHANGEDOCUMENT_POSITION. Now I have the data in to different tables.
These two tables neither has relationship with each other through any field nor have any field which exist in both. Can anyone tell me in this case what should be the process to take the data of both the tables into one table. How can I match the record of one table to another?
thanks a ton in advance.
Edited by: Moni Bindal on Apr 28, 2008 4:16 PM
Edited by: Alvaro Tejada Galindo on Apr 28, 2008 1:42 PMHye Bindal,
without a relation, it is not possible to club the data of 2 internal tables. More over it depends on the requirement as to y u should club to non related quantities in an internal table.
if you wish to do so, one thing is it has internal table which includes the strucute of the 2.
data: begin of ty_out,
first type first_structure,
second type second_structure,
end of ty_out.
data: itab type standard table of ty_out.
data: wa type ty_out.
loop into it1 into wa1.
move corresponding wa to wa1.
append wa to itab.
endloop.
loop into it2 into wa2.
move corresponding wa to wa2.
append wa to itab.
endloop.
now the internal table itab will have all the contents of it1 and it2.
<REMOVED BY MODERATOR>
Thanks,
Imran.
Edited by: Alvaro Tejada Galindo on Apr 28, 2008 1:43 PM -
how do i keep only the name of a month in a cell in Numbers and not have it auto fill the date and time?
Hi JN and Barry,
Barry wrote:
The second case may not be included in the available D&T formats in Numbers 3
For my region, the Date & Time data formats include month.
The Date Pop-Up
This may not be the case for all regions.
Remember that the month is only the display, and the Full Date & Time is still there. If I change the format to reveal what is behind the curtain:
Regards,
Ian. -
How to capture the data entered in a textfield in a JTable
How to capture the data entered in a textfield present in a cell of a textfield or how to add listener to this textfield
A sample of my code is:
model = new GridDisplayTableModel(gridDisp,columnName,getRows(),getCols());
final ComboRenderer cRenderer = new ComboRenderer();
final TextFieldRenderer tRenderer = new TextFieldRenderer();
combo.addItem("one");
combo.addItem("two");
combo.addItem("three");
final JTextField textfield = new JTextField();
final DefaultCellEditor cmbEditor = new DefaultCellEditor(combo);
// final JEnterDataCellEditor textEditor = new JEnterDataCellEditor(12);
final DefaultCellEditor textEditor = new DefaultCellEditor(textfield);
rm = new RowEditorModel();
table = new JTable(model){
public TableCellRenderer getCellRenderer(int row, int column) {
int posx = 0;
int posy = 0;
TableCellRenderer renderer = null;
for(int l=0;l<getDataVec().size();l++)
beanObj =(Helperbean)dataVec.elementAt(l);
posx = beanObj.getPosx();
posy = beanObj.getPosy();
if(row==posx && column==posy)
if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
rm.addEditorForRow(row,textEditor);
renderer = tRenderer;
else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
rm.addEditorForRow(row,cmbEditor);
renderer = cRenderer;
break;
renderer = super.getCellRenderer(row, column);
// System.out.println("getEditor"+rm.getEditor(1));
return renderer;
public TableCellEditor getCellEditor(int row, int col) {
int posx = 0;
int posy = 0;
TableCellEditor tmpEditor = null;
for(int l=0;l<getDataVec().size();l++)
beanObj =(Helperbean)dataVec.elementAt(l);
posx = beanObj.getPosx();
posy = beanObj.getPosy();
if(row==posx && col==posy)
if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
System.out.println("celleditorval "+textEditor.getCellEditorValue());
tmpEditor = textEditor;
else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
tmpEditor = cmbEditor;
break;
tmpEditor = super.getCellEditor(row, col);
return tmpEditor;
public boolean isCellEditable(int row,int col){
boolean isEditable = false;
int posx = 0;
int posy = 0;
for(int l=0;l<getDataVec().size();l++)
beanObj =(Helperbean)dataVec.elementAt(l);
posx = beanObj.getPosx();
posy = beanObj.getPosy();
if(row==posx && col==posy)
if(beanObj.getModeofDisplay() != null )
isEditable = true;
else
isEditable = false;
break;
isEditable = false;
return isEditable;
public void changeSelection(final int row, final int column, boolean toggle, boolean extend) {
super.changeSelection(row, column, toggle, extend);
//my attempt to avoid editCellAt from being called twice in a row
if (getModel().isCellEditable(row, column) && !(isEditing() && getEditingRow() == row && getEditingColumn() == column))
if (editCellAt(row, column)) {
getEditorComponent().requestFocus();
// Select the text when the cell starts editing
public boolean editCellAt(int row, int column) {
boolean result = super.editCellAt(row, column);
final Component editor = getEditorComponent();
if (editor != null && editor instanceof JTextField) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
((JTextField)editor).selectAll();
return result;
public boolean hasFocus()
Component editorComponent = getEditorComponent();
// Try to install the editor
int anchorRow = getSelectionModel().getAnchorSelectionIndex();
int anchorColumn = getColumnModel().getSelectionModel().
getAnchorSelectionIndex();
if (anchorRow != -1 && anchorColumn != -1 && !isEditing())
if ((this.getSelectedRow() == anchorRow) && (this.getSelectedColumn() == anchorColumn))
if (!editCellAt(anchorRow, anchorColumn)) {}
return super.hasFocus();
public void valueChanged(ListSelectionEvent e)
super.valueChanged(e);
if ((this.getSelectedRow() == 2) && (this.getSelectedColumn() == 3))
DefaultFocusManager focusManager = new DefaultFocusManager();
focusManager.focusNextComponent(this);
model.fireTableStructureChanged();
-
How to fill the master data in ecc
Hi,
0product_attr having zero records i ecc,how to fill the master data in ecc can you pls provide me the setps?
Regrads,
devi.Hi Devi,
Loading data is ECC is not the part of BI Activities. Contact your functional consultant to load data.
BDC and LSMW both are used for loading data into SAP system.
Or ask even directly they can create in ECC. If it is for your testing purpose, it is better to ask them to create master in source system .
Thanks
BVR -
How to store the datas in a .txt file in to a JTable in Java Swing
Hi sir,
Here i want to know how to store the data's of a .txt file
in to a JTable in java swing.
Where here the .txt file like for eg,spooler.txt is in the server and from there it will come to my client machine what i have to do is to take that .txt file and store the datas of the .txt file
in a JTable.This is what i want.So pls. do help and provide the code as well.I will be thankful.Since i am involved in a project which involves this it is Urgent.
Thanx,
m.ananthuYou can't just display data from a text file in a JTable. You have you understand the structure of the data so that you can parse the data and create a table model that can access the data in a row/column format. Here is an example of a simple program that does this:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172 -
Hi y'all..I'm using Numbers as my record for my expenses,income,etc.
I have a "date" coloumn eg "13 September 2011" and after I fill the date and move on to the next table, a "+" sign appear on my date table automatically, what's that?How do i delete that?That means your column is not wide enough to display all of the content. Widen the column & the + will go away.
-
How to fill the values in List Box?
Hi Experts,
Can anyone explain me how to fill the values in the List Box such that the value should be from the table?
For Example : Fill the EmpID from table T1 into the ListBox?
Thanks in Advance,
Regards,
Raghuhi,
and u doing it through report means from se38 than here is code...
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
END OF itab.
DATA : ok_code LIKE sy-ucomm.
CALL SCREEN 0200.
*& Module STATUS_0200 OUTPUT
text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'Z200'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'UP' OR 'CANC'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Module mat_val INPUT
text
MODULE mat_val INPUT.
SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF TABLE itab
WHERE matnr BETWEEN '000000000000000101' AND '000000000000000109'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
VALUE_ORG = 'S'
tables
value_tab = itab
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " mat_val INPUT
<b>And this is flow logic..</b>
PROCESS BEFORE OUTPUT.
MODULE status_0200.
PROCESS AFTER INPUT.
MODULE user_command_0200.
PROCESS ON VALUE-REQUEST.
FIELD itab-matnr MODULE mat_val. -
How to save the data present in TEXT BOX?
Hi friends i am able to create a text editor in one of my screen but i want to know how to save the data when the text is entered in that text box and retrive when they open the screen?
Hi ,
Please check the format below since it is based on a working code
first you need to create a text in s010 function module...
there should be some key based on which you plan to save the text..imagine it is Purchase order then..PO+item numner is always unique.eg:0090010(900PO/item10).so in the code you can append these two and they will be unique..so you can always retrieve them,overwrite,save them anytime you need
**************data declarations
TYPES: BEGIN OF TY_EDITOR,
EDIT(254) TYPE C,
END OF TY_EDITOR.
data: int_line type table of tline with header line.
data: gw_thead like thead.
data: int_table type standard table of ty_editor.
****************fill header..from SO10 t-code..when you save you need the unique key..youfill it here and pass it in save_text function module
GW_THEAD-TDNAME = loc_nam. " unique key for the text -> our unique key to identify the text
GW_THEAD-TDID = 'ST'. " Text ID from SO10
GW_THEAD-TDSPRAS = SY-LANGU. "current language
GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created in SO10
*To Read from Container and get data to int_table
CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
IMPORTING
TABLE = int_table
EXCEPTIONS
ERROR_DP = 1
ERROR_CNTL_CALL_METHOD = 2
ERROR_DP_CREATE = 3
POTENTIAL_DATA_LOSS = 4
others = 5.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop data from int_table and save to int_line-tdline appending it.
*save the text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = GW_THEAD
TABLES
LINES = InT_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
IF SY-SUBRC 0.
ENDIF.
*To pass to Container
CALL METHOD EDITOR ->SET_TEXT
hope that the above sample with helps you solve the problem
Please check and revert,
Reward if helpful
Regards
Byju -
How to fill the "budget" in an initiative in SEM BSC
Good Afternoon for all!
We have a Balanced Scorecard implemented in SAP SEM BSC, using SAP BW.
Our Balanced Scorecard actually manages ratios, objectives, perspectives, strategy and scorecard.
Now, we are trying to use "iniatiatives" and we have using the SEM BSC wizard, through the web interface.
When defining the initiative everything goes ok, we define the initiative , and then we assign it to an objective.
We have also installed the infocube "0SEM_C02" which we have the understanding that it stores the information concerned to initiatives.
I have also build a SEM BPS layout and planning area for this infocube (0SEM_C02) in order to fill the infocube with information (manually entered).
But after all these, the information does not appear for the "budget" when displaying the Balanced scorecard.
When displaying an initiative it displays:
-Definition
-Duration
-Priority
-Status and score
-Milestones
-Team members
-Objectives
-Budget (<-----E M P T Y !! )
I do not understand, how to fill the "Budget" data for an initiative. Because we have fill all the information regarded to the initiative included above, but the budget is very important for us, and as i said before, we have installed the infocube 0SEM_C02, we also created a planning area for this infocube in BPS, we have created a planning layout for this infocube, and we have entered some values to this infocube.
Is there any special condition or something special to do, in order to fill the budget for an initiative in SAP SEM BSC??
How can we see in the BSC the budget for an initiative, or fill the value???
We will appreciate any help for this issue.
Thanks in advance for your valuable help.
Carlos Espana
Cementos Progreso
GuatemalaCarlos,
This is the Forum for SAP Strategy Management.
There is another Forum specifically for SEM-BSC questions.
Go to the SAP Community Network Forums > SAP Solutions > SEM-BSC
Please repost your question there for an answer.
Regards,
Bob -
How to receive the datas?
Look:
the first I create socket sk:
sk=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
and I fill data into Ip Head and Icmp Head,
then I sendto the packet,but I don't receive
any datas:
lenrecv=recvfrom(sk,buf,100,0,(struct sockaddr*)&addr,&rlen);
my codes run at the function recvfrom,but it
couldn't return variable lenrecv,and it look like down,
I want to know why?how to receive the data?
(I couldn't creat socket like this:
sk=socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
I want to know when I creat socket like this
sk=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
How to receive datas?)Last edited by joseperezc (2012-08-14 18:58:22)
-
How to insert the data using matrix
Hi
All how to insert the data using matrix feild
plz help me
thanks
LoyHi Loy,
The best way to fill an entire matrix is to use a DBDatasource, here is some sample code:
Dim oForm As SAPbouiCOM.Form
oForm = SBO_App.Forms.Item("YourFormTypeID")
'1. Add a DBDataSource to the form
oForm.DataSources.DBDataSources.Add("OUSR")
Dim oColumnDBS As SAPbouiCOM.Column
Dim oColumnUDS As SAPbouiCOM.Column
Dim i As Integer
Dim GenEdt As SAPbouiCOM.EditText
Dim oMatrix As SAPbouiCOM.Matrix
Dim oColumns As SAPbouiCOM.Columns
Dim oDBDataSource As SAPbouiCOM.DBDataSource
oMatrix = oForm.Items.Item("7").Specific
oColumns = oMatrix.Columns
'2. DBDataSource: Binding a field / alias of the table to a column
oColumnDBS = oColumns.Item("V_1")
oColumnDBS.DataBind.SetBound(True, "OUSR", "U_NAME")
'3. getting the data sources bound to the form
oDBDataSource = oForm.DataSources.DBDataSources.Item("OUSR")
oMatrix.Clear()
' Querying the DB Data source
oDBDataSource.Query()
' Adding the data to the matrix
oMatrix.LoadFromDataSource()
When you want to fill a specific field use :
GenEdt = oMatrix.Columns.Item("V_2").Cells.Item(1).Specific
GenEdt.String = "Hello" -
How to pass the data from a input table to RFC data service?
Hi,
I am doing a prototype with VC, I'm wondering how VC pass the data from a table view to a backend data service? For example, I have one RFC in the backend system with a tabel type importing parameter, now I want to pass all the data from an input table view to the RFC, I guess it's possible but I don't know how to do it.
I try to create some events between the input table and data service, but seems there is no a system event can export the whole table to the backend data service.
Thanks for your answer.Thanks for your answer, I tried the solution 2, I create "Submit" button, and ser the mapping scope to be "All data rows", it only works when I select at least one row, otherwise the data would not be passed.
Another question is I have serveral imported table parameter, for each table I have one "submit" event, I want these tables to be submitted at the same time, but if I click the submit button in one table toolbar, I can only submit the table data which has a submit button clicked, for other tables, the data is not passed, how can I achieve it?
Thanks.
Maybe you are looking for
-
How to display the first page alone first and two pages (back and front) then ?
Hi I use acrobat 9 (beginner). I have a document which should be displayed "as a book", ie two pages on the screen at the same time, the back of the first sheet and the front of the second one. The problem I have is to manage to display the cover she
-
Cucm 8.6 to 10.5 and cisco phone 7911
Hi, WE will upgrade to cucm 8.6 to 10.5. We have a lot of sccp 7911 phone. Can we use this phone with 10.5 ? Will we find the software for this phone in the 10.5 devicepack ? If not can i install cmterm-7911_7906-sccp.9-4-2-1.cop.sgn to cucm 10.5 Tan
-
Document date and creation date are diffrence
dear all, please tell me the why are the document date and created on date. like customer code is created on 12.11.2011. but sales order created on 12.10.2010. what is the diffirence of above the issue. please solve the problem. rajiv kumar
-
Reg SAP PI Certication TechEd 2008
Hi, I am Planning to take PI7.0 Certification 2008. I have Suser ID with me . What else do I require apart from this. Is NOC(no objection certificatte) from the present compant is Must for taking the examination as there is some problem in this. If t
-
Homogeneous System Copy - Installation of Database Instance not possible...
I try to create a SAP NetWeaver 7.0 SR3 Portal based on a homogeneous SAP System Copy. Therefore I already installed in a first step (first option within SAPINST for installing a target system of a system copy) the Central Services Instance successfu