How to close PROGRAMMATICALLY FileDialog object ?
Hi All,
I'm developing some module that is going to run in a separate thread and to be kind of Demo Runner, in other words it will simulate human events such as mouse clicking and key strokes.
At one of the application sequence stages FileDialog is opened with already selected file. My object is informed about this event and should "click" OPEN button or "press" ENTER, e.g. to send key/mouse/action event to the FileDialog object.
If I have to close my own dialog objects - there is no problem since I just send events to their listeners, but what should I do with the "system" object ?
How can I achieve this effect ?
Thanks in advance !
Have a look at java.awt.Robot or call the dispose () method of your created dialog.
Kind regards,
Levi
Similar Messages
-
I'm using Flash CS3, running code in ActionScript 3.
I use the Loader class to load a child SWF file, which then
takes over the entire area on my website that is reserved for
Flash. If the user decides to stop watching the SWF file before it
is completed, he hits the "close" button within the child SWF,
ultimately causing the Loader.unload() method to be executed. So
far, so good, only the sound from the remaining portion of the SWF
file keeps playing. According to the Flash Docs for the
Loader.unload() method:
"As a best practice, before you unload a child SWF file, you
should explicitly close any streams in the child SWF file's
objects, such as LocalConnection, NetConnection, NetStream, and
Sound objects. Otherwise, audio in the child SWF file might
continue to play, even though the child SWF file was unloaded."
It then gives an example that assumes you already have access
to the Sound object, so closing the Sound object is done by:
mySound.close();
The only problem is that I have no idea how to access the
Sound object when I use the Loader.load() method. Where is this
beast? I can't seem to find anything in the documentation that
tells me how to find the Sound object after calling Loader.load().
As a temporary fix, I modified the target SWF file so that when the
"close" button is hit, it calls the "stop()" function; however,
this only stops the sound, it does not close the associated Sound
object, and I presume it continues to lurk around in memory with
nothing useful to do. (When the user hits the "close" button in the
child SWF file, it creates a "bubbling" event so that the Loader
class can call the Loader.unload() method on it.)
I've attached code for your reference.
Any help is deeply appreciated!
-DanAck! Looks like I hijacked this thread, sorry.
I'm doing almost exactly the same thing the OP is doing...
Loader class to load an external SWF (which is a video file FLV).
If the user hits the "close" button on the video, the video goes
away as it should but the audio continues.
I understand that I need to close any NetConnection and
NetStream objects in addition to unloading the movie. What I don't
understand is how to do that. I'm sure that it's a syntax thing I'm
just not getting right. I would just really like a more detailed
explanation of stopping NetConnections and NetStreams (but an
explanation for the not-so-actionscript-experienced LOL).
Thanks. -
How to use programmatic VO objects in creating a Tree in ADF Page.
Hi,
I have two programmatic VOs namely Plan and Model. Even though functionally there is a Master/Detail (Plan --> Model) relationship between them, we are not creating any View Link as they are programmatic VOs. Requirement is to show this master/detail data as tree in the ADF page. Any pointer on how to achieve this?
Thanks
Edited by: user766455 on Jan 3, 2012 10:34 AMMy question is not related Traversing Tree... my question is how to create Tree in the ADF page using programmatic VOs, which don't have master and details View Link.
-
How to close a model object connection for Adaptive RFC?
Hi,
I'm calling two update RFC one after another in a single WebDynpro program. I like to close the session/connection after calling the first RFC. I'm using twp separate JCo connection for calling these two RFCs. Still I find both the RFCs are called in the same session.
Is there any way to close the JCo session from the code?
Thanks ,
DipankarHi Dipankar
If you want the framework to control the opening and closing of the connections , then use TASK_SCOPE when initializing the modelobjects ,in which case the connection will remain open, for the lifecycle of a single call.
The intialization should be as below
(CompanyCodeList is your model object)
CompanyCodeList compCode = (CompanyCodeList)WDModelFactory.getModelInstance(CompanyCodeList.class, WDModelScopeType.TASK_SCOPE);
Bapi_Companycode_Getlist_Input bapIn = (Bapi_Companycode_Getlist_Input) compCode.createModelObject(Bapi_Companycode_Getlist_Input.class);
wdContext.nodeBapi_Companycode_Getlist_Input().bind(new Bapi_Companycode_Getlist_Input());
Regards
Pran -
How to close programaticaly IE window which FileDownload opens ?
Hi there
I have popup with FileDownload control on it. Clicking the link(FileDownload) system opens IE window with small "Download" window (open,save,cancel).
The question is how to close programmatically this IE window after download (or open) is complete ?
I don't want the user to have to do that manually ?
ThanksStefan,
Have you set "attachment" type for your binary resource?
If you are using NW04s (7.00) then make sure you specified:
final IWDResource resource = <...>;
resource.setAttachement( false );
If you are using NW04 (6.40) then:
final ISimpleTypeModifiable mtype = attr.getModifiableSimpleType();
final IWDModifiableBinaryType btype = (IWDModifiableBinaryType)mtype;
btype.setMimeType(
new WDWebResourceType("xls", "application/vnd.ms-excel", true/* is Attachemnt */)
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
Programmatically adding objects/components
Hi guys,
I'm just new to Java and the Java Studio Creator.
Anyway, I would just like to ask how you can programmatically add objects or components after each event, let's ay after every press of a button, another text field, output text, image or whatever component, is added on the page.
I'm trying to do an application wherein the user can enter number of rows they want to show in a table (grid panel) which has by default, 5 columns with one image inside every column. If the user enters 2, the table should now have 2 rows that are identical.
Hope you can help me with this problem guys. Thanks in advance!Anyway, I would just like to ask how you can
programmatically add objects or components after each
event, let's ay after every press of a button,
another text field, output text, image or whatever
component, is added on the page.The components of a page are organized into a tree structure with parent-child relationships. Therefore, all you need to do is acquire a reference to the component you want to be the parent, create a new instance of the child, and add the new child to the parent component's list of children.
In a page bean, it looks something like this. Assume you want to add a new Output Text component inside the form component named "form1". Because Creator binds all of the components to properties in the page bean, finding this component is easy -- there is an instance variable with the same name that contains a reference to this component. So, you would do something like this:
UIComponent parent = form1; // Get reference to parent
HtmlOutputText newOne = new HtmlOutputText();
newOne.setValue("This is the text value");
// set other properties as needed
parent.getChildren().add(newOne);The value returned by getChildren() is a standard java.util.List, so you can insert children anywhere in the list, remove them, reorganize them, or whatever is needed.
Craig McClanahan -
How to close the object after generation Excel file
I have generated excel file. I save that file using "Save" button on dialog-box. After i go to menu navigation at that time i got javascript error.
please give me the solution how to close objects after generating excel file.Hi,
Pls don't forget to reward points and close the question if you find the answers useful.
Eddy -
I'm trying to create a programmatic view object from an Oracle Stored procedure that returns a single row containing Oracle Object Types. I created a Domain for my Oracle Object type called BillingInfo. Here is the code for my view object so far:
package billing;
import billing.common.BillingInfo;
import java.lang.Integer;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.Date;
import java.text.SimpleDateFormat;
import oracle.jbo.JboException;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
// --- File generated by Oracle Business Components for Java.
public class BillingInfoViewImpl extends ViewObjectImpl
// billing info procedure call variables
private final static int BILLING_LOGGED_ON_USER_ID = 0;
private final static int BILLING_BILL_TO_USER_ID = 1;
private final static int BILLING_TRANSACTION_DATE = 2;
private final static int BILLING_TRANSACTION_DETAILS1 = 3;
private final static int BILLING_TRANSACTION_DETAILS2 = 4;
private final static int BILLING_TRANSACTION_DETAILS3 = 5;
private final static int BILLING_TRANSACTION_DETAILS4 = 6;
private final static int BILLING_TRANSACTION_DETAILS5 = 7;
private final static int BILLING_TRANSACTION_COUNT = 8;
private final static int BILLING_TOTAL_CHARGE_AMOUNT = 9;
private final static int BILLING_PAY_TYPE = 10;
private final static int BILLING_ERROR_MESSAGE = 11;
private final static int BILLING_ERROR_CODE = 12;
private final static int BILLING_RETURN_VALUE = 13; /*
* This is the PLSQL block that we will execute
private static final String SQL =
"begin ecs_jdbc_wrappers.get_billing_info_jdbc(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?, ?, ?);end;";
* This is the default constructor (do not remove)
public BillingInfoViewImpl() { }
* Overridden framework method.
* Executed when the framework needs to issue the database query for
* the query collection based on this view object. One view object
* can produce many related result sets, each potentially the result
* of different bind variable values. If the rowset in query is involved
* in a framework-coordinated master/detail viewlink, then the params array
* will contain one or more framework-supplied bind parameters. If there
* are any user-supplied bind parameter values, they will PRECEED the
* framework-supplied bind variable values in the params array, and the
* number of user parameters will be indicated by the value of the
* numUserParams argument.
protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
* If there are where-clause params they will be in the 'params' array.
* NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
* ---- but this parameter value should be oracle.jbo.domain.Number type.
int sqlcode = 0; // statement sql code
String errorMessage = null; // statement error message
String loggedOnUserId = null; // IN VARCHAR2
String billToUserId = null; // IN VARCHAR2
Date transactionDate = new Date(); // IN DATE
BillingInfo transactionDetails1 = null; // IN OUT billing_info
BillingInfo transactionDetails2 = null;
BillingInfo transactionDetails3 = null;
BillingInfo transactionDetails4 = null;
BillingInfo transactionDetails5 = null;
int transDetailsCount = 0; // IN INTEGER
String payType = null; // IN VARCHAR2
if (params != null)
loggedOnUserId = (String)params[BILLING_LOGGED_ON_USER_ID];
System.out.println("USER ID:" + loggedOnUserId);
billToUserId = (String)params[BILLING_BILL_TO_USER_ID];
System.out.println("BILLED USER ID:" + billToUserId);
if (params[BILLING_TRANSACTION_DETAILS1] != null) {
System.out.println(params[BILLING_TRANSACTION_DETAILS1]);
transactionDetails1 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS1];
transDetailsCount = transDetailsCount + 1;
if (params[BILLING_TRANSACTION_DETAILS2] != null) {
transactionDetails2 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS2];
transDetailsCount = transDetailsCount + 1;
if (params[BILLING_TRANSACTION_DETAILS3] != null) {
transactionDetails3 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS3];
transDetailsCount = transDetailsCount + 1;
if (params[BILLING_TRANSACTION_DETAILS4] != null) {
transactionDetails4 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS4];
transDetailsCount = transDetailsCount + 1;
if (params[BILLING_TRANSACTION_DETAILS5] != null) {
transactionDetails5 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS5];
transDetailsCount = transDetailsCount + 1;
payType = (String)params[BILLING_PAY_TYPE];
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Set the value of the bind variables
st.setString(1, loggedOnUserId);
st.setString(2, billToUserId);
// Set Transaction Date to todays date
java.sql.Timestamp sqlTs = new java.sql.Timestamp(transactionDate.getTime());
st.setTimestamp(3, sqlTs);
System.out.println("TRANS DATE:" + sqlTs);
st.setObject(4, transactionDetails1);
if (transactionDetails2 == null) st.setNull(5, Types.STRUCT, "BILLING_INFO");
else st.setObject(5, transactionDetails1);
if (transactionDetails3 == null) st.setNull(6, Types.STRUCT, "BILLING_INFO");
else st.setObject(6, transactionDetails1);
if (transactionDetails4 == null) st.setNull(7, Types.STRUCT, "BILLING_INFO");
else st.setObject(7, transactionDetails1);
if (transactionDetails5 == null) st.setNull(8, Types.STRUCT, "BILLING_INFO");
else st.setObject(8, transactionDetails1);
st.setInt(9, transDetailsCount);
st.setString(11,payType);
* Register OUT paramters
st.registerOutParameter(4, Types.STRUCT, "BILLING_INFO");
st.registerOutParameter(5, Types.STRUCT, "BILLING_INFO");
st.registerOutParameter(6, Types.STRUCT, "BILLING_INFO");
st.registerOutParameter(7, Types.STRUCT, "BILLING_INFO");
st.registerOutParameter(8, Types.STRUCT, "BILLING_INFO");
st.registerOutParameter(10, Types.DOUBLE);
st.registerOutParameter(12, Types.VARCHAR);
st.registerOutParameter(13, Types.INTEGER);
st.registerOutParameter(14, Types.INTEGER);
// execute the stored procedure
st.execute();
// get the SQLCODE
sqlcode = st.getInt(13);
System.out.println("sqlcode returned:" + sqlcode);
errorMessage = st.getString(12);
System.out.println("Error Message:" + errorMessage);
catch (SQLException s) {
System.out.println("sqlcode returned:" + sqlcode);
System.out.println("Error Message:" + errorMessage);
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
super.executeQueryForCollection(qc, params, numUserParams);
This almost works except when I try to print out the attributes I get an error. I beleive I have to override some of the view object framework methods. If so, how do I go about this? Is it the same methods overridden in this example Getting a View Object's Result Rows from a REF CURSOR? http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html
NatYes. only difference is that your VO will just have one row in it.
-
How to close extended classic PO in ECC...
Hi Friends...
We are in SRM 7.02 and ECC 6.05 in Extended Classic Scenario. One PO had been created for 1 Quantity 3 years ago. There was no GR/IR document posted against that PO. Now that PO had been archieved from SRM. But still PO is available in ECC with open quantity and also its appearing in the open PO report. Now requester wanted, the PO to be closed in ECC and shouldnot appear in the open PO list.
How to handle this situation.. How to close the extended classic PO in ECC at this scenario. As PO not available in SRM, we can not do anything from SRM side.
Your inputs are appreciated....
Regards
Sivakumar KandasamyHi Sivakumar,
If you mean how to archive PO in MM side, please refer to the following info:
====
In ECC system, if you want to archive a MM PO, please use transaction
SARA->archive object MM_EKKO.
456129 FAQ: Archiving in purchasing
401318 Archiving: Additional information
====
If you want to delete this ECC PO, please use BAPI_PO_CHANGE and
refer to the following test data:
Parameters: PURCHASEORDER = XXXXXXXXX
Parameters: POITEM
PO_ITEM = 00010
DELETE_IND = X
Parameters: POITEMX
PO_ITEM = 00010
PO_ITEMX = X
DELETE_IND = X
You also need to run BAPI_TRANSACTION_COMMIT after BAPI_PO_CHANGE for updating the change.
Regards,
Ivy -
Programmatic View Objects + View Links
Ive constructed some programmatic view objects to grab data from 2 custom java business services (for example: Persons and Addresses). The reasons for them being custom and separate are out of my control.
I need to easily represent a relationship between these 2 view objects so Ive constructed a ViewLink between them. However I cant figure out exactly what ADF needs from me in terms of method implementations in my ViewObjects?
When I drop the master data control onto a JSF via a Tree table, it looks as though its not actually filtering the detail rows. I.e. if master is a Person, and detail objects are Addresses, each Person tree node has all Addresses under it. Im assuming this is because the Address ViewObject is programmatic and so ADF doesn't know how to filter the results?
How can I setup this ViewLink between 2 programmatic ViewObjects such that the ViewLink works like its supposed to?Hello,
Steve Muench´s sample 132 implements what you are trying to accomplish. Inspect the sample and let us know if you have questions about it.
http://blogs.oracle.com/smuenchadf/resource/examples#132
Juan C. -
View Link on two programmatic view objects
Hello,
I use Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407
I have two programmatic View Objects with data from other sources (an ArrayList in my example).
Now I would like to create a View Link on it. How can I do this?
I'm quite new on Java and ADF...
I know it is possible because I already found Steve's example 132 here [http://blogs.oracle.com/smuenchadf/examples/|http://blogs.oracle.com/smuenchadf/examples/]
But could somebody create a simple example based on my example classes below (which is understandable for a newbie like me ;-) ?
Has been asked already here, but I did not found a solution as yet.
Error with view link and ADF table Tree
This is my example code for the view objects:
Employee.java:
private Number empno;
private String ename;
private Number dept;
with getters and setters...
Department.java
private Number deptno;
private String dname;
with getters and setters...
public class StaticDataDepartmentsImpl extends ViewObjectImpl {
int rows = -1;
private List<Department> departments = new ArrayList<Department>();
protected void executeQueryForCollection(Object rowset, Object[] params,
int noUserParams) {
// Initialize our fetch position for the query collection
setFetchPos(rowset, 0);
super.executeQueryForCollection(rowset, params, noUserParams);
// Help the hasNext() method know if there are more rows to fetch or not
protected boolean hasNextForCollection(Object rowset) {
return getFetchPos(rowset) < rows;
// Create and populate the "next" row in the rowset when needed
protected ViewRowImpl createRowFromResultSet(Object rowset,ResultSet rs) {
ViewRowImpl r = createNewRowForCollection(rowset);
int pos = getFetchPos(rowset);
populateAttributeForRow(r, 0, departments.get(pos).getDeptno());
populateAttributeForRow(r, 1, departments.get(pos).getDname());
setFetchPos(rowset, pos + 1);
return r;
// When created, initialize static data and remove trace of any SQL query
protected void create() {
super.create();
// Setup string arrays of codes and values from VO custom properties
initializeStaticData();
rows = (departments != null) ? departments.size() : 0;
// Wipe out all traces of a query for this VO
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
// Return the estimatedRowCount of the collection
public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
return rows;
// Subclasses override this to initialize their static data
protected void initializeStaticData() {
Department d1 = new Department();
d1.setDeptno(new Number(10));
d1.setDname("IT");
Department d2 = new Department();
d2.setDeptno(new Number(20));
d2.setDname("HR");
departments.add(d1);
departments.add(d2);
// Store the current fetch position in the user data context
private void setFetchPos(Object rowset, int pos) {
if (pos == rows) {
setFetchCompleteForCollection(rowset, true);
setUserDataForCollection(rowset, new Integer(pos));
// Get the current fetch position from the user data context
private int getFetchPos(Object rowset) {
return ((Integer)getUserDataForCollection(rowset)).intValue();
public class StaticDataEmployeesImpl extends ViewObjectImpl {
int rows = -1;
private List<Employee> employees = new ArrayList<Employee>();
protected void executeQueryForCollection(Object rowset, Object[] params,
int noUserParams) {
// Initialize our fetch position for the query collection
setFetchPos(rowset, 0);
System.out.println("in executeQueryForCollection");
super.executeQueryForCollection(rowset, params, noUserParams);
// Help the hasNext() method know if there are more rows to fetch or not
protected boolean hasNextForCollection(Object rowset) {
System.out.println("in hasNextForCollection. Rows:" + rows);
return getFetchPos(rowset) < rows;
// Create and populate the "next" row in the rowset when needed
protected ViewRowImpl createRowFromResultSet(Object rowset,ResultSet rs) {
ViewRowImpl r = createNewRowForCollection(rowset);
int pos = getFetchPos(rowset);
System.out.println("in createRowFromResultSet. Pos=" + pos);
populateAttributeForRow(r, 0, employees.get(pos).getEmpno());
populateAttributeForRow(r, 1, employees.get(pos).getEname());
populateAttributeForRow(r, 2, employees.get(pos).getDept());
setFetchPos(rowset, pos + 1);
return r;
// When created, initialize static data and remove trace of any SQL query
protected void create() {
super.create();
// Setup string arrays of codes and values from VO custom properties
initializeStaticData();
rows = (employees != null) ? employees.size() : 0;
System.out.println("in create(). Rows=" + rows);
// Wipe out all traces of a query for this VO
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
// Return the estimatedRowCount of the collection
public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
return rows;
// Subclasses override this to initialize their static data
protected void initializeStaticData() {
Employee e1 = new Employee();
e1.setEmpno(new Number(2333));
e1.setEname("Emp1");
e1.setDept(new Number(10));
Employee e2 = new Employee();
e2.setEmpno(new Number(1199));
e2.setEname("Emp2");
e2.setDept(new Number(20));
Employee e3 = new Employee();
e3.setEmpno(new Number(3433));
e3.setEname("Emp3");
e3.setDept(new Number(10));
Employee e4 = new Employee();
e4.setEmpno(new Number(5599));
e4.setEname("Emp4");
e4.setDept(new Number(20));
Employee e5 = new Employee();
e5.setEmpno(new Number(5676));
e5.setEname("Emp5");
e5.setDept(new Number(10));
Employee e6 = new Employee();
e6.setEmpno(new Number(7867));
e6.setEname("Emp6");
e6.setDept(new Number(20));
employees.add(e1);
employees.add(e2);
employees.add(e3);
employees.add(e4);
employees.add(e5);
employees.add(e6);
// Store the current fetch position in the user data context
private void setFetchPos(Object rowset, int pos) {
if (pos == rows) {
setFetchCompleteForCollection(rowset, true);
setUserDataForCollection(rowset, new Integer(pos));
// Get the current fetch position from the user data context
private int getFetchPos(Object rowset) {
return ((Integer)getUserDataForCollection(rowset)).intValue();
Who can help?
Thnx in advance!
RolfRolf,
I guess when we try to do it for you, we end up with almost the sample code provided by Steve Muench.
So there from my point of view it doesn't make sense to do it all over.
Take some time and study the sample code, run it without changes and after that try some changes which suits your use case better.
If you don't understand what's going on in the sample post the question here and we try to help you.
Timo -
Changing a Programmatic View Object's query at run-time
Hi,
I've created a programmatic View Object using the information in '35.9.3 Key Framework Methods to Override for Programmatic View Objects' in the Oracle Middleware Fusion Guide and bound it to a BarChart. This has worked fine using the following:
String myColumn = "Quant1";
protected void create() {
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
String myQuery = "SELECT Service as MyService, " + myColumn + " as MyValue FROM ColumnTestTable WHERE 1 = 1";
getViewDef().setQuery(myQuery);
setQuery(myQuery);
I also have my data updating automatically. I have public properties in my viewObjImpl class which I can set and update the value of myColumn. I then thought it would just be a case of re-calling the create() method and the SQL would be updated and my chart would auto-update using the new column to select it's values, the value of the property updates and the create method is called but the chart doesn't display any different data and stops auto-updating. Does anybody know if this is possible and if so what I may have missed?
Cheers, TomHi Timo,
I moved everything to a different public method and solved the problem by firing the execute() method which I hadn't been doing previously and the chart updates with the correct data.
However, once I execute the SQL my chart stops auto-updating with changes to the data in the database - do you know how I update the SQL query but keep my chart auto-updating? Perhaps I have to re-register for the registerDatabaseChangeListener for the query collection?
Thanks in advance, Tom -
How to Populate the JTable Object programatically with SQL Results
I'm wondering if someone could help me on how to populate the JTable Object with SQL Results wherein the Row of tjhe JTable object is automatically adjusted depending on how many records you have queried.
Thanks in advance and God bless! (",)
* frmMain.java
* Created on October 4, 2006, 6:15 AM
package tds;
import java.io.*;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.imageio.*;
import javax.swing.JFrame;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
* @author Dexter.Carlit
public class frmMain extends javax.swing.JFrame {
private Connection connection = null;
private DefaultTableModel model;
/** Creates new form frmMain */
public frmMain() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel3 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jGrid = new javax.swing.JTable();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jProgressBar1 = new javax.swing.JProgressBar();
jPanel2 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
getAccessibleContext().setAccessibleName("frmMain");
jSplitPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jSplitPane.setDividerLocation(200);
jSplitPane.setDividerSize(10);
jScrollPane2.setViewportView(jTree1);
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 916, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
jScrollPane1.setViewportView(jPanel3);
jSplitPane.setLeftComponent(jScrollPane1);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jLabel1.setText("First Name:");
jLabel2.setText("Last Name:");
jLabel3.setText("Position :");
jLabel4.setText("Department:");
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Results"));
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jGrid.setColumnSelectionAllowed(true);
jGrid.setName("");
jGrid.setTableHeader(jGrid.getTableHeader());
jScrollPane3.setViewportView(jGrid);
jScrollPane3.getAccessibleContext().setAccessibleName("rset");
org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE)
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
jButton1.setText("Find");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
jButton2.setText("Clear");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
.add(1, 1, 1))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
.add(jPanel4Layout.createSequentialGroup()
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
jPanel4Layout.linkSize(new java.awt.Component[] {jButton1, jButton2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(jTextField1))
.add(18, 18, 18)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(jTextField2))
.add(16, 16, 16)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField3)
.add(jLabel4)
.add(jTextField4))
.add(14, 14, 14)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jProgressBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
.addContainerGap())
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jProgressBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
jTabbedPane1.addTab("Search", jPanel1);
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 458, Short.MAX_VALUE)
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 401, Short.MAX_VALUE)
jTabbedPane1.addTab("Directory", jPanel2);
jSplitPane.setRightComponent(jTabbedPane1);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane)
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null}
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.updateUI();
}//GEN-LAST:event_jButton2MouseClicked
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
try {
//Load and register SQL Server driver
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//Establish a connection
Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://X.X.X.X:1433","MyAccount","MyPassword");
//Create a Statement object
Statement sql_stmt = connection.createStatement();
//Create a ResultSet object, execute the query and return a
// resultset
ResultSet rset = sql_stmt.executeQuery("SELECT * FROM EpxDirectory..Directory Order By LName");
// Populates a JTABLE Object
int i=0;
while (rset.next()){
String LName = rset.getString(1);
String FName = rset.getString(2);
String Position = rset.getString(3);
String Dept_Code = rset.getString(4);
String OffPhoneNo = rset.getString(5);
String LocalNo = rset.getString(6);
String OffMobileNo = rset.getString(7);
String HomePhoneNo = rset.getString(8);
String MobileNo = rset.getString(9);
String Email = rset.getString(10);
jGrid.updateUI();
jGrid.setValueAt(rset.getString(1).trim(),i,0);
jGrid.setValueAt(rset.getString(2).trim(),i,1);
jGrid.setValueAt(rset.getString(3).trim(),i,2);
jGrid.setValueAt(rset.getString(4).trim(),i,3);
jGrid.setValueAt(rset.getString(5).trim(),i,4);
jGrid.setValueAt(rset.getString(6).trim(),i,5);
jGrid.setValueAt(rset.getString(7).trim(),i,6);
jGrid.setValueAt(rset.getString(8).trim(),i,7);
jGrid.setValueAt(rset.getString(9).trim(),i,8);
jGrid.setValueAt(rset.getString(10).trim(),i,9);
i++;
//Close the ResultSet and Statement
rset.close();
sql_stmt.close();
//Close the database connection
connection.close();
System.out.println(Integer.toString(i) + " rows found");
} catch(Exception e) {
System.out.println("Failed to connect; Please view Stack Trace");
e.printStackTrace();
}//GEN-LAST:event_jButton1MouseClicked
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
}//GEN-LAST:event_formWindowOpened
public static void run(){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frmMain frmMain = new frmMain();
frmMain.setLocationRelativeTo(null); // Center the JFrame on the
frmMain.setVisible(true);
private void exitApplication() {
// try {
// //gui.putStatus("Closing the connection....please wait.....");
// if(connection != null) {
// // connection.close(); //Closing the connection object.
// } catch(SQLException ex) { //Trap SQLException
// //gui.putStatus(ex.toString());
System.exit(0); //Exit the aplication
* @param args the command line arguments
public static void main(String args[]) {
run();
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JTable jGrid;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSplitPane jSplitPane;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTree jTree1;
// End of variables declaration//GEN-END:variables
}Use code tags.
Don't mix GUI and JDBC together. Split them out into separate classes.
You have a good start, but you will need to loop through your resultset and also pull the ResultSet metaData for you column headings -
How to close or delete a PO?
Hi
How to close or delete a PO ?
I can see to delete the line items .
But if I wanna delete a PO itself , is it possible ?
regards,Hi Sandeep
You can flag all items for delete in Purchase Order,
Go to ME22N and enter purchase order. Select item and click on delete button (which is available just above item details) and save.
Once you complete mark for deletion, you can proceed for archiving.
transaction code for archiving: SARA
Object: MM_EKKO
also check above link for detail process.
regards
Srinivas -
How to close open subvi's in the beginning of running the main vi.
Hello,
I've got a pretty large application that is dependant on several subvi's.
I'm searching for a way to close the subvi's when I start running my main application.
All these subvi's need to be closed during the initialisation phase of my main application. (before it is doing its main task.)
I know it is possible to ask for the VI's in memory for my LabVIEW application, but I don't know how to close a subvi programmatically. (unload it from memory)
What I want to do is check for a list of open subvi's in the beginning of my main application. (only a limited set of subvi's)
If one of the subvi's is indeed open I want to close it (unload it) and then start doing my thing from within the main application.
Note: The subvi's need to be closed so that I can load them dynamically later in the program. If one of the subvi's is open and I start running my main application I get an incorrect behaviour.
Thx for the help!
Message Edited by noxus on 11-14-2006 08:07 AMNoxus,
I programmed a small example.
If you have further questions do not hesitate to come back...
BR,
ThSa
(Additonally I added the screenshot in term of that you do not have LV 8.20)
http://www.newgistics.com
Attachments:
VI_Server_LV820.zip 12 KB
Maybe you are looking for
-
Why greyed out options in iTunes radio, and other behavior
iOS 7.1.2 on a 4S. In the past couple of days, when accessing the 'star' menu on the lower left hand side, the "play more like this" and "never play this again" are greyed out. Naturally, I can certainly "add to my wish list", because that will event
-
Why I cannot open PDF files in net pages by iPad ?
-
is there a way to select and send multiple photos??? if not there should be. my problem is that i sent 7 photos individually to my work address. i tried opening in photoshop but after the first 2, the program only updated the image to the next one in
-
Black screen after transferring data to new Mac
I just migrated data to my new Mac from my old one using the Migration Assistant. The old Mac indicated the transfer was complete, but I can only see a black screen on the new Mac, even after turning it on and off.
-
Hello to everybody. To explane my scenario I will give you an example: Storage type CT1 has several storage bins. Every storage bin can contain one or more HU. I can set the maximum number of SU that the bin can contain in the putaway strategy P. Thi