How to get the current selected column and row
Hi,
A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
e.g.
I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
pricetextfield.requestFocus();
Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
My question is how do I know the current column and the current row in a JTable?
I'm not sure what your mean by the "current" row or column, but the following utility methods return
which row and column have focus within the JTable.
public static int getFocusRow(JTable table) {
return table.getSelectionModel().getLeadSelectionIndex();
public static int getFocusColumn(JTable table) {
return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
}
Similar Messages
-
JTree: How to get the currently selected node
How do I get the currently selected node in JTree?
getLastSelectedPathComponent() this method always return the last selected node and not the current one.
Thanks in advance
SachinUse
TreePath selectedPath = tree.getSelectionPath()If your tree allows multiple selections, use
TreePath [] selectedPaths = tree.getSelectionPaths() this will return an array of all selected tree paths.
Once you get the tree path, call the treePath.getLastPathComponent(). this should tell you the currently selected node.
Hope this helps
Sai Pullabhotla -
IWork Numbers -- how to determine the current selected column/row?
I am trying to write a script that grabs some text from a Numbers spreadsheet based on the selected field. I just can't figure how to actually get the column and row in a way I can use. Here's my start:
tell application "Numbers"
tell document 1
-- DETERMINE THE CURRENT SHEET
set currentsheetindex to 0
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of (tables whose selection range is not missing value)
end tell
if x is not 0 then
set the currentsheetindex to i
exit repeat
end if
end repeat
if the currentsheetindex is 0 then error "No sheet has a selected table."
-- GET THE VALUES OF THE SELECTED CELLS
tell sheet currentsheetindex
set the current_table to the first table whose selection range is not missing value
tell the current_table
set the range_values to the value of every cell of the selection range
set therange to every cell of the selection range
set thecol to column of first item of therange
set therow to row of first item of therange
end tell
end tell
end tell
end tell
It gives me a result like
row "30" of table "table" of sheet "sheet 1" of document "Scheduler.numbers" of application "Numbers"
but what I need is just "30" so I can use it for my scripts. I can't figure how to convert this to a string or some other useful format.
Can anyone help? I like Numbers but I always run into little problems like this, something I can't figure how to do, compared with other scriptable programs.Search forGetSelParams or better for get_SelParams in the existing threads.
I posted this handler more than 30 times !
Yvan KOENIG (VALLAURIS, France) vendredi 18 mars 2011 17:03:05 -
How to get the current selected value of a combo box or a option button?
Hello All,
I want to catch the current selected value of a combo box and also of a option button and want save it into different variables in my code. These option button and combo box are in a SAP business one form which I have created through VB dot.net coding.
But I don't know how to do that, can any one send any example code for this.
Regards,
Sudeshna.Hi Sudesha,
If you want to get the selected values you can do it as follows: The Combo Box value you can get from the combo box. If you want to get it on the change event, you must make sure that you check when BeforeAction = False. If you want to get an Option Button value you should check the value in the data source attached to the option button.
Dim oForm As SAPbouiCOM.Form
Dim oCombo As SAPbouiCOM.ComboBox
Dim oData As SAPbouiCOM.UserDataSource
oForm = oApplication.Forms.Item("MyForm")
oCombo = oForm.Items.Item("myComboUID")
oApplication.MessageBox(oCombo.Selected.Value)
oData = oForm.DataSources.UserDataSources.Item("MyDataSourceName")
oApplication.MessageBox(oData.ValueEx)
Hope it helps,
Adele -
VS2013 / Team Explorer vsix - How to get the currently selected build definition?
Greetings,
My goal with a simple extension is to right-click any build definition and if my "Show Build Def Stats" menu item is selected, pop a message box with some summary details I plan to pull from the IBuildDefinition interface.
I'm missing something fundamental I'm sure, but I cannot figure out how in the menu handler the actual build definition that I clicked on.
The menu command is added where I want it successfully:
Symbol info used to get this there:
<!-- This is the Build Definition Context Menu -->
<GuidSymbol name="guidTeamExplorerBuildDefContextMenu" value="{34586048-8400-472E-BBBF-3AE30AF8046E}" >
<IDSymbol name="menuBuildDefinitionContext" value="0x109"/>
</GuidSymbol>
I am stumped as to how to get the fact that I clicked the "ISRepository" build definition in either the Initialize() or MenuItemCallBack() methods, I haven't come across the right service or container object that I recognize.
Much obliged!
--JordanI have been investigating this for a while using .NET Reflector and finally I got it:
In VS 2013, add references to the following assemblies in the folder C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer:
Microsoft.TeamFoundation.Controls.dll
Microsoft.TeamFoundation.Build.Controls.dl
And then use this code:
Microsoft.TeamFoundation.Controls.ITeamExplorer teamExplorer;
Microsoft.TeamFoundation.Controls.ITeamExplorerPage teamExplorerPage;
Microsoft.TeamFoundation.Build.Controls.Extensibility.IBuildsPageExt buildsPageExt;
teamExplorer = base.GetService(typeof(Microsoft.TeamFoundation.Controls.ITeamExplorer)) as Microsoft.TeamFoundation.Controls.ITeamExplorer;
teamExplorerPage = teamExplorer.CurrentPage;
buildsPageExt = teamExplorerPage.GetExtensibilityService(typeof(Microsoft.TeamFoundation.Build.Controls.Extensibility.IBuildsPageExt)) as Microsoft.TeamFoundation.Build.Controls.Extensibility.IBuildsPageExt;
foreach (Microsoft.TeamFoundation.Build.Controls.Extensibility.IDefinitionModel definitionModel in buildsPageExt.SelectedDefinitions)
System.Windows.Forms.MessageBox.Show(definitionModel.Name);
* My new blog about VSX: http://www.visualstudioextensibility.com * Twitter: https://twitter.com/VSExtensibility * MZ-Tools productivity extension for Visual Studio: http://www.mztools.com. -
How to get the current logged in username from windows and put it into an AS var
Hello,
I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.
Thanks in advance
MichaelJust for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.
In the html page that publishes with the .swf file under the <head> section:-
<script language="JavaScript" type="text/javascript">
function findUserName() {
var wshell=new ActiveXObject ("wscript.shell");
var username=wshell.ExpandEnvironmentStrings("%username%");
return username;
</script>
The ActionScript:-
import flash.external.ExternalInterface;
var username:String = ExternalInterface.call ("findUserName");
trace (username); // a quick test to see it in output -
How to get the "current date" in the BEx?
Hi all,
I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
Thanks1. Create a New Formula in Key Figures structure
2. Give tech name and description and Select "New variable" option
3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
4. in next screene select the date characteristic that represents the first date to use in the calculation (From Date)
5. In the next screen select Key in the Replace Variable with field. Leave all the other options as they are
6. In the next Currencies and Units screen select Date as the Dimension ID.
6. Save variable
repeate the Above steps to create another variable (To Date)
and now you can use these two new replacement path variables in your new formula.
Dev -
Hello!
I'm trying to create a kind of a navigation tree for my application.
It should represent some elements of an XML structure and some other nodes for other options.
The binding with the context is not a problem, I can create the tree up to all the levels I want to.
The problem now is, that I don't know, how to get the "current tree element", when there is any action.
For example:
public void onActionSelect(...) {
String test = wdContext.currentTreeNodeElement().getText();
wdThis.wdGetContext().currentContextElement().setSelectedElement(test);
With this method I can get the text of the "first level nodes". If I want to get the "second level node", I can do
String test = wdContext.currentTreeNodeElement().currentChildElement.getText();
..and for the next levels so on.
Isn't there any general method to get the information of the selected element without knowing before, whether it is a nodeElement or a nodeElement.currentChildElement or a nodeElement.currentChildElement.currentChildElement, ...?
Greetings,
RamóHi,
if you following that pdf ,
i think your not implemented the below code in DomodifyView method
if (firstTime) {
IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TheNode");
/* The following line is necessary to create parameter mapping from parameter "path" to parameter "selectedElement".
Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
that raised the onAction event. Parameter "selectedElement" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
that handles the onAction. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
be accessed within the event handler
treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
/* The following line is necessary to create parameter mapping from parameter "path" to parameter "element".
Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
that raised the onLoadChildren event. Parameter "element" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
that handles the onLoadChildren. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
be accessed within the event handler
treeNode.mappingOfOnLoadChildren().addSourceMapping("path", "element");
please cross check once.
Thanks,
Ramesh -
How to get the current slide Index or Id?
I can get the selected slide of presentation use blow method.
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Failed) {
write('Action failed. Error: ' + asyncResult.error.message);
else {
write('Selected slides: ' + JSON.stringify(asyncResult.value.slides));
But, How can I get the executor slide?Hi,
>> How to get the current slide Index or Id?
In my option, when you select a slide, it change to current slide. So, you could use the getSelectedDataAsync method to get the current slide, and then get the index or id by using the Slice object. You could refer the link below for Slice Object.
# Slice.index property (JavaScript API for Office)https://msdn.microsoft.com/EN-US/library/office/jj715285.aspx?f=255&MSPPError=-2147217396
Some key code as below:
<script>
function getText() {
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange,
{ valueFormat: "unformatted", filterType: "all" },
function (asyncResult) {
var error = asyncResult.error;
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
write(error.name + ": " + error.message);
else {
// Get selected data.
var dataValue = asyncResult.value;
write('Selected data is ' + dataValue.slides[0].index);
// Function that writes to a div with id='message' on the page.
function write(message) {
document.getElementById('message').innerText += message;
</script>
>> How can I get the executor slide?
What do you mean by this? Is this a new issue which is different from the above issue? If so, I will recommend you post a new thread for this issue and share us more information about this.
Best Regards,
Edward
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 previoulsy selected value in a combobox
How to get the previoulsy selected value in a combobox. i WANT the current and the previously selected value of the combobox.
Just add to combobox ItemListener. When item is changing in itemStateChanged arrives 2 events. ItemEvent.DESELECTED and ItemEvent.SELECTED with corresponding item's values. Just write something like this:
comboBox.addItemListener(new ItemListener() {
Object prevValue;
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
//do what you need with prevValue here
} else {
prevValue = e.getItem();
}); -
How to get the current path of my application in java ?
how to get the current path of my application in java ?
thanksTo get the path where your application has been installed you have to do the following:
have a class called "what_ever" in the folder.
then you do a litte:
String path=
what_ever.class.getRessource("what_ever.class").toString()
That get you a string like:
file:/C:/Program Files/Cool_program/what_ever.class
Then you process the result a little to remove anything you don't want:
path=path.substring(path.indexOf('/')+1),path.lastIndexOf('/'))
//Might be a little error here but you should find out //quickly if it's the case
And here you go, you have a nice
C:/Program Files/Cool_program
which is the path to your application.
Hooray -
How to get the current page URL
HI All
I am working in oracle apps 4.0
I have one page called history in that i have one page item called Application url. My application id is 122 but its a copy of application 106
How to get the current page url for the page item.
Any steps should be help ful
Thanks & Regards
Srikkanth.MI'm not 100% clear on what the requirement is from the description, however it does sound like you are making things unnecessarily complicated.
If you want permanent/ID-independent links then use application and page aliases.
so here we used to display the url like this: <tt>{noformat}http://81.131.254.171:8080/apex/f?p=122{noformat}</tt>
Do you mean that the URL is displayed like that? If so that doesn't seem particularly helpful. How is anyone supposed to know what it is?
There are many ways to provide links in APEX—including lists and nav bars.
Where the link is to another resource located on the same server (such as another page in the same app, or a different app in the workspace), relative addressing can be used, making it unecessary to include scheme, domain and port information in the URL. For example, if the page to be linked to has a page alias <tt>ABOUT</tt> in an application with alias <tt>UNITY</tt>, and the apps share an authentication scheme/cookie to permit shared sessions, then the link URL is simply
f?p=UNITY:ABOUT:&APP_SESSION. -
How to get the Current User on the UI page?
All,
Could you please let me know how to get the Current user on the UI input page , i need to display the current user ID when some one clicks the submit button, i want o get the current user to display in the javascript alert box.
Edited by: 951930 on Oct 24, 2012 12:21 PMlucky,
my schema has already defined for
<user mapField="USER_ID" default="%CurrentUser"/>
and in my UI page
<td oraLabel="user"></td><td oraField="user" id="userId" ></td>
and my javascript
function showUserId () {
var curUser = document.getElementById('userId').value;
alert(curUser);
and i have called this function on my submit button, but i am not able to get Current Logged User ID value to show in the alert nor able to show the current logged user on the UI page.
my requirement is on custom UI page i need to show Current Logged User in one corner of the page and also need to show the same user in alert when he submits the button.
Appreciate for the help.
Edited by: 951930 on Oct 25, 2012 8:42 AM
Edited by: 951930 on Oct 25, 2012 9:06 AM -
How to get the current week from sysdate?
Hi sir,
i want to know how to get the current week from sysdate?
thanksHi Nicolas
It seems you like to check my post and also make commend ;) thanks for your attention
Have you ever read the posts above and given solutions ?Yes, I did
Have you read the docs ? Yes, I checked
What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
=> Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
Hope my answer could satisfy you..
One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
Thank you
Regards
Helios -
How to get the current schema name
Hi,
Can anybody please tell me how to get the current schema name, there is some inbuilt function for this,but i am not getting that. Please help me.
Thanks
Jogeshok folks, I found the answer at Tom's as usual.
http://asktom.oracle.com/tkyte/who_called_me/index.html
I rewrote it into a function for kicks. just pass the results of DBMS_UTILITY.FORMAT_CALL_STACK to this function and you will get back the owner of the code making the call as well some extra goodies like the name of the code and the type of code depending on the parameter. This ignores the AUTHID CURRENT_USER issues which muddles the schemaid. Quick question, does the average user always have access to DBMS_UTILITY.FORMAT_CALL_STACK or does this get locked down on some systems?
cheers,
paul
create or replace
FUNCTION SELF_EXAM (
p_call_stack VARCHAR2,
p_type VARCHAR2 DEFAULT 'SCHEMA'
) RETURN VARCHAR2
AS
str_stack VARCHAR2(4000);
int_n PLS_INTEGER;
str_line VARCHAR2(255);
found_stack BOOLEAN DEFAULT FALSE;
int_cnt PLS_INTEGER := 0;
str_caller VARCHAR2(30);
str_name VARCHAR2(30);
str_owner VARCHAR2(30);
str_type VARCHAR2(30);
BEGIN
str_stack := p_call_stack;
-- Loop through each line of the call stack
LOOP
int_n := INSTR( str_stack, chr(10) );
EXIT WHEN int_cnt = 3 OR int_n IS NULL OR int_n = 0;
-- get the line
str_line := SUBSTR( str_stack, 1, int_n - 1 );
-- remove the line from the stack str
str_stack := substr( str_stack, int_n + 1 );
IF NOT found_stack
THEN
IF str_line like '%handle%number%name%'
THEN
found_stack := TRUE;
END IF;
ELSE
int_cnt := int_cnt + 1;
-- cnt = 1 is ME
-- cnt = 2 is MY Caller
-- cnt = 3 is Their Caller
IF int_cnt = 1
THEN
str_line := SUBSTR( str_line, 22 );
dbms_output.put_line('->' || str_line);
IF str_line LIKE 'pr%'
THEN
int_n := LENGTH('procedure ');
ELSIF str_line LIKE 'fun%'
THEN
int_n := LENGTH('function ');
ELSIF str_line LIKE 'package body%'
THEN
int_n := LENGTH('package body ');
ELSIF str_line LIKE 'pack%'
THEN
int_n := LENGTH('package ');
ELSIF str_line LIKE 'anonymous%'
THEN
int_n := LENGTH('anonymous block ');
ELSE
int_n := null;
END IF;
IF int_n IS NOT NULL
THEN
str_type := LTRIM(RTRIM(UPPER(SUBSTR( str_line, 1, int_n - 1 ))));
ELSE
str_type := 'TRIGGER';
END IF;
str_line := SUBSTR( str_line, NVL(int_n,1) );
int_n := INSTR( str_line, '.' );
str_owner := LTRIM(RTRIM(SUBSTR( str_line, 1, int_n - 1 )));
str_name := LTRIM(RTRIM(SUBSTR( str_line, int_n + 1 )));
END IF;
END IF;
END LOOP;
IF UPPER(p_type) = 'NAME'
THEN
RETURN str_name;
ELSIF UPPER(p_type) = 'SCHEMA.NAME'
OR UPPER(p_type) = 'OWNER.NAME'
THEN
RETURN str_owner || '.' || str_name;
ELSIF UPPER(p_type) = 'TYPE'
THEN
RETURN str_type;
ELSE
RETURN str_owner;
END IF;
END SELF_EXAM;
Maybe you are looking for
-
Did I find another "Voice Memos" bug?
After updating my iPhone 4 to iOS 5.0.1, I'm no longer able to attach a photo before sharing the VM via email/message. The camera icon appears like it used to; "Take Photo or Video"/"Choose Existing"/ selections are there but selecting either of them
-
Could someone please give me the "know how" on deleting a previous apple id from the laptops app store so i can sign in and update with my ID PLEASE help it's driving me crazy!!
-
Kunststoff L&F not on the window frame!?! why?
Hi I'm using the kunststoff look and feel for my application, it works perfectly except for the outer windowframe, which still looks a lot XP-alike. Here's how I use the kunststoff L&F: public static void main(String[] args) { //lookAndFeel try{ UIMa
-
BAPI or FM for Unloading Pallets
Hi All, I need to create a RF program that will be used to unload pallets just like std sap transaction Lm30 and needs to update the HU status just like LM30 does. Can someone suggest any BAPI or FM that can be used to unload Pallets . Thanks..!!!
-
Are There Any Applications Like "Paint" on Windows?
I'm a new Mac user and can't get used to the MacOSX layout.I installed an application from the downloads section last night for an application called paintbrush, because i need a basic Paint application to crop pictures etc. But it's useless. Are the