How do I get a value of a cell when user selects in a JTable?
Hi everybody,
I need some help in order to complete my task. I 've a JTable. When user selects any particular column . I should able to get user selected value. I added a MouseListener to the table. And I 've written the following code - in mousePressed()
JTable table = (JTable) e.getSource();
iint col =JTablePartNumbers.getInstance().getSelectedColumn();
int row = JTablePartNumbers.getInstance().getSelectedRow();
System.out.println("row col value" +JTableModelPartNumbers.getInstance().getValueAt(row,col));
I'm getting col and row value but when I'm using TableModel.getValue(row,col) - it is giving me null value.
And my getValueAt() method is defined as
public Object getValueAt( int nRow, int nCol )
System.out.println("the nRow" nRow "And nCol " nCol "And row count" + getRowCount());
int rowCount = getRowCount();
System.out.println("the row count" +rowCount);
if ( ( nRow < 0 ) || ( nRow >= getRowCount() ))
return null;
// Taking
StartNewRevisedGenericSGMLFragmentsModel row = (StartNewRevisedGenericSGMLFragmentsModel) partNumberDetails.elementAt( nRow );
// System.out.println("row value" nRow "Col value" +nCol);
switch ( nCol )
case 0:
return row.getParNo(); case 1:
return row.getRev(); // gets model data
case 2:
return row.getDoneDate( );// gets revision data
Vector rowVec = (Vector) partNumberDetails.get(nRow);
return (String) rowVec.get(nCol);
so please help me out resolving this problem.
Thanks in advance
purnima
try calling jtable.getSelectionModel().addListSelectionListener(...)
by the way, any good design of a generic UI Table must have a feature to do what you're talking about in an easy way. If it didn't, why would anyone use it?
Similar Messages
-
How to set/get the values thru Wedbynpro coding for User mapping fields
Hi All
In system object we have the user mapping fields like District,city,plant,Salesmanager.
now we want to set/get the values of these usermapping fields of system object thru webdynpro coding...
if anybody have sample codes of the same then it would be great help to me
Thanks in advance
Thanks
Trisha RaniHi Kavitha
Thanks for your reply
My requirement is exactly as follows.
1) i have created one portal system object in system administration and also i created usermapping fields in the system object from the usermanagement in system object.
i created the user mapping fields like Plant,SalesManager,District etc.
i also created the system alias name for the same system object
2) Now i came to persoanlize link and mapped the system object to the portal user.
while mapping to the system object we need to enter Mapping userId, Password , once we enter these values and we can also enter the values of usermapping fields which we defined while creating the system object ( for example District,Salesmanager,Plant etc)
once we enter all the values and click on save then these usermapping values to be mapped to the portal user.
3) Now my requirement is , i want to control the usermapping field values thru webdynpro coding for setting/getting the values.
I need sample code of the same.
Please let me know if u need more details on the same.
Thanks
Trisha Rani -
How do I get the value of material automatically when entered the material
Respected,
when I have created service notification in customer service .Then next process comes for creating service order and sales order but when I enter the material in sales order it should pick the value of that material automatically but it is not picking the value of the material automatically so where should I change the setting so I will get the value automatically of that material .
thanks
AVANISH GULATEE- -- - -- - - -
-
How do I get PS CS5 to stop freezing when I select the type tool?
Okay, I've read the other threads about photoshop cs5 freezing up for various reasons. I'm running it on os x 10.5.8 on a dual quad 2.8 processor tower. Every time I open PS and select the type tool, my entire computer slows and freezes to the point I have to do a hard restart. I've tried disabling all fonts and the same things happens (though when they're all disabled I do get a text cursor before things hang up). I'm looking for any advice--I spend the entire day today trying to fix this.
Chris, I tried updating and it wouldn't install... Are you not allowed to install updates when you are using the "trial version"?
I sure would like to get this resolved before investing in the actual purchase of CS5. I always get the Master Collection and it's expensive.
So, if I can't install the update and try and find a fix to the issue, I don't think I'd be comfortable purchasing... you know?
That's why I ALWAYS download the trial version first... to see if there are issues before buying!
Anyway... I'll keep my eye on these posts to see if this has been cleared up... then, I'll buy.
But, thanks very much for your help and feedback to my question and concern.
appreciate it! -
How can i get all values from jtable with out selecting?
i have one input table and two output tables (name it as output1, output2). Selected rows from input table are displayed in output1 table. The data in output1 table is temporary(means the dat wont store in database just for display purpose).
Actually what i want is how can i get all values from output1 table to output2 table with out selecting the data in output1 table?
thanks in advance.
rajaYou could set the table's data model to be the same:
output2.setModel( output1.getModel() ); -
How can I get command values from a VI executed by reference ? NEWBIE
Hi,
I'm running a sub-vi in a "Secondary Front Face" (excuse for the
translation if not correct, I'm working on a French version). In order
to run this VI, I pass a reference. All is working fine but I don't
know how can I get the values entered by the user in this VI ?
Actually I run a main VI wich contains a "Secondary Front Face" (this
SFF is contained in a tabbed pane). In my diagramm, I pass a reference
to another VI (by the name of the file *.vi). If my user enter a word
in a text field, I would like to be able to get it in my main app.
Thanks for your help.Hello,
You might take a look at the following tutorial for more information about calling a VI by reference. It's got some great visuals and examples.
Tutorial: Calling a VI by Reference
You might also consider just calling the secondary VI as a simple subVI, if you can spare the memory space when loading the main application, as this is the easiest way to input and output VI values.
I hope this helps! Please let me know if I can be of any further assistance.
Liz F
National Instruments -
How to get the value from a function using a select statement
I have a function(user defined not built in) that returns multiple values(like an array). My question is how do i get those values in a select statement. when i tried to retrieve it,
select pack.my_members from dual;
i am getting an error
ORA-00902: invalid datatype
I am sure this must be a syntax error with the select statement
The following is the function that give the array of data
package pack
package spec
Type my_table is table of varchar2(25);
function the_members
return pack.my_table;
pakcage body
function the_members return pack.my_table
Remarks: This function returns a table containing names of the
members
is
tm pack.my_table:= pack.my_table('first member','second member','third member','fourth member');
begin
return tm;
end the_members;Check this example on Pipelinedfunction
-
Please, How do i get the values from a h:selectManyCheckbox ?
How do i get the values (selected or not) of a <h:selectManyCheckbox> tag and show them .For instance
i have the folowing options :
<h:selectManyCheckbox
id="cartas"
layout="pageDirection"
value="#{store.cartas}">
<f:selectItems
value="#{cartas}"/>
</h:selectManyCheckbox>
<h:message styleClass="validationMessage" for="newsletters"/>with my faces-config.xml:
<managed-bean>
<description></description>
<managed-bean-name>cartas</managed-bean-name>
<managed-bean-class>java.util.ArrayList</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<list-entries>
<value-class>javax.faces.model.SelectItem</value-class>
<value>#{cartas0}</value>
<value>#{cartas1}</value>
<value>#{cartas2}</value>
<value>#{cartas3}</value>
</list-entries>
</managed-bean>
<managed-bean>
<managed-bean-name>cartas0</managed-bean-name>
<managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>Semanal</value>
</managed-property>
<managed-property>
<property-name>value</property-name>
<value>200</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>cartas1</managed-bean-name>
<managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>As bruxas</value>
</managed-property>
<managed-property>
<property-name>value</property-name>
<value>201</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>cartas2</managed-bean-name>
<managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>Exercise</value>
</managed-property>
<managed-property>
<property-name>value</property-name>
<value>202</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>cartas3</managed-bean-name>
<managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>Gusman Park</value>
</managed-property>
<managed-property>
<property-name>value</property-name>
<value>203</value>
</managed-property>
</managed-bean>Thanks for the atention!! All the best!!Hi,
In your backing bean you will need to add a new variable to bind your control to, I think this variable needs to be of teh "HtmlSelectManyCheckbox" type. The on your jsp page you can add binding="#{myBean.myVariable}".
When you want to get the values of the selectMany in your backing bean, you can call the getSelectedValues() function on your HtmlSelectManyCheckbox variable.
in backing bean:
private HtmlSelectManyCheckbox hsmc;
public HtmlSelectManyCheckbox getHsmc(){
return hsmc;
public void setHsmc(HtmlSelectManyCheckbox hsmc){
this.hsmc = hsmc;
public void someFunction(){
Object[] obs = hsmc.getSelectedValues();
}On jsp page:
<h:selectManyCheckbox
id="cartas"
layout="pageDirection"
value="#{store.cartas}"
binding="#(myBean.hsmc}">
<f:selectItems
value="#{cartas}"/>
</h:selectManyCheckbox> -
How we can get the values from one screen to another screen?
hi guru's.
how we can get the values from one screen to another screen?
we get values where cusor is placed but in my requirement i want to get to field values from one screen to another screen.
regards.
satheesh.Just think of dynpros as windows into the global memory of your program... so if you want the value of a field on dynpro 1234 to appear on dynpro 2345, then just pop the value into a global variable (i.e. one defined in your top include), and you will be able to see it in your second dynpro (assuming you make the field formats etc the same on both screens!).
-
How do I get the values from a form?
How do I get the values from a form?
You can try using request method..
request.getParameter("yourFormInputName");
Try this. -
How do i get the value in a variable that I don't know the name of til run
I have a record type( pr_team) defined in a package - anchored to a table.
I want to be able to go through each of the fields in it one at a time. I get the list of fields from the table definition from cursor as follows
CURSOR c_fields IS
SELECT column_name
FROM all_tab_cols
WHERE owner = 'CDS'
AND table_name = 'TEAM';
r_fields c_fields%ROWTYPE;
So first returned value is team_id
how can I get this value when all I know the field name is 'pr_team.' || r_fields.column_name
cheers
SimonOracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> CREATE OR REPLACE PACKAGE package_name
2 AS
3 r_emp emp%ROWTYPE;
4 END package_name;
5 /
Package created.
SQL> SET SERVEROUTPUT ON SIZE UNLIMITED;
SQL> DECLARE
2 v_empno emp.empno%TYPE;
3 v_ename emp.ename%TYPE;
4 BEGIN
5 SELECT *
6 INTO package_name.r_emp
7 FROM emp
8 WHERE ROWNUM = 1;
9
10 EXECUTE IMMEDIATE
11 'BEGIN ' ||
12 ' :v_empno := package_name.r_emp.empno; ' ||
13 ' :v_ename := package_name.r_emp.ename; ' ||
14 'END;'
15 USING OUT v_empno, OUT v_ename;
16
17 DBMS_OUTPUT.PUT_LINE ('v_empno => ' || v_empno);
18 DBMS_OUTPUT.PUT_LINE ('v_ename => ' || v_ename);
19 END;
20 /
v_empno => 7369
v_ename => SMITH
PL/SQL procedure successfully completed.
SQL> -
How can I get the value of "Warehose" column in a form
How can I get the value of "Warehouse" column in the form below (I mean what table that contain this value):
Production Supervisor >> Batches >> (Button) Material Details >> (Button) Line Allocations
Well, for more clearly! My problem is I must have the Unit Cost of Items, so I've got it in the cm_cmpt_dtl (table), but if I want to, I must create a relation that require 2 filed, they're Item_ID and Whse_Code.
There's no problem with Item_ID, but Whse_Code seem to be the Mission Impossible (hix, I hate that film!!!!)
I wonder if It was right to post this topic here. But anyway I just post my question here, hope I could get some help.wow, many, many, many.... and many thanks!
Just add a tiny modify to check out the Batch_type
doc_id = (select batch_id from gme_batch_header where batch_no='&batch_number' and batch_type = 0)
Because the batch_no can be duplicated as we also create Batch and Filrm Planned Order.
Many thanks for your support!
P/S: Sorry for my terrible English :P -
How to add get Day value in a Date object?
Hi,
I am writing a sql statement that has two date values. One I am getting it from the database. The format in the database is MM/DD/YYYY. My first question is how do I convert the format into the java date format, YYYY-MM-DD. The second question is I need to find out what the day is and add 1 to it. How do I get Day value in a Date object?
Thanks.Look at "SimpleDateFormat" and "parse" in the archives.
-
How do you get the value of a selected list item?
I have a drop-down list that the user can choose from. How do I get the value of what they selected? I thought I could do this by using the NAME_IN function, but I'm getting FRM-40105 Unable to resolve reference to item X. I don't know what I'm doing wrong.
Thanks!Hi,
You can use an WHEN-LIST-CHANGED trigger, attached to the list-item itself. And, in this trigger, you can use the name of the item to refer its value.
For example:
:block_name.list_item_name
John -
How can we get the value of the key field in a custom data model using governance API?
Dear Team,
How can we get the value of the key field in a custom data model, to be used for manipulation of the change request fields using governance API?
Any kind of help would be sincerely appreciated.
Thanks & Regards,
Tushar.Hi Michael,
Thanks for direction. Let me give more context on this as I'm interested to get more details..One of the issue was to read cross entity field values on UI based on user action and set other entity field behaviour...It is similar to what is being posted here.
For ex: Reading MTART from Basic Data UIBB in MM MDG UI and set the field properties in some other custom entities say ZZETEST. This cannot be done using UI BADI as it only supports single entity at a time and not cross entity. So alternatively we found a solution where we can enhance existing PLMB feederclass cl_mdg_bs_mat_feeder_form by reading the model and the entity as needed as it it proved that it supports cross entity UI field behaviours and so business requirements.
This is a workaround for now.
So the question is How do we achive it using governance API for cross entity field behiaviours.?or what is the right way doing this.
Can we do that using governance API and its' methods?
In the Governance API doc you provided below has referring to below external model as part of gevernance API.
The active or inactive data (before or during the derivation or the check) can be read
with the external data model interface IF_USMD_MODEL_EXT with the method READ_CHAR_VALUE and
the corresponding READ_MODE parameter. To avoid unnecessary flushes (derivations), the NO_FLUSH
parameter should b
e set to ‘X’.
Thanks
Praveen
Maybe you are looking for
-
Syncing iPhoto library on two computers
My wife wants to have access to her VERY LARGE iPhoto '08 library on two computers - the desktop (her preferred) and the laptop (when the boys are doing homework on the desktop). Rather than try to share the same library (i.e., networked drive), I se
-
How to prevent 2 currencies in sales order
we have a problem i am using one condition type in two pricing procedure one pricing procedure has price in INR and one has USD i am facing a problem when a part number price is not updated in USD it is picking in the INR price , i need to prevent 2
-
Defining/Creating a JMS Queue in XI
Scenario: Third party system would post messages in XI Jms queue, the messages would ultimately be sent to SAP. Need to create this JMS queue in XI which receives Jms messages from third party. Steps done: 1) Defined Sender Communication Channel 'CC_
-
Update statistics with 640_EX2 kernel
Hello, I'm no longer able to do UPD_CHECK, UPD_COND and UPD_UNCOND since upgrading to a 640_EX2 kernel. This happens on WebAS 6.20 on Linux IA32 and on WebAS 6.40 on Linux X86_64. Scheduling backups and verifys still works from db13. MaxDB version is
-
I am using JSR168 portlet API.how to navigate between portlets