Closing Parent Applet Window
I am setting the seperate window = TRUE in my formsweb.cfg. This opens up the form as a seperate applet. This is what I want. But how do I close the window which loaded this applet? I want only the applet to be active, remaining all windows closed.
I followed the recommendation, but in my case it doesn't work.
The code
HTMLbodyAttrs=onLoad='javascript:self.moveTo(2000,2000)'
or
HTMLbodyAttrs=onLoad='javascript:self.moveTo(1601,1201)'
doesn’t work properly. I have noticed that if the browser original size is not full screen, then when that javascript code runs, the browser just moves down to maximum possible bottom position, but it doesn’t disappear or get minimized – browser window size doesn’t change.
Who knows what the problem is?
Thanks,
Dmitri
Similar Messages
-
Hiding the parent applet window when using separteFrame=true
Using Oracle Forms 10.1.2.0.1 on UNIX Server (AIX) - IE version 6 - JInitiator 1.3.1.22
Hi. I've read some posts about using "HTMLbodyAttrs=onLoad='javascript:self.moveTo(1601,1201)'' in the formsweb.cfg file in order to hide the parent browser window, but for some reason this seems to be ignored after I added it to mine. The parent window remains open - no change seems to occur.
Do I need to bounce the OAS in order for this functionality to take affect? Or is there more that needs to be done in order to hide the parent window? Any help would be greatly appreciated. Thanks in advance.
Below is a portion of my formsweb.cfg file containing this code:
# HTML page title
pageTitle=Oracle Application Server Forms Services
# HTML attributes for the BODY tag
# HTMLbodyAttrs=
# immediately hide the applet parent window
HTMLbodyAttrs=onLoad='javascript:self.moveTo(1601,1201)'
# HTML to add before the form
# HTMLbeforeForm=
HTMLbeforeForm=<SCRIPT LANGUAGE="JavaScript">window.opener = top;</SCRIPT>
# HTML to add after the form
HTMLafterForm=
# Forms applet parameter: URL path to Forms ListenerServlet
serverURL=/forms/lservlet
# Forms applet parameter
codebase=/forms/java
...Infact,
Add javascript to the Oracle Forms basejinit.htm file
which permanently minimizes the parent browser
window.
Javascript can also be coded to provide a warning
to the user should an attempt be made to do a right
mouse click - close of the minimized browser
displayed in the MS Windows Taskbar.
I know very little javascripting.... Can you please give me a sample code....Thanks. -
Exception when closing an Applet window
Hi,
Every one.....
I have added Swing components to the JApplet. Everything is fine with the program . But when i am closing the appletviewer window it is throwing the following exception :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: component argument pData
at sun.awt.windows.Win32SurfaceData.initOps(Native Method)
at sun.awt.windows.Win32SurfaceData.<init>(Unknown Source)
at sun.awt.windows.Win32SurfaceData.createData(Unknown Source)
at sun.awt.Win32GraphicsConfig.createSurfaceData(Unknown Source)
at sun.awt.windows.WComponentPeer.replaceSurfaceData(Unknown Source)
at sun.awt.windows.WComponentPeer.replaceSurfaceData(Unknown Source)
at sun.awt.windows.WComponentPeer$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(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.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
So how to resolve this one, can anyone ?
ByeI could be proven wrong, but I think you can use hide() and show() for your windows. You could make a windowListener that when a user tries to close the window you would have it hide that window instead, and show the underlying window:
http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html
You might also want to make the new window that pops up a modal dialog window.
http://java.sun.com/products/jlf/ed2/book/HIG.Dialogs3.html
Hope that helps. -
how to close the applet window using a button on the applet
ravindra.alld wrote:
how to close the applet window using a button on the appletIs your applet in a web browser? If so the only way to hide visibility of the applet would be through javascript and css. So you would need an html button outside the applet to do this. -
I created a login button that when clicked a jframe pops up prompting for username and password. I created a "cancel" button in that window so if it is clicked the window is suppossed to close. I can't get it to work. I tried System.exit(0);
Have something like this in the JFrame object's event handling code:
setVisible(false); -
No such element exception when applet window closed
My applet can throw a NoSuchElementException as it closes during sudden death. The Java Console reports:
Exception in thread "AWT-EventQueue-2" java.util.NoSuchElementException
at java.util.LinkedList.getFirst(Unknown Source)
at java.awt.SequencedEvent.getFirst(Unknown Source)
at java.awt.SequencedEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)Sometimes that sequence displays once, sometimes twice. The error appears to be 90% or more repeatable.
1) open link in new window http://r0k.us/graphics/SIHwheel.html
2) view Color Log (menu item Help -=> Show Log)
3) close the whole browser window
It does not appear to happen without the dialog for the Color Log displayed. Nor does it appear to happen simply upon leaving that page. I'm guessing it is some sort of race condition as the applet is shut down and it doesn't have the surrounding window it started with. It only happens when running as an applet. When ran as a program, it always shuts down cleanly.
It occurs less often if you:
1) open the link in new window
2) leave the page
) come back to it while the Java Console is still alive (before JVM goes away)
3) view the Color Log
4) close the browser window.
I am running 64-bit Windows 7, and have observed this problem in Firefox, IE, and Chrome.
With no hints as to where within my code this is occurring (if indeed it is within "my" code), I have no idea how to write an SSCCE. The exception seems to relate to enumerations, which I believe must be occuring during the shut down seqence. See:
* http://download.oracle.com/javase/1.5.0/docs/api/java/util/NoSuchElementException.html
What can I try doing to prevent the error from occurring? (Besides not closing the browser window while my applet is running and has a dialog open. ;) )
*(added immediately before posting)* I just noticed that if any of the first three dialogs in the Help Menu are open, this behavior can occur. So it probably has nothing to do with the tables in the Color Log. The fourth, About, item is a simpler modal dialog, and you aren't even able to close the browser window while it is open.
Now that I know the crash can happen with any of the non-modal dialogs, I will write an SSCCE, just to see if it occurs in a much simpler applet, if nothing else.As promised, an SSCCE with build instructions and an applet environment.
CloseMyWindow.java import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
import javax.swing.*;
public class CloseMyWindow extends JApplet
public JPanel makeContent() {
JButton help = new JButton("Help");
help.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
Dimension size = new Dimension(400, 250);
HelpBox hb = new HelpBox("CloseMyWindow Help",
"cmwHelp.html", false, size);
JPanel jp = new JPanel();
jp.add(help);
return jp;
// method expected by applets
public void init()
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JPanel frame = makeContent();
setContentPane(frame);
} catch (Exception e) {
System.err.println("makeContent() failed to complete: " + e);
e.printStackTrace();
public static void main(String[] args)
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.add(new CloseMyWindow().makeContent());
frame.pack();
frame.setVisible(true);
class HelpBox extends JDialog
{ // general window for display of HTML page
HelpBox(String title, String pUrlS, boolean modal, Dimension pSize)
super((Frame)null, title, modal);
final String urlS = pUrlS;
final Dimension size = pSize;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JEditorPane ep = new JEditorPane();
ep.setEditable(false);
try {
URL url = getClass().getResource(urlS);
ep.setPage(url);
JScrollPane eps = new JScrollPane(ep);
eps.setPreferredSize(size);
getContentPane().add(eps, BorderLayout.CENTER);
} catch (IOException ioE) {
System.err.println("Unable to display help pane");
ioE.printStackTrace();
pack();
setLocationRelativeTo(null);
setVisible(true);
}cmwManifest.txt (be sure to end line with a carriage return) Main-Class: CloseMyWindowcmwHelp.html <html>
<head><title>Help for CloseMyWindow</title></head>
<body>
Good, you've opened this dialog. Now close the browser window containing
my applet.
</applet>
</body>
</html>cmw.html <html>
<head><title>Close My Window</title></head>
<body>
<applet code="CloseMyWindow.class"
archive="CloseMyWindow.jar"
width="450" height="300">
Your browser is completely ignoring the <i>applet</i> tag!
</applet>
</body>
</html>1) capture the 4 code segments above and save them as correspondingly-named files.
2) compile:
] javac CloseMyWindow.java
3) build the jar:
] jar cvfm CloseMyWindow.jar cmwManifest.txt *.class cmwHelp.html
4) test the jar:
] java -jar CloseMyWindow.jar
5) run the applet. Open page cmw.html in a new browser window
6) enable Java Console (mine is set to autostart on any applet or JNLP)
7) click the applet's Help button. A new dialog should open up.
8) close the browser window
9) observe if an error is reported in Java Console
I am seeing the error in this small applet. Maybe the .java file will give you guys some clues. -
i have two Q:
1) how do i close applet window ?
2)how can i know that the X button of the applet window was pressed?1) You don't...the browser takes care of that!
2) In IE, the applet's stop and destroy methods are called when the user moves from your HTML to another or the window is closed. In NN4+, the applet's stop method is called when the user moves away from your HTML and the destroy method is call when the window is closed. I don't bother with NN6.2+ because to me it's still a beta product based on Mozilla version .9 something and is so slow.
V.V. -
We are using separate_frame=true and trying to close the applet window (the one with the large gray box) after using the following post-form trigger:
if :system.last_form = 0 then
message('Please wait while Forms closes - '||:system.last_form);
web.show_document('/forms/html/close.htm','_self');
end if;
This works fine for the first form we open, but if that same form using Open_Form to open a child form we have a problem. When the child form is closed the user is returned to the parent calling form (which is expected), but then when the parent form is closed the separate applet window fails to close. Any suggestions?I guess you mis-interpreted the value of :SYSTEM.LAST_FORM. From the online-help:
SYSTEM.LAST_FORM represents the form document ID of the previous form in a multi-form application, where multiple forms have been invoked using OPEN_FORM.So LAST_FORM shows always the ID of the last activated form, and this will never be 0 if you issued one OPEN_FORM in your application. -
Unable to close parent browser window
Hi,
I am trying to close parent browser window from POST-FORM trigger using java script as it is described on metalink. My browser (IE 6) appears to be hanging when trying to execute web.show_document with java script. I am pretty sure that it is a known problem on Windows XP SP2. but I was unable to locate the right workaround. It seems that I tried everything with no success.
If somebody experienced similar problem and solved it I would appreciate if you could share your knowledge.
Thanks in advance,
Vadim
PS Environment Forms6i/XP SP2/IE6.0.2900I just found Re: Closing brower window It worked for me fine
Vadim -
Hi everyone, I've got an applet that opens a dialog. These dialogs are displayed as java applet windows.
I have a problem when using them. If a user clicks a button, they open this applet window (dialog).
While this dialog is open, if they click on some other application or another browswer window, and then come back to the window that houses the applet, the dialog that was showing is now not showing. The only way to show it again is minimize everything, then maximise browser window containing applet, and then moving it to the side to get the applet window (dialog) showing. Is there an automatic way to say that if any of these applet windows were open when losing focus, show them again when get focus back?
Thanks everybody
GrahamYou can fix the problem by using the following method to get a parent Frame for the Dialog. Use this and the dialog will always remain on top of the browser.
public Frame getDialogFrame()
/* CREATES AND POSITIONS A FRAME USED BY DIALOGS
TO ENSURE THAT DIALOG MODAL AND CENTRED OVER APPLET*/
Object parent = this.getParent();
while(!(parent instanceof Frame)) parent=((Component)parent).getParent();
Frame dialogFrame = (Frame) parent;
Point p = this.getLocationOnScreen();
dialogFrame.setLocation(p.x, p.y);
return dialogFrame;
} -
Modal popup window refresh the parent (calling) window/view
I have a modal popup window that is adding detail records. When this window is closed via the Hide method in my controller I would like to refresh the parent (calling) window/view.
What is the best way to do this?
Regards,
DianeHere's my process.....
2-windows & 3 views
Window 1 - Selection View and Detail View
Window 2 - Add View (used as a modal popup window called by a button click on the detail view)
Selection View has all the options for obtaining a list of data for the detail view. The detail view has an Add button. Component controller has the hide method and access to the other components that do the update/query methods. On the detail view the user can click Add and a popup modal window shows. User enters data and clicks either the add or cancel button. The Detail view needs to refresh to show the additional data that has been added by the modal window. There are calcuated values in the detail view from a supply function. This function is not running and the values are not changed.
What should be put in the hide method that will cause the detail view to obtain new data and supply the calculated values? If I was using the Add view as part of the same window as the detail/selection views I'd just put in a navigation link between the detail and add views and fire the plug. I like the idea of the popup window so I'd like to get this to work.
I put the wdContext.initialize() in the hide method - which yes - caused the detail view to run - however the context lost all the key values so I received a data not found. I then tried to initialize those nodes that did not contain the key values but the detail view did not display new values.
Thanks for any ideas.....Diane
Edited by: Diane Fuller on Jan 8, 2009 6:48 AM -
Hi,
I have an Applet which can pop-up a JAVA application window.
But the bottom bar of that pop-up window says " Unsigned Java
Applet Window". And I am not able to close the window without
closing the first Applet window. Need some help. Thanks.But the bottom bar of that pop-up window says "
Unsigned Java
Applet Window". You can't get rid of this without signing
And I am not able to close the window
without
closing the first Applet window. Need some help.you need a window listener (you can use window adapter)
newFrame.addWindowListener (new WindowAdapter () {
public void windowClosing (WindowEvent we) {
setVisible(false);
dispose();
Thanks. -
Closing of Applet(Very Urgent)
Hai All
A issue to be solved. I have on JApplet and a JOption is displayed on some conditions..on the click of the button in the JOption the applet has to be closed. How can the Applet be closed on some conditions. I used system.exit..it is not doing the thing...
Thanks in AdvanceBut that method will not close the applet window.....
-
Move to the parent applet on clicking the back button
Hey,Every Body!
I am trying to make a project in which i have a problem , my project has mutiple applets and i want that on clicking on the back button current applet should be closed and instantly the parent applet should be opened.
Please help me to solve this problem.
ThanksHey, you can take any two applets , i only want to move the parent applet on clicking on the back button .
For Example suppose on the first applet i have inserted my username and emailid then on clicking on the next button , second applet is opened in which i have to submit my personal details like my name, my address, my phone number ,but instantly i thought to change my email id or my username in that case i want that there should be a button on the second applet on clicking of which second applet should be closed and the parent applet should get focused again. -
I need help with java on windowsXP after updating iTunes to the latest version. My java will not work and I get error message need java virtual machine to run applet window. Did not have this problem prior to the iTunes update.
Please help, ThanksIf your library was working on your computer and then popped up empty all of a sudden then this might be what you need...
Empty/corrupt library after upgrade/crash
Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
When you get it all working make a backup!
tt2
Maybe you are looking for
-
Where to buy ATI Radeon HD 4870?
I have just bought a refurb MacPro 8 core (blimey) but want to put the ATI Radeon™ HD 4870 card in it sooner or later, but when I google it there seem to be so many different versions of this. e.g. a 'sonic version' etc, and so on, and they all look
-
How to send month as string to date
Hi my input comes as month year.( oct 2008 or Nov 2008 etc ) The target field is a Date. I have tried using Date trans but it doesnt accept strings. so is there a way send the incoming field without changing target data to string? Regards, Venkat.
-
Changing PLAF when a JComboBox is open?
I am trying to write a simple way of changing the look and feel that I can easily connect to most of the possible ways that someone might want to change the plaf (for example combo box, list, radio buttons, menus & popups etc) The best way of doing t
-
Why the keyboard in my ipad is in the middel of screen?
the keyboard in my ipad is in middel of screen ....i can't read or see what bhind it ...please answer me thank you :)
-
Why on windows 2000 xp sp2 am I getting a message that firefox is notresponding
I have another computer a Vista and when they are both running { or not} I get the firefox is not responding. It will suddenly stop for no reason some times 1 min. some times up to 5 min.