How to get the index of children in JTree?
could you give a example please?
THANKS
Are you sure you are using JTree? (I couldn't find a method named getIndex at all!)
As I couldn't quite understand what you are getting at, one thing that would be helpful is if you refer to "How to use Trees" in The Java Tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
Similar Messages
-
How to get the index of selected values in SelectManyChoice...
How to get the index of selected values in SelectManyChoice... the value which i get is coming when i submit the value second time
By using the given code i get the value of the selected indices, but problem here is i get the value when it get submits at the second time... First time the length of that int array is 0.
Second time it shows the value two times (i.e) First time submitted value and the second time submitted value. After that it works fine.. I have problem while clicking first time only..
The Following error also raises.. One multiselect is dependent on other multiselect.
DF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase PROCESS_VALIDATIONS 3
java.lang.ArrayIndexOutOfBoundsException: 6
at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.findObjectFromIndex(FacesCtrlListBinding.java:334)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.getInputValue(FacesCtrlListBinding.java:199)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2416)
at oracle.jbo.uicli.binding.JUCtrlListBinding.internalGet(JUCtrlListBinding.java:3717)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.internalGet(FacesCtrlListBinding.java:500)
at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
at javax.el.MapELResolver.getValue(MapELResolver.java:164)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(Unknown Source)
at com.sun.el.ValueExpressionImpl.getValue(Unknown Source) -
How to get the index of a h:column element?
Hi!
I'd like to know how to get the index of a <h:column> element.
Here is the code of what I'm trying to do:
<h:column>
<a:commandLink
value="#{familyAction.familyDocsByPrj}"
action="#{homeAction.search(ROW_INDEX)}"
reRender="rightAppPanel" />
</h:column>When clicking a row, I'd like to make a "search" depending on the selected row.
Does anybode know how to do that?
Thanks a lot :)Thanks a lot for all your answers! :)
I finally got to do something with my little knowledge =P
I created a new class containing all the data needed for the dataTable (including a "String id").
And that's what I get:
<h:column>
<a:commandLink
value="#{familyAction.familyDocsByPrj.name}"
action="#{homeAction.search(familyAction.familydocsByPrj.id)}"
reRender="rightAppPanel" />
</h:column> -
How to get the index of the word at current cursor position in the word?
Dear All
I am implementing a spell checker of my native language in Word. Whenever I run spell checker it start from the first word. How can I make it to start from the current cursor position? How can I get the index of the word at the current cursor position?
Thanks in advance.
Dharam Veer Sharmahi Dharam Veer Sharma,
Thanks for sharing the solultion with us.
It is helpful for others who have the same issue. And if you have any Office developing issue, please feel free to open a new thread.
Have a nice day.
Regards & Fei
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 get the index of subform in dynamic Forms??
We are creating a Dynamic Form in which there is a field "PAN number" in a block. With the Script, we are replicating the blocks. Suppose there are 10 blocks (hence 10 PAN number fields will be there) and if the user wants to enter the PAN number in any of the blocks, how can we get the index of the block on which a value has been entered?
Are you sure you are using JTree? (I couldn't find a method named getIndex at all!)
As I couldn't quite understand what you are getting at, one thing that would be helpful is if you refer to "How to use Trees" in The Java Tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html -
How to get the index of the minimize point
Need to get the index of the minimize point, marked as red cycle in the attached word file.
It is a collected data from different sample devices, so the curve may change a bit each time. But the overall profile is the same, just 2 main peaks.
I tried to detect the Y difference to see when the difference values change from negative to positive.
But, there are noise as tiny peak when zoom in, shown in word file. Then tried to use median filter to make it smooth. (Maybe better method should be used.)
But there are still some bigger regional peak. Any suggestion?
Is there any labview function or better algorithm can make it. Many thanks for your help.
Solved!
Go to Solution.
Attachments:
Curve shots(zoom in).doc 294 KB
Sample Data 1.vi 22 KB
Sample Data 2.vi 16 KBA trick I often use is to sample the data with a much higher speed than needed. Then I apply some simple averaging methods or and median filter. After that I downsample the signal to a adequate rate by averaging x samples. This have been a saver for me more than once. How successful it is depends of noise character type. It just a hint as it may not be applicable in your application
Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far) -
How to get the index of a row in dynamically generated list
Hi,
I am displaying a list which contains 6 rows using <logic:iterator/>
If i am changing a text value which is in 3 row, I want to pass that row index to the javascript function.
I am using IndexId attribute of <logic:iterator> to get the index of a row,but
It is working fine for Hyperlink buttons, but it is no working for text boxes.
can any one plz help me..
Thanks,
madhumadhu,
Please post your code... It's a bit like asking a mechanic to fix your car blind folded. -
How to get the index value from rich:dataTable in jsf2.0
hi,
I am developing web application using jsf2.0. In this case, I used rich:dataTable tag for display the values from mysql.
so this is working..
my problem is, How to select the perticular row or index from the datatable for another processing...
help me..
Thanks.Hi,
You need to get the selectedIndex attribute of the drop down element, e.g.
String ind = web
.element(
41,
"/web:window[@index='0' or @title='Our Business Web Site']/web:document[@index='4' or @name='optBody']/web:form[@name='frmOptions' or @index='0']/web:select[(@name='PathLen' or @index='2')]").getAttribute("selectedIndex");
System.out.println("Drop down index is: " + ind);
You can use the Object Browser to get the path to the element you are interested during recording.
Regards,
Jamie -
Is there a way to find out how to get the index of a column?
Hello,
I want to know the index of a column for example the column at the first position in a jtable is 0 so how can i get this index?
for example: the column called "surname" is index 0 but the user can move the column. So the name stays the same but the index of the column changed. I search for a method like
table.getColumnIndex("surname");I think it really depends on what the OP is trying to do. I think the program
below offers up the possible choices pretty well.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableColumnIndexDemo extends JFrame {
private JTable table;
private String[] names = new String[]{ "One", "Two", "Three", "Four", "Five" };
public static void main( String args[] ) {
SwingUtilities.invokeLater( new Runnable() {
public void run() { new TableColumnIndexDemo(); }
public TableColumnIndexDemo() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel( names, 1 );
table = new JTable( model );
JButton button = new JButton( "Print indices" );
button.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
printIndices();
getContentPane().setLayout( new BorderLayout() );
getContentPane().add( button, BorderLayout.NORTH );
getContentPane().add( new JScrollPane( table ), BorderLayout.CENTER );
getContentPane().add( new JLabel( "Move columns around then print indices" ), BorderLayout.SOUTH );
setSize( 300, 150 );
setVisible( true );
printIndices();
private void printIndices() {
TableColumnModel columnModel = table.getColumnModel();
TableModel model = table.getModel();
StringBuffer sb = new StringBuffer();
System.out.println( "Visible order");
for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
if ( k > 0 ) sb.append( ", " );
sb.append( k ).append( " " ).append( columnModel.getColumn( k ).getIdentifier() );
System.out.println( sb );
sb = new StringBuffer();
System.out.println( "By name using getColumnIndex(TableModel,name)" );
for( int k = 0; k < names.length; k++) {
if ( k > 0 ) sb.append( ", " );
sb.append( getColumnIndex( model, names[k] ) ).append( " " ).append( names[k] );
System.out.println( sb );
sb = new StringBuffer();
System.out.println( "By name using columnModel.getColumnIndex(name)" );
for( int k = 0; k < names.length; k++) {
if ( k > 0 ) sb.append( ", " );
sb.append( columnModel.getColumnIndex( names[k] ) ).append( " " ).append( names[k] );
System.out.println( sb );
sb = new StringBuffer();
System.out.println( "Model index by visible order");
for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
if ( k > 0 ) sb.append( ", " );
TableColumn column = columnModel.getColumn( k );
sb.append( column.getModelIndex() ).append( " " ).append( column.getIdentifier() );
System.out.println( sb );
public static int getColumnIndex(TableModel model, String name) {
for(int i = 0; i < model.getColumnCount(); i++) {
if( model.getColumnName(i).equalsIgnoreCase(name) ) {
return i;
return -1;
} -
How to get the index of the error record when uploaded using standard LSMW
Hi Experts,
When uploading data using lsmw standard batch input method which creates an error session if any errors,how can we able to find the index of the error record
eg: If 3rd record in input file is incorrect then error session is getting created with the error and index as 1.But I want to know that 3rd record in my input file is incorrect.
Please help me out.Srinivas,
In global data, i've written like this.
TYPES: BEGIN OF TYPE_ERROR,
INDEX TYPE I,
END OF TYPE_ERROR.
DATA: GT_ERROR TYPE TABLE OF TYPE_ERROR,
GS_ERROR TYPE TYPE_ERROR,
GV_TOTAL_COUNT TYPE I, GV_INDEX TYPE I,
GV_STRING TYPE STRING,
GV_FILE TYPE STRING VALUE '/usr/sap/interfaces/LSMW/Asseterror
In Begin of transaction,
GV_TOTAL_COUNT = GV_TOTAL_COUNT + 1.
In End of processing,
OPEN DATASET GV_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
CLEAR GS_ERROR.
LOOP AT GT_ERROR INTO GS_ERROR.
CONCATENATE 'INDEX OF THE ERROR RECORD IS:' GS_ERROR INTO GV_STRING.
TRANSFER GV_STRING TO GV_FILE.
CLEAR: GV_STRING, GS_ERROR.
ENDLOOP.
ENDIF.
How and where will I be assigning error count and append it to the internal table.
Please help me out. -
How to get the index of the clicked button on TOOLBARBUTTONCHOICE
Hello Experts,
I have used toolbarbuttonchoice and created the dropdown list of the buttons dynamically. now when any of the button is clicked i need to get the reference of the button to call appropriate code in the action, but i am unable to get the either the reference or index of the clicked button.
Please help.
Regards,
KinshukHi Sascha,
My code goes this way
data:
lr_btn_ch type ref to if_wd_view_element,
lr_toolbar_btn_choice type ref to cl_wd_toolbar_btn_choice,
lr_row_data type ref to cl_wd_row_data,
item type string,
action type string.
CALL METHOD view->get_element
EXPORTING
id = 'BTNCH' " button choice Element in layout
receiving
element = lr_btn_ch
lr_toolbar_btn_choice ?= lr_btn_ch.
DATA: lt_items type string_table,
lt_actions type string_table.
loop at lt_dyntab into ls_dyntab.
append ls_dyntab-name to lt_items.
append 'ONBTNCH' to lt_actions.
endloop.
i get the data in the table lt_dyntab from API not in context
loop at Lt_items into item.
read table Lt_actions index sy-tabix into action.
create_choice_item( i_toolbar_btn_choice = lr_toolbar_btn_choice i_item = item i_action = action i_view = VIEW ).
endloop.
create_choice_item creates the menu item for the button choice..
My question is where should i call the map_on_action method. and how do i retrieve the index or reference in ONBTNCH method.
please elaborate.
Regards,
Kinshuk -
How to get the index of a Column
Hello,
I want to know the index of a column for example the column at the first position in a jtable is 0 so how can i get this index?
for example: the column called "surname" is index 0 but the user can move the column. So the name stays the same but the index of the column changed. I search for a method like
table.getColumnIndex("surname");So why do you post questions on multiple forums.
Like I said you are wasting peoples time. We don't know what has been suggested on the other forums. So by answering the question here we are wasting our time because you also probably got the answer on the other forum as well. -
How to get the index of framed color box control in 2 D framed color box array
Hi,
In project, I want to show the different status (Std By, TIP, Pass & Fail) with different color for 200 color boxes arranged in 20X10 (2 D array). When user click on any of the array item, I want to show the details, so I want the index of the item. How can I get it?
Thanks,
Shrinivas
Solved!
Go to Solution.Why an array? There's more than one way to skin a cat
See attached
"In theory, theory and practice are the same. In practice, they’re not."
Attachments:
CatSkinned.vi 19 KB -
JSTL how to get the index of a ResultSet
in jsp can use like this
rs.getString(1);//rs is a ResultSet
and how to do this in JSTL?
<sql:query var="rs">
select count(*) from my
</sql:query>
${rs.rows[0].??????}Look at the API for the classes used by JSTL: http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html
The jstl:query var object is of type javax.servlet.jsp.jstl.sql. Result
(see http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/sql/query.html for details on the sql:query tag)
The rs has the following available to it:
rs.columNames (a String[])
rs.rowCount (and int)
rs.rows (an array of sorted maps)
rs.rowsByIndex (an Object[][])
rs.limitedByMaxRows (boolean)
The ones that might be helpful are:
rs.columnNames. As a String array, with one value per column, you try to get the count of objects in the array, or iterate through them when you are reading each row (maybe not the best idea)
rs.rows returns a SortedMap for each row. As a Map, it has the size() method which would tell you how many items. But it would also let you iterate through the map getting the values.
rs.rowsByIndes, as another means of counting the length of the columns via an array
Unfortunately, all of these means at getting to the value you want do not follow the JavaBeans specs, so you can't use simple JSTL or EL to get at them.
But once again, we could use the JSP function library to get at the data ( http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fn/tld-summary.html )
For instance, we might be able to do this:
<c:set var="colCount" value = "${fn:length(rs.rows[0])}"/> or
<c:set var="colCount" value="${fn:length(rs.columnNames)}" />
However, I have never tested this stuff (which is why I walked through the thought process here. If you follow along, and I made a mistake, you might be able to pick it up and fix it...) -
How to get the index of table row without selection?
Hi all,
I have an table designed in XML view.Now i have added an change method for qty cell "valqty". When user inputs the qty in the cell and press enter this method is triggered now I want to know which index of the table is currently edited.Through which i can get the value of other cell in the same row.
NOTE: The table row doesn't have selection either multiple or single
I tried the following inside the valqty method but it now working
this.getValue();
this.getBindingContext().getProperty('PRD_NUM');
<Table id="idProductsTable"
inset="false"
items="{oModel>/deliverylist}"
visibleRowCount= "7"
mode="MultiSelect"
modeAnimationOn="true">
<headerToolbar>
<Toolbar>
<Label text="Products"></Label>
</Toolbar>
</headerToolbar>
<columns>
<Column
minScreenWidth="Tablet"
demandPopin="true">
<Text text="Order" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true">
<Text text="Quantity" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{oModel>PRD_NUM}" />
<Input value="{oModel>DEL_QUAN}" change="valqty" maxLength="13" />
</cells>
</ColumnListItem>
</items>
</Table>
ThanksThanks Robin,
But in my case oEvent.getSource() is returning the cell instance and
oEvent.getSource().getBindingContext() is undefined
Hence not getting the value
I also tried the following
oEvent.getSource().getParent().getParent().indexOfItem()
But index returned is -1
Maybe you are looking for
-
How to find the inserted values in alv
Hello All, How to find the inserted and deleted values in ALV. Regards, lisa.
-
Case statement Not working with Oracle version 10g
Below is code , which works on 11r2 but not on 10g. declare v1 VARCHAR2(200); begin select version into v1 from DBA_REGISTRY WHERE COMP_NAME LIKE '%Catalog Views%'; CASE WHEN v1 like '10.2%' THEN DBMS_OUTPUT.PUT_LINE('it is 10.2'); dbms_stream
-
Want an alv program that contains events
**Hello experts** **I am new to abap practicing alv i can write simle alv proram using reuse_alv_grid_display ,but i have doubt in events** **i.e how to use it .If possible please send some program using slis_t_event and slis_alv_event.**
-
Database structure documentation tool
I have been asked to include the database structure of our application in the help. It doesn't look as though there is a tool within RH that will do this but I thought it was worth asking in case it's hidden away somewhere. If not, there are plenty o
-
Opening .cgi Files in DW
I'm guessing there isn't anything to open .cgi's in DW because i've been googling for a while now. figured i'd ask here if anyone knew of any plugins or anything..