JTable-How To Refresh View Of ScrollPane Containing Table
Hi,
How can I programatically refresh the view of a ScrollPane that holds a JTable so that when the table becomes visible, the row that is currently selected comes to view instead of the first row????
Regards,
Anil
If you can figure out the coordinates of the selected row, which shouldn't be that hard, you can use scrollRectToVisible(Rect r) and the JViewport will do it for you
Similar Messages
-
JTable how to refresh??
hi,
I have a situation where I want to delete a row from the table and refresh the table so I could see which has been deleted. However, my table doesn't refresh itself and the line is still there. I had to manually leave the table and enter again to know which line has been removed. So, I'm kindly asking if there is a way that I can refresh my table and see the result instantly.
FYI, I've been searching all over this forum and tried any possible solutions I could find, but none is working form me.
Thanks!import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class TestJTable extends JFrame {
public TestJTable() {
initComponents();
tableModel = (DefaultTableModel)table.getModel();
DefaultTableModel tableModel;
private void initComponents() {
scrollPane = new JScrollPane();
table = new JTable();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
table.setModel(new DefaultTableModel(
new Object [][] {
{"1", null, null, null},
{"2", null, null, null},
{"3", null, null, null},
{"4", null, null, null}
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
table.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
tableKeyPressed(evt);
scrollPane.setViewportView(table);
getContentPane().add(scrollPane, BorderLayout.CENTER);
getContentPane().add(new JLabel("Please select a row, " +
"and then press the 'Delete' key to delete the row"), BorderLayout.NORTH);
setTitle("Test JTable: delete row");
pack();
private void tableKeyPressed(KeyEvent evt) {
if( evt.getKeyCode()==KeyEvent.VK_DELETE ){
int row = table.getSelectedRow();
if(row>-1){
tableModel.removeRow(row);
public static void main(String args[]) {
new TestJTable().setVisible(true);
private JScrollPane scrollPane;
private JTable table;
} -
How can I view the photos contained in a backup without restoring my iPhone?
I've had a new iPhone for a while now, and have recently remembered that I had backed up quite a few photos on iCloud in the past. I can see that my backup takes up a lot of memory through the iCloud app for windows.
My question is: How can I view a backup without using it to restore my iPhone. I don't currently have a mac, only PC and and iPhone.
Thanks.You cannot.
If the backup is local (not iCloud) you might be able to using a 3rd party tool. -
How to build View that join 2 tables that one of them exists twice in join
Hello ,
I want to create a database view (in CRM) which joins
the following tables : but000 , but050 , but000 again .
but000 holds BP general data (including BP name).
but050 holds the connection (relationship) between two BPS.
I want to build a dictionary view that shows a relation between
two BP and I want also to see their names ... that's why I need
but000 twice ..
I didn't manage doing this in SE11 (like I can do it with abap code).
I need this view in order to use it in a search help I need to build.
Does anyone know a way to build a view like this ?
If it is not possible how can I build a search help that shows
relation with names ?
Please , help .
Thanks ,
N.S.Creating a Database View
Procedure
1.Enter an explanatory short text in the field Short text.
You can for example find the view at a later time using this short text.
2.Define the tables to be included in the view in the Tables field of the Tables/Join conditions tab page.
Keep in mind that you can only include transparent tables in a database view.
3.Link the tables with join conditions.
If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys (see Foreign Key Relationships and Join Conditions).
Place the cursor on a table name and choose Relationships. All foreign keys to other tables defined for this table are displayed. Select the foreign keys and choose Copy. The join condition is now derived from the definitions in the foreign key.
If you only want to see the foreign key relationship existing between two tables, you must first select these two tables (click on the first column of the input area Tables) and then choose Relationships.
4.On the View fields tab page, select the fields that you want to copy to the view.
Choose Table fields. All the tables contained in the view are displayed in a dialog box. Select a table. All the fields contained in this table are displayed. You can copy fields by selecting them in the first column and choosing Copy.
You can also include an entire table in the view (see Includes in Database Views).
5.On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to be displayed with the view (see Maintaining Selection Conditions for Views).
The selection conditions define the data records that can be selected with the view.
6.With Goto ® Technical settings, you can (optionally) maintain the technical settings of the database view.
You can define whether and how the database view should be buffered here. Proceed as for the technical settings of a table (see Maintaining Technical Settings). Note that only the settings for buffering can be maintained for database views.
7.On the Maintenance status tab page, select the maintenance status of the database view.
If the view contains more than one table, the maintenance status read only cannot be altered.
8.Save your entries. You are asked to assign the view a development class.
You can change this development class later with Goto ® Object directory entry.
9.Choose activate.
Girish -
How to CREATE VIEW to merge two tables each of which has CLOB-typed column
I failed in creating a view to merge two tables that have CLOB-type column each.
The details are:
Database: Oracle 9i (9.2.0)
Two tables "test" and "test_bak", each of which has the following structure:
ID Number(10, 0)
DUMMY VARCHAR2(20)
DUMMYCLOB CLOB
The following operation fails:
create view dummyview (id, dummy, dummyclob) as
select id, dummy, dummyclob from test
union
select id, dummy, dummyclob from test_bak;
I was announced:
select test.id, test.dummy, test.dummyclob
ERROR in line 2:
ORA-00932: inconsistent data type: required - , but CLOB presented.
But if creating views from only ONE table with CLOB-type columns, or from two tables WITHOUT CLOB-typed columns, the creation will succeed. The following 1) and 2) will succeed, both:
1) one table, with CLOB-typed column
create view dummyview (id, dummy, dummyclob) as
select id, dummy, dummyclob from test;
2) two tables, without CLOB-typed columns
create view dummyview (id, dummy) as
select id, dummy from test
union
select id, dummy from test_bak;
I want to merge the two tables all, with complete columns, how to write the CREATE VIEW SQL statement?
many thanks in advanceDong Wenyu,
No.
But you could do this:
SELECT source.*, nvl (tab1.clob_column, tab2.clob_column)
FROM your_table1 tab1, your_table2 tab2, (
SELECT primary_key, ...
FROM your_table1
UNION
SELECT primary_key, ...
FROM your_table2
) source
WHERE source.primary_key = tab1.id (+)
AND source.primary_key = tab2.id (+)
In other words, do the set operation (UNION (ALL)/INTERSECT/MINUS) on just the PK columns before pulling in the LOB columns.
d. -
How can i view and manipulate the Tables created in SAP DB (Netweaver)
Hai ,
i created one table in SAP DB integrated in Netweaver for J2EE Application.
How can i view the table in SAP DB.
Can i see the data inserted in that table in table view manner ?.
can i edit the data in the SAP DB table?.Hello Kishor,
You need to download the SQL Studio. With this tool login to the SAPDB server and you will be able to view the content of your table and manipulate your table as well
http://dev.mysql.com/doc/maxdb/tools.html
Regards
Abdul -
How to refresh view object in doDML
How can i refresh an view object in the doDML Method?
How are you changing the key? - is it using the iterator or attribute value in bindings (or) directly thru the view object.
if you are doing directly on the view object, on commit - you might have to refresh the iterator by calling executeQuery method on it.
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCIteratorBinding dcIter = (DCIteratorBinding) bindings.get("DEPARTMENTS_VO1Iterator");
if(dcIter != null){
dcIter.executeQuery();
}Thanks,
Navaneeth -
How to Refresh View Link and Associations
hi all,
How can I Refresh my viewlink and Association.
Nani:)Can you provide your use-case, your query seems to be very generic
-
How to refresh View bind variables or is this a bug in Entity Validation?
Maybe I am missing something. Here is the scenario:
1. I got a create/edit form with a field (*tfA*) that is a af:selectInputText that launches a search form pop up.
2. The form (which is tied to an Entity ADF object) has validations -both attribute specific and global (for lack of better term..) set up in the Entity Object Editor wizard.
3. I noticed that when a global validation fails, when i launch the search form from tfA, it ignores whatever search criteria I enter (ie it retrieves all rows)
Otherwise, the pop up search form works perfectly. I am wondering if I need to reset the bindVariable values somewhere or if it has something to do with a refreshCondition. What confuses me though is that it works just fine if the global (ADF Entity) validations don't fail.
The pop up search form uses the default ExecuteWithParams action listener that calls a view with bindvariables. My JDev version is 10.1.3.4
Any help is appreciated. Thank you.The issue turns out to be that the Global Entity Validation continues to fire even after you click on the find button on your selectInputText component. The Entity validation is interrupting the call to the View Object in my pop up search window because somehow clicking search on the pop up is submitting the originating form.
I am still not sure if this is a bug that needs to be addressed or I was doing something odd but the solution is the following:
in your *<af:selectInputText />,* add the following: *actionListener="#{bindings.Rollback.execute}"*
This will prevent the validation from firing because it thinks that you are trying to submit the form when all you're doing is actually launching a search pop up.
Hope that helps.
Edited by: rrey on Aug 3, 2009 3:58 PM -
How to keep view column in a table
Hi,
I have two table and one view(I have same data in any other schema so I don't want to keep same data in both schema) I want to make primary key in first table based on one column from 2nd table and one column from view, but it's not looking possible if it's possible so how, if it is not there is any other solution.
Thanks and Regards, Khawar.Hello all,
Thanks for reply following are view and table desc.
SQL> desc emp_dept_vw
Name Null? Type
EMP_ID NOT NULL VARCHAR2(10)
F_NAME NOT NULL VARCHAR2(50)
M_NAME VARCHAR2(15)
L_NAME VARCHAR2(15)
DESIGNATION VARCHAR2(40)
JOIN_DATE DATE
REGION_ID VARCHAR2(15)
DEPT_ID VARCHAR2(30)
FAMILY_NAME VARCHAR2(20)
SEX CHAR(1)
LOCATION VARCHAR2(20)
DEPT_NAME VARCHAR2(30)
SECTION VARCHAR2(40)
SQL> desc pc_user
Name Null? Type
PC_SERIAL NOT NULL VARCHAR2(20)
PRINTER_SERIAL VARCHAR2(20)
SQL> desc pc
Name Null? Type
PC_SERIAL NOT NULL VARCHAR2(20)
BRAND NOT NULL VARCHAR2(50)
HDD_MODEL_NO CHAR(18)
MEM_CODE VARCHAR2(20)
NIC_CODE VARCHAR2(20)
PROCESSOR_ID VARCHAR2(20)
MONITOR_ID VARCHAR2(20)
MOTHER_BOARD VARCHAR2(30)
SUPP_ID VARCHAR2(20)
FDD VARCHAR2(20)
PRICE NOT NULL NUMBER
WARRANTY NOT NULL VARCHAR2(20)
DELIVERY_DATE NOT NULL DATE
REMARKS NOT NULL VARCHAR2(200)
I want to use EMP_ID from EMP_DEPT_VW view as a part of composite key in PC_USER table.
Many Thanks .
Khawar -
How to refresh bean value in advanced table from vo/database value in PR.
Hi,
I have requirement in which I have two OAF pages. First is the base page and second is popup page. Base page displays some values in table with messagetextinput. When user clicks button on the base page it is calling popup page. Now user changes value (Messagetextinout) in popup page and submits the popup page (which also closes popup page). Submit request in popup page does some calculation and also changes value of base page VO. But when control goes back to the base page, base page messagetestinput bean does not get changed even though VO is changed by submit request in popup page.
Note: Popup page is closed using java script with following code.
window.opener.submitForm('DefaultFormName'); // Submits base page to refresh the values in base page
window.close(); // Closes popup pageThanks for the prompt reply.
On base page, in advance table I am having a column called Value, it is either text field or LOV item based on the value of a list item called field type located in same advanced table, if value of the field type is FIELD we are displaying LOV else we are displaying text box. User can enter 4000 characters long value in Value column when field type value is not FIELD. Length of the Value text box in advanced table is limited so we have provided a link so that user can open the modal dialog box with the default value as base page's value column's value.
We have set the destination URI property of the link on base page to open modal dialog box:
javascript:var a = window.open('OA.jsp?page=/cummins/oracle/apps/perc/perc4681/g2config/webui/perc4681ValueModalDialogPG&retainAM=Y&pDetailSeqNo={@G2DetailSeqNo}','a','height=500,width=900,status=yes,toolbar=no,menubar=no,location=no'); a.focus();
We have developed a page for modal dialog box, on PR of this page we are calling following method of AM to populate the default value.
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
Serializable[] params;
params = new Serializable[] {pageContext.getParameter("pDetailSeqNo")};
OAMessageTextInputBean value = (OAMessageTextInputBean) webBean.findChildRecursive("value");
value.setValue(pageContext,(String)am.invokeMethod("getPopupValue",params));
public String getPopupValue(String pSeqNumber)
Perc4681G2DetailVOImpl vo1 = getPerc4681G2DetailVO1();
Row[] r1 = vo1.getFilteredRows("G2DetailSeqNo",pSeqNumber);
vo1.setCurrentRow(r1[0]);
Perc4681G2DetailVORowImpl row = (Perc4681G2DetailVORowImpl) vo1.getCurrentRow();
return (String)row.getAttribute("Value");
On modal dialog box we have a button (it is not submit button) called done, we have set destination uri property of the button as below:
javascript:opener.submitForm('DefaultFormName',1,{'XXX':'abc','Value':document.getElementById('value').value});window.close();
we are sending the value entered in dialog box as parameter to base page.
We have called below procedure of AM on PR of base page
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
Serializable[] params;
OAPageLayoutBean oapagelayoutbean = pageContext.getPageLayoutBean();
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (!pageContext.isBackNavigationFired(false))
some code
else
if((("abc").equals(pageContext.getParameter("XXX"))))
String pop_up_attr_value= pageContext.getParameter("Value");
params = new Serializable[] {pop_up_attr_value};
am.invokeMethod("setPopupValue",params);
enableDisable(webBean, pageContext);
else if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "G2DetailCreateTxn", true))
OADialogPage dialogPage = new OADialogPage(STATE_LOSS_ERROR);
pageContext.redirectToDialogPage(dialogPage);
else if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "G2DetailUpdateTxn", true))
OADialogPage dialogPage = new OADialogPage(STATE_LOSS_ERROR);
pageContext.redirectToDialogPage(dialogPage);
public void setPopupValue(String pVal)
Perc4681G2DetailVOImpl vo1 = getPerc4681G2DetailVO1();
Perc4681G2DetailVORowImpl row = (Perc4681G2DetailVORowImpl) vo1.getCurrentRow();
row.setAttribute("Value",pVal);
Everything mentioned above is working as expected whereas I am not able to see the value ented in modal dialog window in value column of base page.
Value is getting set in VO but it is not getting reflected in page.
Could you please let me know where I am going wrong.
Thanks in advance. -
How to refresh the data in a container and to update the new data
Hi,
I have created a Module Pool Program in which i have two containers to display the long text.
Initially this container is filled and based on some condition i want to update the text in the same conatiner.
I am using the below two classes to do all this.
cl_gui_textedit,
cl_gui_custom_container,
Could someone help me how to remove the long text in the container and update the new long text.
I am getting the new long text but not able display it in the same container. Please someone help me how to refresh and update the container.
Thanks in advance.Hi
Try this.
IF cl_gui_textedit IS INITIAL.
create control container
CREATE OBJECT cl_gui_custom_container
EXPORTING
container_name = 'Container Name''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
create text_edit control
CREATE OBJECT cl_gui_textedit
EXPORTING
parent = cl_gui_custom_container
wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
wordwrap_to_linebreak_mode = cl_gui_textedit=>false
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5.
ENDIF.
*--use method to set the text
CALL METHOD cl_text_edit->set_text_as_stream
EXPORTING
text = t_lines ( Internal table with long text).
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
regards,
Raghu. -
How to view data in transparent table
How can I view data in transprent tables like HRHAP.
Thanks.hi,
Write down a sample code to view the same ..
start-of-selection.
select * from hrhap into table it_hrhap.
if sy-subrc = 0.
loop at it_hrhap.
write : it_hrhap-plan_version,
it_hrhap-appraisal_id.
endloop.
endif. -
When we go for view ,fm,infosetquery,and tables
Hi Masters,
1)when we go for view ,fm,infosetquery,and tables ?
& how to create view ,fm,infosetquery,and tables ?
2)what is user of numeric pointer?
3)what is different between view ,fm,infosetquery,and tables ?
4) what is user of view ,fm,infosetquery,and tables ?
please help on this issue by give good understading answerHi Kumar,
1. Maintaining Generic DataSources.
http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/frameset.htm
Create View:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
Create FM:
http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm
Create Table:
http://help.sap.com/saphelp_nw04/helpdata/en/87/773a55f35a65409009e87261c84eb2/frameset.htm
Create Infoset query:
How to create infoset query
what is an infoset and infoset query?
Create Generic Delta:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
2. Numeric pointer:
Generic Delta with Numeric pointer.
Generic Delta Extraction
Delta specific fields
You can have the differences and the uses of View, FM, Infoset query and table from above links itself.
Hope these helps u...
Regards,
KK. -
How to refresh a JTable of a class from another thread class?
there is an application, in server side ,there are four classes, one is a class called face class that create an JInternalFrame and on it screen a JTable, another is a class the a thread ,which accept socket from client, when it accept the client socket, it deal the data and insert into db,then notify the face class to refresh the JTable,but in the thread class I used JTable's revalidate() and updateUI() method, the JTable does not refresh ,how should i do, pls give me help ,thank you very much
1,first file is a class that create a JInternalFrame,and on it there is a table
public class OutFace{
public JInternalFrame createOutFace(){
JInternalFrame jf = new JInternalFram();
TableModel tm = new MyTableModel();
JTable jt = new JTable(tm);
JScrollPane jsp = new JScrollPane();
jsp.add(jt);
jf.getContentPane().add(jsp);
return jf;
2,the second file is the main face ,there is a button,when press the button,screen the JInternalFrame. there is also a thread is beggining started .
public class MainFace extends JFrame implements ActionListener,Runnable{
JButton jb = new JButton("create JInternalFrame");
jb.addActionListener(this);
JFrame fram = new JFrame();
public void performance(ActionEvent e){
JInternalFrame jif = new OutFace().createOutFace(); frame.getContentPane().add(JInternalFrame,BorderLayout.CENTER);
public static void main(String[] args){
frame.getContentPane().add(jb,BorderLayout.NORTH);
frame.pack();
frame.setVisible(true);
ServerSokct ss = new ServerSocket(10000);
Socket skt = ss.accept()'
new ServerThread(skt).start();
3.the third file is a thread class, there is a serversoket ,and accept the client side data,and want to refresh the JTable of the JInternalFrame
public class ServerThread extends Thread{
private skt;
public ServerThread(Sokcet skt){
this.skt = skt;
public void run(){
OutputObjectStream oos = null;
InputObjectStream ios = null;
try{
Boolean flag = flag;
//here i want to refresh the JTable,how to write??
catch(){}
4.second is the TableModel
public class MyTableModel{
public TableModel createTableModel(){
String[][] data = getData();
TableModel tm = AbstractTableModel(
return tm;
public String[][] getData(){
}Use the "code" formatting tags when posting code.
Read this article on [url http://www.physci.org/codes/sscce.jsp]Creating a Simple Demo Program before posting any more code.
Here is an example that updates a table from another thread:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=435487
Maybe you are looking for
-
I have photos on my 4s of someone else, taken in a very different area than what I am in. Also receiving some of their imessages?
-
I orginally synced and starting using my iphone4 with one laptop. Now I want to change and always sync and manage my iphone from a new laptop. Right now I want to update the iOS, but before I can do that, I need to get all my apps from the iphone to
-
How can I enlarge the calendar section for full-time events?
Hi folks, since the update to ios 5 the calendar section at the top of the daily view (with full-time events) is limited in size. If I enter more than two messages I have to scroll to see all events. This is annoying since I typically miss the birthd
-
Regarding infotype 2 Dr title for country 47 turkey
Hello all techies, Hope you are doing great. I have one issue regarding infotype 2 for country 47 turkey. In table T522G if I put "Dr" as a title for blank (for male and female) I cant see that in infotype 2 for the maintenance purpose. Is there any
-
Don't know where they have come from. How do I get rid of them?