How to set the Selected row and Column in JTable
Hi,
i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
Praveen K Saxena
Is that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column);
Similar Messages
-
How do I delete multiple rows and columns in an image?
I am looking into how digital SLRs extract video data from a CMOS sensor. To give an example, the GH1 from Panasonic can record video at 1920 x 1080 from a 12 MPixel sensor that, say, is 4000 horizontal x 3000 vertical. How they do that seems to be not in the public domain, but there have been a few guesses (see http://www.dvxuser.com/V6/showthread.php?t=206797 and http://luminous-landscape.com/forum/index.php?showtopic=38713).
One approach would be to simply read every second row of sensor pixels (1500 rows read from the original 3000) and once you have those in memory, delete every second column (2000 columns left). You would end up with a 2000 x 1500 image which could then be resampled to 1920 x 1080.
I'd like to simulate what the camera appears to be doing, by generating a 4000 x 3000 test image and then asking Photoshop CS4 to delete the appropriate rows and columns. It may not necessarily be every second row; the Canon 5DMk11 appears to read every third row, so I may need to delete two out of every three rows.
Can Photoshop do that sort of thing? If so, how?Thanks for the suggestions. Yes, I did take a detailed look at your images, but they weren't 100% convincing because it wasn't clear just what was happening. And Adobe's explanation, after reading it again, explains nothing at all to someone who doesn't know how Nearest Neighbor works.
But you are correct -- Nearest Neighbor does effectively delete pixels. I proved it with the attached 6 x 6 image of coloured pixels (the tiny midget image right after this full stop -- you'll have to go to maximum zoom in PS to see it).
These are the steps to delete every second row and then every second column.
1. Select Image > Image Size.
2. Set Pixel Dimensions > Height to half the original (in this case set to 3 pixels).
3. Set Resample Image to Nearest Neighbor.
4. Click OK and the image shoould now consist of three vertical white strips and three vertical Green-Red-Blue stripes.
5. Repeat steps 1-4, but this time set Pixel Dimensions > Width to half the original (in this case set to 3 pixels). The image should now consist of three horizontal stripes Green-Red-Blue.
Just to make sure the method worked for every third pixel, I repeated the above steps but with 2 pixels instead of 3 and obtained the correct White-Green, White-Green pattern.
I resampled the Height and Width separately for the test so that I could see what was happening. In a real example, the height and width can be changed at the same time in the one step, achieving the same results as above.
Finally, how to explain how Nearest Neighbor works in the simple cases described above?
Division by 2
In the case of an exact division by two (pixels numbered from top leftmost pixel), only the even numbered rows and columns remain. To put it a different way, every odd numbered row and column are deleted.
Division by 3
Only rows and columns 2, 5, 8, 11... remain.
Division by N
Only rows and columns 2, 2+N, 2+2N, 2+3N... remain.
To put it simply, a resample using Nearest Neighbor (using an exact integer multiple) keeps every Nth row and column, starting from number two. The rest are deleted. -
Select row and column from header in jtable
hello i have a problem to select row and column from header in jtable..
can somebody give me an idea on how to write the program on it.Hi Vicky Liu,
Thank you for your reply. I'm sorry for not clear question.
Answer for your question:
1. First value of Open is item fiels in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
* I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
2. the picture for detail of my report
Detail for Red number:
1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
espression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
2. tb_TOTAL1 group on item_part = 1
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
3. tb_TOTAL2 group on item_part = 3 or item_part = 4
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
4. tb_TOTAL3 group on item_part = 2
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
My custom code:
Dim Shared prev_close As Double
Dim Shared now_close As Double
Dim Shared now_open As Double
Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
now_close = TOTAL3 + NowOpening
prev_close = now_close
Return now_close
End Function
Public Function GetOpening(Month as String,NowOpen as Double)
If Month = "1" Then
now_open = NowOpen
Else
now_open = prev_close
End If
Return now_open
End Function
Thanks alot for your help!
Regards
Panda A -
How to obtain the selected rows in the model with af:Table using selectMany
Hi ,
I am using multi select af:Table and it is based on a programmatically populated view. When the table is single select I can use the getCurrentRow at the view implementation. I wonder whether there is a way to get list of selected rows within the view implementation for the multi-select scenario.
I saw some ways of doing it in the page's backing bean but it will be more appropriate if I could do it at the model project.
Thanks
My environment is JDeveloper 10.1.3.3 and jdk 1.4Thanks for your reply.
What you say makes sense. I thought there might be way of setting the selected rows in the model also as we do woth the current row.
But looks like these two different things.
Anyway I am doing it by passing the values through the backing bean.
Thanks -
How to delete the selected rows in a JTable on pressing a button?
How to delete the selected rows in a JTable on pressing a button?
You are right. I did the same.
Following is the code where some of them might find it useful in future.
jTable1.selectAll();
int[] array = jTable1.getSelectedRows();
for(int i=array.length-1;i>=0;i--)
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
model.removeRow(i);
} -
How to use the selection profile and status profile for production order?
Hi expert,
I want to know how to use the selection profile and status profile for production order. what's the usage for these two selection profile and status profile ?
Please help me.
thanks in advance.
george.shiHi George,
There are are two types of statuses.One is system status and second one is user status.These statuses will tell us current situation of an order.
We can't change system statuses.But we can create our own statuses through status profile.With this profile we can control user statuses.
In this status profile,
1.We define the sequence in which user statuses can be activated,
2.We define initial statuses
3. Allow or prohibit certain business transactions.
Selection profiles are used to select the objects (say production orders) with different status combinations.We assign status profiles to selection profiles in BS42 T-Code.
Regards,
Raja.
Edited by: Rajarao on Oct 30, 2008 6:21 AM
Edited by: Rajarao on Oct 30, 2008 6:22 AM -
Suppressing the total row and column in OLAP datagrid
I have created an OLAPDatagrid and everything looks fine
except that I don't want to show the '(All)' row and column in the
grid. Is there a way to suppress them?
Thanks,
FredInstead of using members() in the query use children() for
the attribute/hierarchy. -
How to identify the Selected row number or Index in the growing Table
Hi,
How to find the selected Row number or Row Index of growing Table using Javascript or Formcalc in Interactive Adobe forms
Thanks & Regards
SrikanthAfter using bellow script it works fine
xfa.resolveNode("Formname.Table1.Row1["this.parent.index"].fieldname").rawValue; -
How to get the selected rows & columns in the table?
hi everybody,
In my application the table is kept inside the event structure.I select the cells in the table (using mouse) on running time.How to get the selected number of rows & columns in that table?Hello,
You can fill selected values of the table by writing to it or the corresponding property using a property node - the table is just a 2D array of strings. I think for your "disable" question you are referring to the shortcut menu (when you right click). If you are using LabVIEW 8.x, you can edit or disable that shortcut menu - just right click on your table at edit time and choose Advanced >> Run-Time Shortcut Menu.
Best Regards,
JLS
Best,
JLS
Sixclear -
Check box als column in a standard table, how to get the selected row
Dear experts,
I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
lo_node->get_element().
lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
How could I get the element through check-box in stead of lead selection. Many thanks!check this code
To get the selected row number
data: lr_element type ref to if_wd_context_element,
lv_index type i.
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_index = lr_element->get_index( ).
Thanks
Bala Duvvuri -
How to create table with rows and columns in the layout mode?
One of my friends advised me to develop my whole site on the
layout mode as its better than the standard as he says
but I couldnot make an ordinary table with rows and columns
in th layout mode
is there any one who can tell me how to?
thanx alotYour friend is obviously not a reliable source of HTML
information.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Mr.Ghost" <[email protected]> wrote in
message
news:f060vi$npp$[email protected]..
> One of my friends advised me to develop my whole site on
the layout mode
> as its
> better than the standard as he says
> but I couldnot make an ordinary table with rows and
columns in th layout
> mode
> is there any one who can tell me how to?
> thanx alot
> -
Setting number of rows and columns
How do I set the number of rows and columns of a table, say 2348 rows by 3 columns?
Then how do I quickly select the last row?
Also, if I enter a formula in row 1 column 2, how do I quickly copy that formula down to row 1435, or to the end of the column? Dragging seems slow and awkward.I wish to add a few words to Jerrold responce.
gjf12 wrote:
How do I set the number of rows and columns of a table, say 2348 rows by 3 columns?
Then how do I quickly select the last row?
Also, if I enter a formula in row 1 column 2, how do I quickly copy that formula down to row 1435, or to the end of the column? Dragging seems slow and awkward.
The process that you describe is inefficient.
The efficient one is :
create a table
enter the formulas in a single row
delete the rows below.
Now, each newly inserted row will contain the formulas.
From my point of view, it's when this is done that it will be interesting to apply a script adding rows.
Here is a script inserting rows.
--[SCRIPT insertRows]
Enregistrer le script en tant que Script : insertRows.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Sélectionner une cellule au-dessous de laquelle vous voulez insérer des lignes.
menu Scripts > Numbers > insertRows
Le script vous demande le nombre de lignes désiré puit insère celles-ci.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
--=====
Save the script as a Script: insertRows.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Select a cell below which you want to insert rows.
menu Scripts > Numbers > insertRows
The script ask you the number of rows to insert then it does the required insertion.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
Save this script as a … Script in the "Folder Actions Scripts" folder
<startupVolume>:Library:Scripts:Folder Action Scripts:
--=====
Yvan KOENIG (VALLAURIS, France)
2010/01/13
--=====
on run
set defaultValue to 100
if my parleAnglais() then
set myInteger to my askAnumber("Insert how many rows ?", defaultValue, "i")
else
set myInteger to my askAnumber("Combien de lignes voulez-vous insérer ?", defaultValue, "i")
end if
set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
repeat myInteger times
add row below row rowNum2
end repeat
end tell
end run
--=====
on getSelParams()
local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if
set two_Names to my decoupe(r_Name, ":")
set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
if item 2 of two_Names = item 1 of two_Names then
set {row_Num2, col_Num2} to {row_Num1, col_Num1}
else
set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
end if
return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
end getSelParams
--=====
set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
apply to named row or named column !
on decipher(n, d, s, t)
tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
end decipher
--=====
set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
Asks for an entry and checks that it is an floating number
set myInteger to my askAnumber(Prompt, DefaultValue, "i")
set myFloating to my askAnumber(Prompt, DefaultValue, "f")
on askAnumber(lPrompt, lDefault, ForI)
local lPrompt, lDefault, n
tell application (path to frontmost application as string)
if ForI is "f" then
set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
try
set n to n as number (* try to convert the value as an number *)
return n
on error
if my parleAnglais() then
display alert "The value needs to be a floating number." & return & "Please try again."
else
display alert "La valeur saisie doit être un nombre décimal." & return & "Veuillez recommencer."
end if
end try
else
set n to text returned of (display dialog lPrompt default answer lDefault as text)
try
set n to n as integer (* try to convert the value as an integer *)
return n
on error
if my parleAnglais() then
display alert "The value needs to be an integer." & return & "Please try again."
else
display alert "La valeur saisie doit être un nombre entier." & return & "Veuillez recommencer."
end if
end try -- 1st attempt
end if -- ForI…
end tell -- application
Here if the first entry was not of the wanted class
second attempt *)
tell application (path to frontmost application as string)
if ForI is "f" then
set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
try
set n to n as number (* try to convert the value as an number *)
return n
on error
end try
else
set n to text returned of (display dialog lPrompt default answer lDefault as text)
try
set n to n as integer (* try to convert the value as an integer *)
return n
on error
end try -- 1st attempt
end if -- ForI…
end tell -- application
if my parleAnglais() then
error "The value you entered was not numerical !" & return & "Goodbye !"
else
error "La valeur saisie n’est pas numérique !" & return & "Au revoir !"
end if
end askAnumber
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) mercredi 13 janvier 2010 12:43:34 -
[UIX-ADF] How to get the selected row in my ViewObjImpl.java
Hi,
I have a uix table with a select column. I dragged my method from my ViewObjImpl
and dropped it on the select column (radiobutton) as a submitbutton.
If I run my application and select a row and press my button it always reads the first
row. Why?
I also tried including a param in my method, for the record id, but I dont know what to
pass to my action binding as a param, where can I find the selected row?
This is what I want, my method in ViewObjImpl.java
public void doDelete() {
ViewObjRowImpl pRow = (ViewObjRowImpl)this.getCurrentRow();
try {
pRow.setIsDeleted("Y");
//this.executeQuery();
this.getDBTransaction().commitAndSaveChangeSet();
//this.validate();
} catch(Exception e) { System.out.println("ERROR doDelete" + e); }
}It should set the IsDeleted field to 'Y' for the selected row. Perhaps im not doing the
right thing for this?
Can anyone give me some pointers?
Thanks in advance
IdoThanks. So even if you select a row and then press the button, your method still only finds the first row?!
Are you sure that the selection mechanism of your table is working? Your tableSelection fires a select event and your page contains a select handler?
When you wire your page using drag and drop the binding should always use the default iterator of the ViewObject. And getCurrentRow() should always give you the current row of that iterator. So my feeling is that the selection doesn't take place.
Or could it be that something resets the currency in the ViewObject from another place?
Sascha -
How to get the selected rows in a table
Hi,
How to get the ids of all the selected rows. On Page load a query is executed that shows the data in a table with a checkbox in the first column to select the rows and delete. Now if a user select multiple rows how do I get the ids of selected rows in the backend code.
ThanksPlease search the forum before posting questions.
refer following thread for table selection.
Re: Record selection with MessageCheckBox and print the selected record.
--Prasanna -
How to reference the selected row on a report by click a radiobox
I created a report with a column displayed as a radiobox.The report source is like "select htmldb_item.radiogroup(1,.....),rec_id,....from .... where ....",after click one radiobox,i want to get other column's value in the selected row in the after submit process ,can anyone help me?????? how to reference "rec_id" of the selected row?
Hello,
First, please tell us your first name, and update your forum handle. It’s make it easier to track your threads, and help you.
>> apex_application.g_f01(1)" only return the first record's rec_id,if i click radiobox in other rows,it returns the same result as click radiobox in the first row?
The ‘G_F01’ is an array of values, so apex_application.g_f01(1) will always bring you the first element of this array. If you want to retrieve other values from this array, which will include the values of the radiogroup value of the other lines, you need to use a loop. Something like that should work:
for i in 1.. apex_application.g_f01.count loop
… apex_application.g_f01(i) …
end loop;
>> after click one radiobox,i want to get other column's value in the selected row in the after submit process
That means that the value of your radiogroup item should include some indication to the line you are on. If, like in Andy’s example, you can retrieve your record from a table, based on a PK, your radiogroup can return this kind of information. However, if the data on the other columns of the select raw, were just entered/updated by the user (like in a tabular form), the radiogroup item should include information about the row you are in, in order for you to be able to access the corresponding array elements – other G-Fxx arrays – of the other columns in the row. In this case, I believe using checkboxes is preferable.
Regards,
Arie.
Maybe you are looking for
-
Please Help - I reset my MacBook!
Please help me! I got this MacBook as a gift. I reset it to factory settings so I could start it from scratch and make it my own. In resetting it, I had to buy Lion OS X, which is fine. But big problem.. I can't use the redemption code because i can'
-
Grrr. I switched out my iPad mini today. For my 2 magazine subscriptions, I entered my log in information. Then I clicked link for 'restore past issues.' I was then prompted for my Apple ID and pw. I'm repeatedly getting message that my ow is incorre
-
i really dont know what is bug fixes.... whats that for.... is it for viruses.......
-
How to turn on webcam on hp pavilion g6
my model no is B6U26PA my product name is hp pavilion g6-210tu notebook pc mt serial no is[edited by Moderator] how do i turn on my integrated web camera?
-
We connect the iphone4 to itunes and it recognizes the iphone, but only a white screen appears that says "iphone" in the middle of the screen. This is my wife's iphone. Mine synced fine and let me choose which to install backup from. I'm not getting