Problem to set focus to the particular cell in matrix
Hi All
I want to set the focus on the particular set on the matrix. i used following code
oMatrix.Columns.Item("MinSal").Cells.Item(iRow).Click(SAPbouiCOM.BoCellClickType.ct_Regular)
but it execute two times and doesnt work Properly.
Thanks
Rupinder
Hi
If (pVal.ColUID = "MinSal") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS) Then
If MinSalaryRange(pVal.Row) = False Then
BubbleEvent = False
End If
and MINSalaryRange is a function
Private Function MinSalaryRange(ByVal iRow As Integer) As Boolean
Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("SalGrade").Specific
Dim MinSal, MinSal1, MaxSal As Integer
Try
If iRow > 1 Then
For i As Integer = 1 To iRow - 1
If oMatrix.Columns.Item("Date").Cells.Item(iRow).Specific.String = oMatrix.Columns.Item("Date").Cells.Item(i).Specific.String Then
MinSal = oMatrix.Columns.Item("MinSal").Cells.Item(iRow).Specific.String
MinSal1 = oMatrix.Columns.Item("MinSal").Cells.Item(i).Specific.String
MaxSal = oMatrix.Columns.Item("MaxSal").Cells.Item(i).Specific.String
If (MinSal >= MinSal1) And (MinSal <= MaxSal) Then
SBO_Application.MessageBox("Min Salary ")
'oMatrix.Columns.Item("MinSal").Cells.Item(iRow).Click(SAPbouiCOM.BoCellClickType.ct_Regular)
' oMatrix.Columns.Item("MinSal").Cells.Item(iRow).Click()
MinSalaryRange = False
End If
End If
Next
Else
MinSalaryRange = True
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
MinSalaryRange = False
End Try
End Function
Thanks
Similar Messages
-
Problem of set focus on the cell during the validation.
I am having a table with 5 columns.
I can change the value of the 2nd cell in 2 ways.
one by 1. editing the 2nd cell
or by 2. clicking the button avilable in the 1st cell.(the button editor will set the value to the 2nd cell of selected row)
In both cases, i have to validate the value in the 2nd cell.
If the value is not meeting some criteria, i am pop uping a msg box, contain approprite message.
and the cursor should be focused on the 2nd cell until the value will be corrected.
i done for the case 1.
but for the case 2, i couldn't keep the cursor on the 2nd cell when the value got changed by the button editor of cell 1, and if the value is wrong
The 1st cell 2nd cell are having it own Renderer and Editor
even i tried a lot, but i not yet achieved it.
pls. guide me to get a perfect result.Thnks for u'r reply.
the 1st part what i mentioned is done by the same way in those example by the sun site only.
But in the 2nd part, when i set the value to text field by the button editor,
the editor of the textField(2nd cell), is not got called.
If i made to call editor also, i am unable to keep the cursor on 2nd cell -
Setting Focus to a particular cell in JTable
Hi, can i know how to set the focus to a particular cell in JTable.
Say I have a table with 2 rows and 10 columns. The focus now is at position (1, 9) which is the last cell in the table. But I want to set the focus to (1, 3). How can i achieve this ? Pls help. ThanksOK. It's partially working. The right methods to use are setRowSelectionInterval and setColumnSelectionInterval. Jeanette was right. Mine didn't work because of a thread issue. I put the those two methods in a block such as:
SwingUtilities.invokeLater(new Runnable(){
public void run()
table.setRowSelectionInterval(tblLineItem.getRowCount()-1,
table.getRowCount()-1);
table.setColumnSelectionInterval(0,0);
Then it worked.
But after I finished editing the first cell of the newly created row and press ENTER, the selection went back to the cell that's next to the originally editing cell on the first(old) row, instead of staying at the current row and going to the second cell.
Can anybody shed a light on what I'm missing? -
Metoh refresh_table_display will set the focus to the first cell
metoh refresh_table_display will set the focus to the first cell,how i can set it back to the position before
refresh.
thanks.
Message was edited by: W CHi,
The method REFRESH_TABLE_DISPLAY has the parameters, IS_STABLE. Set both ROW / COL parameters of IS_STABLE to 'X'.
Then when you refresh the display will not shake.
Regards,
Ravi
Note : Please close the thread if answered -
To change the colour of the particular cell of ALV report in Grid display.
Hai Friends,
I have created an Alv report in grid display .In that i want to change the colour of the particular cell.Plz provide the answer with a solved example.
Thank u.This works for a Custom Control and OO ALV in a Dialog Module
TABLES: kna1.
* Data (for the ALV Grid)
TYPES:
BEGIN OF t_alv_data,
cust_id TYPE kunnr, "Customer Number
cust_name TYPE name1_gp, "Customer Name
cust_color TYPE i,
* cell coloring field
color TYPE lvc_t_scol, "Cell coloring
END OF t_alv_data.
DATA:
v_alv_data TYPE t_alv_data,
i_alv_data TYPE STANDARD TABLE OF t_alv_data.
* ALV grid containers and objects
DATA:
o_alv_grid TYPE REF TO cl_gui_alv_grid,
o_alv_cont TYPE REF TO cl_gui_custom_container.
* ALV field catalog
DATA:
i_alv_fc TYPE lvc_t_fcat,
v_alv_fc LIKE lvc_s_fcat.
* ALV Layout (colors)
DATA:
v_alv_layout TYPE lvc_s_layo,
i_alv_color TYPE lvc_t_scol,
v_alv_color TYPE lvc_s_scol,
v_alv_color_cell TYPE lvc_s_colo.
* ALV variant
DATA:
v_alv_variant TYPE disvariant.
PARAMETERS:
p_alvvar TYPE disvariant-variant DEFAULT 'DEFAULT'.
DATA: ok_code LIKE sy-ucomm.
* Class for event handling
* CLASS lcl_event_receiver DEFINITION
* [+] Event listener for the ALV grid
* [+] Handles hotspots and data changes
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
* Hotspot clicking
hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id
es_row_no,
* Data changed (such as checkbox clicking)
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
* [+] Implementation of the ALV Grid event handler class
CLASS lcl_event_receiver IMPLEMENTATION.
* METHOD hotspot_click *
* [+] Calls evvent_hotspot_click when a hotspot is clicked in the ALV
METHOD hotspot_click.
PERFORM event_hotspot_click
USING e_row_id
e_column_id.
ENDMETHOD. "hotspot_click
* METHOD handle_data_changed *
* [+] Updates the source data when the data in the ALV display has
* been changed, such as by clicking a checkbox.
METHOD handle_data_changed.
DATA: lv_changed TYPE lvc_s_modi.
LOOP AT er_data_changed->mt_good_cells INTO lv_changed
WHERE fieldname = 'CUST_NAME'.
READ TABLE i_alv_data INTO v_alv_data INDEX lv_changed-row_id.
IF sy-subrc = 0.
MOVE lv_changed-value TO v_alv_data-cust_name.
MODIFY i_alv_data FROM v_alv_data INDEX lv_changed-row_id.
ENDIF.
ENDLOOP.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
* Reference to the event listener class
DATA: event_receiver TYPE REF TO lcl_event_receiver.
* FORM build_event_listener
* [+] Set the event handler on the ALV Grid
FORM build_event_listener.
* Assigning the event listener to the ALV
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_data_changed FOR o_alv_grid.
SET HANDLER event_receiver->hotspot_click FOR o_alv_grid.
ENDFORM. "build_event_listener
* AT SELECTION-SCREEN
* ON VALUE-REQUEST FOR p_alvvar
* [+] Calls choose_alv_variant to ask the user to select an alv grid
* layout variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_alvvar.
PERFORM choose_alv_variant
CHANGING
p_alvvar
v_alv_variant.
* START_OF_SELECTION
START-OF-SELECTION.
PERFORM get_data.
SET PF-STATUS 'ALVSCREEN' IMMEDIATELY.
CALL SCREEN 2000.
* FORM get_data
* [+] Gets the data for the ALV grid
FORM get_data.
SELECT kunnr name1
INTO (v_alv_data-cust_id,
v_alv_data-cust_name)
FROM kna1.
APPEND v_alv_data TO i_alv_data.
ENDSELECT.
ENDFORM. "get_data
* MODULE build_alv_grid
* THIS SHOULD BE IN THE "PROCESS BEFORE OUTPUT" OF THE ALV SCREEN
* [+] Builds the ALV Grid objects
* [+] Calls to build the field catalog table
* [+] Loads the field catalog table into the ALV Grid
* [+] Loads the table data into the ALV Grid
MODULE build_alv_grid OUTPUT.
SET TITLEBAR '2000'.
* Also enables layout saving
PERFORM set_alv_variant
USING
p_alvvar
CHANGING
v_alv_variant.
* Building the grid and container on the screen
* NOTE: the container name MUST be upper-case
* Also, we don't want the objects to be created if in batch mode!
IF sy-batch IS INITIAL.
CREATE OBJECT o_alv_cont
EXPORTING
container_name = 'O_ALV_TABLE'.
ENDIF.
CREATE OBJECT o_alv_grid
EXPORTING
i_parent = o_alv_cont.
* builds the event listener
PERFORM build_event_listener.
* Color the cells
PERFORM color_cells.
* Build the field catalog
PERFORM build_alv_fc.
* Loads the data into the grid
CALL METHOD o_alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
i_default = 'X'
is_variant = v_alv_variant
is_layout = v_alv_layout
CHANGING
it_outtab = i_alv_data
it_fieldcatalog = i_alv_fc.
ENDMODULE. "build_alv_grid OUTPUT
* FORM build_alv_fc
* [+] Constructs the ALV Grid field catalog table
FORM build_alv_fc.
CLEAR i_alv_fc.
REFRESH i_alv_fc.
* NOTE: the field name MUST be upper-case
* field heading hide hot
* name zero spot just
PERFORM:
alv_field USING 'CUST_ID' 'Cust ID' ' ' 'X' 'R',
alv_field USING 'CUST_NAME' 'Customer Name' ' ' ' ' 'L',
alv_field USING 'CUST_COLOR' 'Color' ' ' ' ' 'R'.
ENDFORM. "build_alv_fc
* FORM alv_field
* [+] Describes and constructs a single field for the ALV Grid field
* catalog. The field length and type are both obtained from the
* actual field passed in to this method.
* [+] Adds the constructed field to the ALV Grid field catalog table
FORM alv_field
USING
p_field_name TYPE c
p_heading TYPE c
p_hide_zeros TYPE c
p_hotspot TYPE c
p_justify TYPE c.
CLEAR v_alv_fc.
DATA:
lv_type(1) TYPE c,
lv_length TYPE i,
lv_heading_length TYPE i.
* get the type and length of this field
FIELD-SYMBOLS <field>.
ASSIGN p_field_name TO <field>.
DESCRIBE FIELD <field> TYPE lv_type OUTPUT-LENGTH lv_length.
* re-adjust the length to the length of the header, if too short
lv_heading_length = strlen( p_heading ).
IF lv_length < lv_heading_length.
lv_length = lv_heading_length.
ENDIF.
* NOTE: the field name MUST be upper-case
v_alv_fc-fieldname = p_field_name.
TRANSLATE v_alv_fc-fieldname TO UPPER CASE.
v_alv_fc-inttype = lv_type.
v_alv_fc-outputlen = lv_length.
v_alv_fc-coltext = p_heading.
v_alv_fc-seltext = p_heading.
v_alv_fc-hotspot = p_hotspot.
* Determining which fields should show zeros
IF p_hide_zeros = 'X'.
v_alv_fc-no_zero = 'X'.
v_alv_fc-lzero = ' '.
ELSE.
v_alv_fc-no_zero = ' '.
v_alv_fc-lzero = 'X'.
ENDIF.
v_alv_fc-just = p_justify.
* Add the field to the field catalog
APPEND v_alv_fc TO i_alv_fc.
ENDFORM. "alv_field
* FORM choose_alv_variant
* [+] Shows a popup that allows the user to choose the layout variant
* for the alv grid of the current program
* [+] Usually called by an AT SELECTION-SCREEN method.
FORM choose_alv_variant
CHANGING
p_variant_name TYPE disvariant-variant
p_variant TYPE disvariant.
CLEAR p_variant.
DATA:
p_exit_check(1) TYPE c.
MOVE sy-repid TO p_variant-report.
CALL FUNCTION 'LVC_VARIANT_F4'
EXPORTING
is_variant = p_variant
i_save = 'A'
IMPORTING
e_exit = p_exit_check
es_variant = p_variant
EXCEPTIONS
not_found = 1
OTHERS = 99.
IF sy-subrc = 0.
IF p_exit_check <> 'X'.
p_variant_name = p_variant-variant.
ENDIF.
ENDIF.
ENDFORM. "choose_alv_variant
* FORM set_alv_variant
* [+] Sets the alv grid layout variant. Used for setting the variant
* when its name is entered in a parameter rather than by using the
* popup, or when loading the variant from a variable of type C
FORM set_alv_variant
USING
p_variant_name TYPE disvariant-variant
CHANGING
p_variant TYPE disvariant.
MOVE sy-repid TO p_variant-report.
p_variant-variant = p_variant_name.
ENDFORM. "set_alv_variant
* FORM color_cells
* [+] Loop through the data and apply coloring
FORM color_cells.
DATA:
my_color TYPE i.
* tell the ALV grid what field in v_alv_data contains color information
v_alv_layout-ctab_fname = 'COLOR'.
my_color = 0.
* loop through each row of the table
LOOP AT i_alv_data INTO v_alv_data.
* clear the variables
CLEAR:
v_alv_color,
v_alv_color_cell,
i_alv_color.
REFRESH:
i_alv_color.
v_alv_data-cust_color = my_color.
PERFORM color_cell USING 'CUST_COLOR' my_color. "negative
* apply the colors
* IF v_alv_data-cust_name = 'Testing Credit'.
* PERFORM color_cell USING 'CUST_NAME' 6. "negative
* ELSEIF v_alv_data-cust_name = 'Goober Goober Also'.
* PERFORM color_cell USING 'CUST_NAME' 5. "positive
* ENDIF.
* set the color data for this table row
v_alv_data-color = i_alv_color.
MODIFY i_alv_data FROM v_alv_data.
my_color = my_color + 1.
IF my_color GT 7.
CLEAR my_color.
ENDIF.
ENDLOOP.
ENDFORM. "color_cells
* FORM color_cell
* [+] Colors a cell in the ALV grid
FORM color_cell
USING
p_cellname TYPE c
p_color TYPE i.
CLEAR:
v_alv_color_cell,
v_alv_color.
* set the color for the cell
* IF p_color = 0.
* v_alv_color_cell-col = 0. "cl_gui_resources=>list_col_background.
* ELSEIF p_color = 1.
* v_alv_color_cell-col = 1. "cl_gui_resources=>list_col_heading.
* ELSEIF p_color = 2.
* v_alv_color_cell-col = 2. "cl_gui_resources=>list_col_normal.
* ELSEIF p_color = 3.
* v_alv_color_cell-col = 3. "cl_gui_resources=>list_col_total.
* ELSEIF p_color = 4.
* v_alv_color_cell-col = 4. "cl_gui_resources=>list_col_key.
* ELSEIF p_color = 5.
* v_alv_color_cell-col = 5. "cl_gui_resources=>list_col_positive.
* ELSEIF p_color = 6.
* v_alv_color_cell-col = 6. "cl_gui_resources=>list_col_negative.
* ELSEIF p_color = 7.
* v_alv_color_cell-col = 7. "cl_gui_resources=>list_col_group.
* ENDIF.
v_alv_color_cell-col = p_color.
v_alv_color-nokeycol = 'X'.
v_alv_color-fname = p_cellname.
* v_alv_color-color = p_color.
v_alv_color-color = v_alv_color_cell.
APPEND v_alv_color TO i_alv_color.
ENDFORM. "color_cell
* FORM event_hotspot_click
* [+] What to do when clicking on a hotspot in the ALV Grid
FORM event_hotspot_click
USING
p_row TYPE lvc_s_row
p_column TYPE lvc_s_col.
DATA:
lv_docnum TYPE kunnr.
READ TABLE i_alv_data INTO v_alv_data INDEX p_row-index.
IF p_column = 'CUST_ID'.
* call a transaction when the cust_id is clicked
SET PARAMETER ID 'AUN' FIELD v_alv_data-cust_id.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM. "event_hotspot_click
*& Module USER_COMMAND_2000 INPUT
* text
MODULE user_command_2000 INPUT.
CASE ok_code.
WHEN 'BACK'
OR 'STOP'
OR 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_2000 INPUT -
How to set focus on the title of JTabbedPane
I have created a JTabbedPane and added three JPanels to it. They are titled, say "Panel 1", "Panel 2" and "Panel 3". And each of them contains buttons and text areas. Since this app is for physically disabled users, it must provide navigation through these three tabs with keyboard operations only (i.e. without mouse clicks).
When the title "Panel 1" gets focused, users can go to "Panel 2" by the right arrow key. When Panel 2 is brought up, however, the title "Panel 2" does not get focused. Instead the first button inside panel 2 is focused. In order for users to navigate to 'Panel 3" by the arrow key, the title "Panel 2" has to be focused. How do I set focus on the tab title?
I have tried 'requestFocus()' on Panel 2, but it does not work. Please help me with this issue. Thanks in advance.I'd be quite interested to know if this can be doen as well so I thought I'd post this message to move it to the top of the board.
Thanks. -
How to set focus on the last row of JTextPane
how to set focus on the last row of JTextPane?
import javax.swing.*;
import javax.swing.text.html.*;
import java.awt.*;
import java.awt.event.*;
public class MyGUITest extends JPanel implements ActionListener
{ public static void main(String[] args)
{ SwingUtilities.invokeLater(new Runnable()
{ public void run()
{ JFrame f = new JFrame("My GUI");
MyGUITest GUI = new MyGUITest();
GUI.setOpaque(true);
f.setContentPane(GUI);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
JTextPane txtP;
JButton add;
HTMLEditorKit hek;
HTMLDocument hd;
String txt;
MyGUITest()
{ this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(400,200));
txtP = new JTextPane();
txtP.setEditable(false);
txtP.setContentType("text/html");
txtP.setText("");
hek = new HTMLEditorKit();
txtP.setEditorKit(hek);
hd = new HTMLDocument();
txtP.setDocument(hd);
JScrollPane sTxtA = new JScrollPane(txtP);
add = new JButton("add");
add.addActionListener(this);
sTxtA.setBorder(BorderFactory.createTitledBorder(""));
this.add(sTxtA, BorderLayout.CENTER);
add(add, BorderLayout.SOUTH);
new Thread(new Runnable()
{ public void run()
{ while(true)
{ try
{ Thread.sleep(100);
}catch(InterruptedException ex)
{ ex.printStackTrace();
appendText("This is <b>HTML</b> text");
//add.doClick();
}).start();
public void actionPerformed(ActionEvent e)
{ txt = "<b>asd</b>";
try
{ hek.insertHTML(hd, hd.getLength(), txt, 0, 0, null);
}catch(Exception ex){ ex.printStackTrace(); }
public void appendText(String txt)
{ try
{ hek.insertHTML(hd, hd.getLength(), txt, 0, 0, null);
}catch(Exception ex){ ex.printStackTrace(); }
}thanks~anIdiot wrote:
im not sure what is the caret location...So don't youthink you should have looked for it in the API?
anyway, i want the scroll bar to scrolled down automatically when the output is displayed.
normally, the scroll bar is scrolled down automatically when a new text is inserted, but it doesnt work on this timeGo through camockr's http://tips4java.wordpress.com/2008/10/22/text-area-scrolling/
db -
when i sign in to iCloud it shows there is number of free apple id set up in the particular phone therefore iCloud cant be sign in.Kindly advise.
You can try to find your other IDs by following this guide: http://support.apple.com/kb/HE34. Otherwise, you'll have to find a friend with an iOS device or Mac that is willing to let you set up an account using their device.
-
Selecting the particular cell in the datatable
hi all,
sorry for such a stupid question.
i have a datatable component. i can get the rowid of the particular row.
but how can i identify the particular cell in that row so that i can update its
value?
is it possible to update the cell's value in javascript after identifying it?
thanks in advance.
enjoyyy,
java_buffThanks Edward for ur reply...
But in Inventory In warehouse report they gave the total as in different color.How they done that?????
Regards,
Anitha -
Hi Techies
I have one req in which i need to color the Particular cell, Provide me the Logic for that in which only change filed should be highlight to a specific Color.
I have alogic for color the whole column and Row, but i need to color only particular cell.
Moderator message: vague, help not possible without asking return questions, what cells are we talking about, provide as much technical detail as possible when posting.
Edited by: Thomas Zloch on Feb 15, 2012Thanks Edward for ur reply...
But in Inventory In warehouse report they gave the total as in different color.How they done that?????
Regards,
Anitha -
How do I set focus to the Browser so I can CmdKey-A and select all?
I've searched the shortcut list for about 10 minutes and cannot find a shortcut to shift focus to the browser (by default the right-side) preferably the lower film-strip/list pane where pressing Cmd-A selects all the photos.
Note, that if you select an album and hit Cmd-A it doesn't select all the photos in the album - if that worked I wouldn't need to set focus to the film-strip/list pane.
There's only 1 keyboard shortcut in the "Aperture 3 Keyboard Shortcuts" guide with the word "Focus", and it's not the one I need.Put it this way.
1. Select an Album
2. Now, you want to select all photos in that album, hit Cmd-A
You can't do (2) until I manually click in the film-strip pane.
I want to hit 1 key, to put me in a position to select all photos immediately.
This would also allow me to navigate using the arrow keys.
I'm not sure I really understand how anyone would not need this.
You click an album, you want to navigate through them (without using the mouse) ... doesn't everyone need to do this somehow?
** I just realized while experimenting that hitting the arrow-key actually gives focus to the film-strip in a way that allows me to hit Cmd-A.
So it looks like the answer is to
1. Select the Album
2. Hit any arrow key (sometimes it already has focus, depending on what you were doing in this album last time, by the look of it)
3. Cmd-A now works. -
How to disable a particular CELL in matrix?????
Hi All,
I have a doubt regarding the matrix.In my matrix the first column is a combobox it has a,b,c items....so if i select 'a' the remaining 'b' & 'c' columns should get disabled....previously iam able to disable the 'b' & 'c' columns but it's disabling the total 'b & 'c' columns in my matrix.....i just want to disable the particular cell based on the combobox selection....can we disable a particular cell in matrix.....
regards,
shangai.Shangai,
here were many threads about this in last month. Try to search in history.
BTW, the particular cell cannot be disabled (only whole column), but you could make system, that the cell is enabled but you cannot click on it (when user clicks on the cell, set bubbleeevnt to fasle). -
Problem in setting focus in JTable
Hi,
In my application I am using JTable with a customized table model. The table has two columns. First column has jcombobox as its editor and the second column has the customized editor developed by me. This particular table appears in a wizard. When this wizard page (which contains the above JTable) is shown I set the keyboard focus on the JTable using JTable's requestFocus() method (I even tried with grabFocus()method but got the same result). But the focus does not appear on the JTable. Even none of the cells get the focus. Also no matter how many time I press tab key the focus does not shift to the next component in the page which happens to be a JButton. I have set the next focussable element for the JTable as that JButton. When I manually put the focus on one of the cells by clicking on it and then if I press either arrow key or tab key the focus is lost and it does not go either on the next cell or the JButton.
If anybody can shed some light on what exactly needs to be done to give proper keyboard navigation for JTable please let me know.
Regards
AtulHi Atul,
I suspect your problem is with your cell renderer. The DefaultTableCellRenderer class has code in the getTableCellRendererComponent method that provides the visual indication as to which cell has the focus. You will want to do something similar in your JPanel-subclassed renderer - perhaps change the border or the background color to indicate whether a cell is selected or not.
Note also that there is a difference between a cell that has "isSelected" set to true, which indicates that the cell is part of the current selection, and a cell that has "hasFocus" set to true, which indicates that the cell is the last one to be clicked on. Actually, it seems to be a bit more complicated than that, but that's at least part of what "hasFocus" indicates. A cell can be selected and not have the focus, and a cell can have the focus but not be selected. You may want to setup your renderer to clearly indicate which of these states are set and then run your app and play with the table selection to get a feel for how it works.
Hope that helps.
- Tyler -
Change the font of particular cell in matrix report
hi experts
i made a report in report 6i. now i want to change a color of particular cell which has shortest value. and
also i want to fill 0 ( zero ) value in blank column.
i have tried it from the property pallate " Value if Null " set to 0 (zero )
But it does not take the value.
Please solve the problem
regards
manojHi,
I think it will be better if you put NVL/DECODE in your main query for this column and also having second option create one placement column and store the value of the column in this placement column based on your condition criteria.
Thanks
Shishu Paul -
Problem in Setting Focus, on a dynamically generated field
Hi all,
I am having a jsp page, in which I have dynamically generated n number of input text fields, and with the function onchange="chk();", and i am passing the current text field value, and 2 more parameters min and max.
In function chk(), i am validating the input value by condition it should be within min and max..
my problem is i want to[b] get back the focus to the input text box, where the input is entered and not satisfied my condtion
function chk(a,b,c) / /a is my i/p, b and c are min and max values
if( (parseInt(a)>=parseInt(b)) && (parseInt(a)<=parseInt(c)) )
document.form1.submit;
return true
else
alert("Invalid Output");
var element=event.srcElement.name;
alert(element); // I am able to get the name of input text box
alert(event.srcElement.tagName); // this gives INPUT
if(event.srcElement.tagName=='INPUT')
alert("yes"); // i can get this alert
event.srcElement.focus(); // the focus can't be set back to that input field or element
return false
}try this and say me if it works fine!!!
<html>
<head>
<script>
function fileds() {
var myParent = document.getElementById('myDiv');
var text = document.createElement('input');
text.setAttribute('id', 'myText');
myParent.appendChild(text);
document.all.myText.focus();
</script>
</head>
<body>
<input type="button" onClick="javascript:fileds()" value="Create And Give Focus">
<br>
<div id="myDiv"></div>
</body>
</html>
bye
Maybe you are looking for
-
AP error while submitting "Payable Open interface"
Hello, I am trying to run the request 'Payables open interface'. I got the output once and the error was because the supplier site was invalid. I created a supplier site saved it and ran the request again. Now, I am getting the following error. Payab
-
Problem on Intel Hd Graphic 4000
Hi, guys! I just formated my notebook (HP Pavilion dv7-7047cl) and instaled the drivers from the HP Support center. Everything looks great, except for the INtel HD Graphic 4000, that shows a yellow exclamation on the drive list. My notebook also have
-
ITunes has stopped working when syncing iPad Air.
Please: someone help me.... I am at my wits ends. I have spent 3 days trying to solve this, without any success. I have really time better off than sorting stupid software problems. (Someone had a great rant, so I won't rehearse it - but it seem
-
Can't run anything with an import statement
That seems to be what's going on, anyway. HelloWorld works for me, but ECJ (http://cs.gmu.edu/~eclab/projects/ecj/) does not. NoClassDefFoundError when I try to run the thing, even though . is on my classpath and I'm in that directory (and yes, it's
-
Import SiteBuilder site into DW CS5.5 and edit it {subject edited by moderator}
I have zero DW experience. I simply want flexibility and control over my site's content, which changes frequently. I also want my "favicon" opposed to yahoo's favicon on my paid site. I am grateful for any assistance. Oh, my site is www.teuwanda.