My own EVENTS in java
is it at all posible in java to create you own event s. and have listeners for them like the one ActionListener has the method actionPerformed(ActionEvent e) can i make my own methods that are triggered by events
and are only called if a new event is generated. like this method it is only called if the use clickes a button.
if there is a way could you please tell or show me how.
many thanks
Hi,
"Events" are an application of the observer pattern, usually implemented with the event generator idiom in Java. Please see full example in this detailed article.
http://www.javaworld.com/javaworld/jw-09-1998/jw-09-techniques.html
Similar Messages
-
Send an event from Java Web Service to BPEL
Hi,
I have a requirement where from an Async BPEL service I have to call a Java Web Service. After the completion of its task Java Web Service will fire an event that has to be consumed by the BPEL to initiate further process. Can anybody help me with how to send an event from Java Web Service and at the same time consume it in BPEL?
Thanks,
AnujSee the following posts for your answer
http://blogs.oracle.com/soabpm/entry/event_delivery_network_chapter
http://blogs.oracle.com/soabpm/entry/using_the_event_api_to_publish
http://guidoschmutz.wordpress.com/2010/01/12/using-the-event-api-to-publish-an-event-to-the-event-delivery-network-edn-the-spring-way/ -
Exception occurred during event dispatching:java.lang.NoSuchMethodError
Hello,
We have upgraded to the latest Oracle Application Server version 10.1.2.3.0 and the webutil version is 1.0.6.
But we face the following error while accessing the web link. Following message captured from Java Console.
Please suggest if you have any solutions/idea about this error. Thanks !
Oracle JInitiator: Version 1.3.1.22
Using JRE version 1.3.1.22-internal Java HotSpot(TM) Client VM
Maximum size: 50 MB
Compression level: 0----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
q: hide console
s: dump system properties
t: dump thread list
x: clear classloader cache
0-5: set trace level to <n>
Downloading http://si02938.in.irt.com:7778/forms/java/frmall_jinit.jar to JAR cacheDownloading http://si02938.in.irt.com:7778/forms/java/frmwebutil.jar to JAR cacheDownloading http://si02938.in.irt.com:7778/forms/java/jacob.jar to JAR cacheDownloading http://si02938.in.irt.com:7778/forms/java/FileInformation.jar to JAR cacheDownloading cacheproxyHost=nullproxyPort=0connectMode=HTTP, native.
Forms Applet version is : 10.1.2.3
Exception occurred during event dispatching:java.lang.NoSuchMethodError at oracle.forms.webutil.common.VBeanCommon.init(VBeanCommon.java:281) at oracle.forms.handler.UICommon.instantiate(Unknown Source) at oracle.forms.handler.UICommon.onCreate(Unknown Source) at oracle.forms.handler.JavaContainer.onCreate(Unknown Source) at oracle.forms.engine.Runform.onCreateHandler(Unknown Source) at oracle.forms.engine.Runform.processMessage(Unknown Source) at oracle.forms.engine.Runform.processSet(Unknown Source) at oracle.forms.engine.Runform.onMessageReal(Unknown Source) at oracle.forms.engine.Runform.onMessage(Unknown Source) at oracle.forms.engine.Runform.processEventEnd(Unknown Source) at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source) at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Edited by: user12233243 on Nov 16, 2009 10:28 PM
Edited by: user12233243 on Nov 16, 2009 10:29 PMhi
read the following configuration i hope it will help u.
How to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
Solution
Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
here are steps to get a small test form running, using WebUtil 1.06.
Note: [OraHome] is used as an alias for your real oDS ORACLE_HOME.
Feel free to copy this note to a text editor, and do a global find/replace on
[OraHome] with your actual value (no trailing slash). Then it is easy to
copy/paste actual commands to be executed from the note copy.
1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
2) Copy or move jacob.jar and jacob.dll
[JacobStage] is the folder where you extracted Jacob, and will end in ...\jacob_18
cd [JacobStage]
copy jacob.jar [OraHome]\forms\java\.
copy jacob.dll [OraHome]\forms\webutil\.
The Jacob staging area is no longer needed, and may be deleted.
3) Sign frmwebutil.jar and jacob.jar
Open a DOS command prompt.
Add [OraHome]\jdk\bin to the PATH:
set PATH=[OraHome]\jdk\bin;%PATH%
Sign the files, and check the output for success:
[OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\frmwebutil.jar
[OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\jacob.jar
4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
you may skip this step. Otherwise,
Create a schema to hold the WebUtil stored code, and privileges needed to
connect and create a stored package. Schema name "WEBUTIL" is recommended
for no reason other than consistency over the user base.
Open [OraHome]\forms\create_webutil_db.sql in a text editor, and delete or comment
out the EXIT statement, to be able to see whether the objects were created witout
errors.
Start SQL*Plus as SYSTEM, and issue:
CREATE USER webutil IDENTIFIED BY [password]
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
CONNECT webutil/[password]@[connectstring]
@[OraHome]\forms\create_webutil_db.sql
-- Inspect SQL*Plus output for errors, and then
CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
Reconnect as SYSTEM, and issue:
grant execute on webutil_db to public;
5) Modify [OraHome]\forms\server\default.env, and append [OraHome]\jdk\jre\lib\rt.jar
to the CLASSPATH entry.
6) Start the OC4J instance
7) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
It is important to generate the PLX, to avoid the FRM-40039 discussed in
Note 303682.1
If the PLX is not generated, the Webutil.pll library would have to be attached with
full path information to all forms wishing to use WebUtil. This is NOT recommended.
8) Create a new FMB.
Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
There is no need to Subclass the WebutilConfig object.
Attach the Webutil.pll Library, and remove the path.
Add an ON-LOGON trigger with the code
NULL;
to avoid having to connect to an RDBMS (optional).
Create a new button on a new canvas, with the code
show_webutil_information (TRUE);
in a WHEN-BUTTON-PRESSED trigger.
Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
9) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
the "Application Server URL" is empty.
Then append "?config=webutil" at the end, so you end up with a URL of the form
http://server:port/forms/frmservlet?config=webutil
10) Run your form.
If its Correct/Helpful please mark it thanks.
Sarah -
How to trigger own events?
How can you create your own events to be triggered?
For instance, I have an InputStream that I've got through a Socket that's listening for incoming data. I want to signal/trigger an event when data comes in so that the gui (in another class) can take appropriate actions. How can you do this?The basic idea is this:
public interface SockeListener
void dataEvent(/* pass a parameter if needed. Often an event interface is added */);
public class MySocket
private final List listeners = new ArrayList();
public void addListener(SocketListener listener)
listeners.add(listener);
public void removeListener(SocketListener listener)
listeners.remove(listener);
private void triggerEvent()
for (Iterator i = listeners.iterator(); i.hasNext();)
((SocketListener) i).dataEvent();
}Check out the PropertyChangeSupport class also. -
How i can make my own connection in java source of a jsp page
How i can make my own connection in java source of a jsp page (How to get connection from JNDI datasource address) ?
imagine that i have a rowset in a web page , now i want to do some operation using
plain JDBC , so i will need a connection object.
I tried to get one of my rowsets connection but it return null ?
what is best way to retrive a connection from JNDI datasource that we define for our project?
for example if i have
myRowSet.setDataSourceName("java:comp/env/jdbc/be");
in web page constructor
now i want a pure connection from the same datasource ? JNDI
Thank youIt is not hard to get your own connection from datasource.
in your case you need to do like the the following code.
i provide sample to show you how to catch the exception and create an statement .
Connection con =null;
try{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/be");
con = ds.getConnection();
java.sql.Statement st =con.createStatement();
}catch(SQLException sqlex){
sqlex.printStackTrace();
sqlex.getNextException().printStackTrace();
catch(NamingException nex){
nex.printStackTrace();
hth
Masoud kalali -
How to deprecate my own method in java
How to deprecate my own method in java, so that my compiler gives a warning when i use a deprecated method?
Mark it as deprecated as specified in the javadoc guide, (available on this site). You deserve an RTFM but I'm feeling nice today ;->
-
Exception occurred during event dispatching:java.security.AccessControlExce
Hi,
I' m getting an error while connecting to database ORACLE 9i.
I'm using JDK 1.6.0
Actually the code is about how an Japplet connects to database ORACLE 9i
when i was connecting using normal program i had got the connection easily .
When i used this JApplet ,i'm getting this error.
CODE:
import java.awt.*;
import javax.swing.* ;
import java.sql.*;
import java.awt.event.*;
import java.util.*;
/*<applet code="jln" width=400 height=400></applet>*/
public class jln extends JApplet
public void init()
JTabbedPane jtp=new JTabbedPane();
jtp.addTab("View Marks",new VmPanel());
getContentPane().add(jtp);
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (Exception e)
{ e.printStackTrace();
System.out.println("Failed to load driver.");
class VmPanel extends JPanel implements ActionListener
JButton b1,b2;
TextArea ta1;
JTextField jtf1;
Connection con=null;
public VmPanel()
b1=new JButton("ok!");
b2=new JButton("clear");
ta1=new TextArea();
jtf1=new JTextField(10);
add(jtf1);
add(b1);
add(b2);
add(ta1);
b1.addActionListener(this);
b2.addActionListener(this);
public void actionPerformed(ActionEvent ae)
String str1=ae.getActionCommand();
if(str1=="ok!")
try
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:jlngbldb", "scott", "tiger");
Statement stmt = con.createStatement ();
String ht=jtf1.getText();
System.out.println("\nHello\n");
ResultSet rs = stmt.executeQuery("SELECT * FROM jln WHERE ht='"+ht+"'");
while(rs.next())
ta1.setText ("");
ta1.setText("Name:"+rs.getObject("name")+"HallTicket:"+rs.getObject("ht")+"C.G:"+rs.getObject("cg")+"C.D:"+rs.getObject("cd")+"UNIX:"+rs.getObject("unix")+" S.T.M:"+rs.getObject("stm")+"N.N:"+rs.getObject("nn")+"I.S:"+rs.getObject("ins"));
rs.close();
stmt.close();
con.close();
catch(SQLException ex)
System.err.println("SQLException: " + ex.getMessage());
if(str1=="clear")
ta1.setText("");
jtf1.setText("");
if(str1==null)
ta1.setText ("");
ta1.setText("Please enter Hall Ticket Number above....");
}//action performed close
}//panel closed
AND THE ERROR IS:
Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.util.PropertyPermissio
n oracle.jserver.version read)
at java.security.AccessControlContext.checkPermission (AccessControlConte
xt.java:321)
at java.security.AccessController.checkPermission(AccessController.java:
546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
85)
at java.lang.System.getProperty(System.java:627)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:433)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:548)
at java.sql.DriverManager.getConnection(DriverManager.java :180)
at VmPanel.actionPerformed(jln.java:60)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
63)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2183)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased (BasicButtonL
istener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5921)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3316)
at java.awt.Component.processEvent (Component.java:5686)
at java.awt.Container.processEvent(Container.java:1960)
at java.awt.Component.dispatchEventImpl(Component.java:4360)
at java.awt.Container.dispatchEventImpl(Container.java :2018)
at java.awt.Component.dispatchEvent(Component.java:4194)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4222
at java.awt.LightweightDispatcher.processMouseEvent (Container.java:3886)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3816)
at java.awt.Container.dispatchEventImpl(Container.java:2004)
at java.awt.Component.dispatchEvent (Component.java:4194)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:592)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:270)
at java.awt.EventDispatchThread.pumpEventsForFilter (EventDispatchThread.
java:198)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:171)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:166)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:158)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:119)
I'm getting this error when i pressed the OK! JButton.
PLEASE ! help me by correcting this error.
Thank You.Presumably you are running this via a browser where the applet is served from the server.
Applets can only connect back to the origination server and using the name that the origination server was accessed with.
And that has nothing to do with JDBC, all connections work that way.
Your driver uses a connection thus it will not work unless it attempts to connect to the server that originated the applet.
Solutions
1. Connect to the server
2. Sign the applet
3. Modify the policy file of each client that will run the applet. This is not a good idea in an unsecure network.
Note as well that in an unsecure network is most often a bad policy to have an applet directly accessing a database regardless. -
Non-gui/swing event in java possible ?
Dear Members :
Is it possible in java to raise and catch business events, as is possible in other languages, I know.
For instance - when I create a vehicle instance, that will trigger an event which will add that vehicle to vehicle_list(List) - something like that ? I am aware of Observer/Observable, but that is only if the source changes.
Could someone please explain with syntax if that's possible, I mean, tackling any kind of business events in java ?
Thanks in advance
AtanuThere is no out of the box event model... and be careful how you phrase these things... and in you are pedantic enough the pattern reveals itself.
What notifies the sales people that a new car is ready? It's not the Car itself is it? How about the factory? You're getting warmer... Who else does the factory tell? Maybe the tax man?
Yeah... Observe/r/able was a good first thought.
And... You might want to look into the Spring framework... I think you're groping for AOP.
Cheers. Keith. -
How to handle doubleclick mouse event in java
i want to handle double click mouse event in java
i use getClickCount() function
but i want that on onetime click show othere windows
and on doubleclick show diif. window
but problem is that onetime is occuer always if u click doubleclickMaybe post some code so we can see what, if anything, you are doing wrong.
Examing the results of a call to getClickCount() is the correct way to detect a double click. -
Events in java..
1) how many types of events in java ?
2) which is the super class of all the event classes?
3) information about an event is stored in an instance of a subclass of an_______?
4) who sends events to java?WAQAR_NAWAZ wrote:
1) how many types of events in java ?
2) which is the super class of all the event classes?
3) information about an event is stored in an instance of a subclass of an_______?
4) who sends events to java?God forgive. -
Exception occurred during event dispatching: java.lang.UnsatisfiedLinkError
Hi,
Greetings. I am watching the following error in linux. I greatly appreciate your help.
Thanks
Rajkumar
Exception occurred during event dispatching:
java.lang.UnsatisfiedLinkError: no test in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at test.<clinit>(test.java:3)
at Test.action(Main27.java:926)
at java.awt.Component.handleEvent(Component.java:5341)
at Test.handleEvent(Main27.java:1023)
at java.awt.Window.postEvent(Window.java:1614)
at java.awt.Component.postEvent(Component.java:3895)
at java.awt.Component.dispatchEventImpl(Component.java:3631)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
at java.awt.Dialog$1.run(Dialog.java:542)
at java.awt.Dialog$3.run(Dialog.java:569)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:567)
at Main27.first(Main27.java:67)
at Main27.action(Main27.java:163)
at java.awt.Component.handleEvent(Component.java:5341)
at java.awt.Component.postEvent(Component.java:3885)
at java.awt.Component.postEvent(Component.java:3895)
at java.awt.Component.postEvent(Component.java:3895)
at java.awt.Component.dispatchEventImpl(Component.java:3631)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)In your test.java (Which must be yours, since all serious classes have capitalised names) you are trying to load a JNI library with
static {
System.loadLibrary("test");
}Somewhere you should have a library file, I think called libtest.so, but the JVM can't find it.
Find out where it is and put -Djava.library.path=<the directory>
on the java command. -
When I try to open a gradebook program called powerschool, I get a message that Java is not deteced, but my computer indicates that it has Java. I can't download any version of Java because I get a message that Apple has its own version of java. My computer indicates that no new software updates are needed.
Start here: http://support.apple.com/downloads/#java
-
Can I provide my own implementation of java.security.acl.Acl ?
Hi,
If I write my own securrity realm, am I able to use my own implementaion of
'java.security.acl.Acl' and 'java.security.acl.AclEntry' or do I have to use
the implementation provided by weblogic ? When Security.checkPermission() is
called, does it solely rely on APIs defined in 'java.security.acl' or does
it really expect to talk to an instance of weblogic 'AclImpl' ?
Thanks, Alexandre.
Alexandre Vauthey
Software Engineer
Application Networks
444 Ramona street
Palo Alto, CA 94301Yes, you can do this.
Alexandre Vauthey wrote:
Hi,
If I write my own securrity realm, am I able to use my own implementaion of
'java.security.acl.Acl' and 'java.security.acl.AclEntry' or do I have to use
the implementation provided by weblogic ? When Security.checkPermission() is
called, does it solely rely on APIs defined in 'java.security.acl' or does
it really expect to talk to an instance of weblogic 'AclImpl' ?
Thanks, Alexandre.
Alexandre Vauthey
Software Engineer
Application Networks
444 Ramona street
Palo Alto, CA 94301 -
Traping all Events with Java App
Is it possible to trap all mouse event from Java code even when the java app is not in focus? Lets say a VB app is running and then Java needs to know that that VB app has been clicked?
ANy useful tip on this?Is it possible to trap all mouse event from Java code
even when the java app is not in focus? No.
You will have to do this with native code. -
Need to paste on/off button in its own event structure?
I am studying the CLD exam car wash vi attached.
First question, I noticed the Start button is pasted inside its own event structure. Is this absolutely necessary, can I just paste somewhere else?
I guess it was paste there because the Start button has no wiring so it looks neater to paste in its own event structure, am I right?
Second question, I noticed the Stop button is already wired to the red while loop stop, so pressing it would stop the vi already. But there is also the Stop value change event, this looks redundant, no? Or is it something really necessary??
Solved!
Go to Solution.
Attachments:
Car Wash LV86.zip 73 KBBoth are necessary.
1. The boolean's terminal while be read when the event is triggered. This read triggers the latch operation (so the button snaps back).
2. The event structure would wait for an event and nothing would happen until another event is triggered. Only after the event structure is 'run', the stop value is read.
Felix
www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml
Maybe you are looking for
-
I have a .js file that is part of a web-application. The web application is deployed on tomcat. This .js file in turn calls a .html file deployed on jetty. This .html file is responsible for starting the cometd service, but when i run my web-app, fir
-
What's happening here: iCloud Photos preparing photos for 'Photos' app?
This morning I came back from a weekend trip to Prague, where I took a number of photos with my iPhone 6. On my Mac I fired up iCloud Photos to see if everything was imported properly. That was about an hour ago. Since then I am presented with this s
-
Table Background in CSS Layout
I am updating a website using the Two Column Fixed Header and Footer layout. Please see http://www.ellingtonridge.org/ERCC_newsite/. I used a graphic for the Body background. I want to enter a small table to hold calendar links in the right sidebar.
-
Having multiple open periods in GL
what is the best practice for closing periods in GL when: a) you have 48 open open periods b) 22000 unposted journals (Some mass allocation, some imported from spreadsheets) varying from early as 2002. c) no evidence that close process for Create B
-
Where is a link to download Creativity Apps, ipad air buy in Dec 13
HI, i cannot download Creativity Apps (free apps) for iPad Air i have buy in December 2013 in iTune store but ask me to buy all apps : photo numbers pages ect. i 've read all help but nothing there is place a link where go to download this apps > TH