window

confirmation before press YES to exit program in Java

社会主义新天地 提交于 2020-01-12 06:23:52
问题 private void windowClosing(java.awt.event.WindowEvent evt) { int confirmed = JOptionPane.showConfirmDialog(null, "Exit Program?","EXIT",JOptionPane.YES_NO_OPTION); if(confirmed == JOptionPane.YES_OPTION) { dispose(); } } I want to close program by pressing Close Window Button with confirmation...But when I choose "No" to back to my Jframe, it still helps me to exit the program??? 回答1: From what i understand you want something like this addWindowListener(new WindowAdapter() { public void

Android: Overlay on Window over Activities of a Task

試著忘記壹切 提交于 2020-01-12 03:36:30
问题 I wanted to create an Overlay, like a HUD, that resides on the screen during my applications activity stack (the task of my app) changes. I found a couple of examples using WindowManager but I couldn't figure out the parameterization for the correct z-index if you want. It was either to weak the next activity would go ontop of my overlay or to strong the overlay was a system wide overlay that was visible also when the app moved into the background. I aim for displaying a view on top of all

Completely hide WPF window on startup?

南笙酒味 提交于 2020-01-12 02:49:06
问题 I want that my window is completely hidden on the startup. No window, no entry in the taskbar. The user doesn't see, the application is started. How can I realize that? Thank you! 回答1: An alternative to H.B.'s method is just to set the Visibility to hidden and set ShowInTaskbar to false. This still creates the window and lets it do its thing. <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com

Hidden window using javascript

感情迁移 提交于 2020-01-12 01:59:16
问题 Just wanted to know if it is possible to create a hidden window using javascript? 回答1: You can create an iframe var element = document.createElement("iframe"); element.setAttribute('id', 'myframe'); document.body.appendChild(element); You can hide an iframe by setting its width and height to zero or by setting its visibility to hidden in the stylesheet. 回答2: You can also create a new window visible only in taskbar with this workaround: window.open(path.html,'_blank', 'toolbar=no,status=no

How to create a hidden window in C++

北城以北 提交于 2020-01-11 17:12:33
问题 How to create a hidden window ? The purpose of this window is to receive some messages. 回答1: When you create the window, omit the WS_VISIBLE flag and don't call ShowWindow. 回答2: In a win32/mfc environment what you need to do is create a class and inherit from CWnd like this: class HiddenMsgWindow : public CWnd { ... } in the constructor of that class you would instantiate a window like this: HiddenMsgWindow::HiddenMsgWindow() { CString wcn = ::AfxRegisterWndClass(NULL); BOOL created = this-

Reliable way to find JRE installation in Windows bat file to run java program

浪子不回头ぞ 提交于 2020-01-11 13:34:11
问题 When installing the latest JRE 7 on Windows, it no longer adds the command java to the system path. So just calling java --version in bat file fails in that case (despite that Java from java.com is installed). What's a reliable way to find the java command installation directory in a windows bat file? I've seen it in the following locations: C:\Program Files\Java\jre6\bin\java.exe C:\Program Files\Java\jre7\bin\java.exe C:\Program Files (x86)\Java\jre7\bin\java.exe Not tried JRE 8 yet. Note:

selenium web driver - switch to parent window

对着背影说爱祢 提交于 2020-01-11 13:12:11
问题 I use selenium Web Driver. I have opened a parent window. After I click on the link the new window opens. I choose some value from the list and this window automatically closes. Now I need to operate in my parent window. How can I do this? I tried the following code: String HandleBefore = driver.getWindowHandle(); driver.findElement(By.xpath("...")).click(); for (String Handle : driver.getWindowHandles()) { driver.switchTo().window(Handle);} driver.findElement(By.linkText("...")).click();

New line as a delimeter of FOR loop

﹥>﹥吖頭↗ 提交于 2020-01-11 10:22:32
问题 I am new to batch script, and I am trying to parse a file that has key value (kind) of pairs delimited by new line. For example: the value of abc 1234 the value of def 5678 the value of ghi 9876 I would like to read this file using new line as delimited so that I can access the values. Something like for /f "tokens=1,2,3 delims='\n'" %%i in ('findstr /C:the value of abc 'filepath') do echo %%j 回答1: You can't set 'new line' as delimiter. Try this: @echo off &setlocal for /f "tokens=1*delims=:"

New line as a delimeter of FOR loop

帅比萌擦擦* 提交于 2020-01-11 10:22:08
问题 I am new to batch script, and I am trying to parse a file that has key value (kind) of pairs delimited by new line. For example: the value of abc 1234 the value of def 5678 the value of ghi 9876 I would like to read this file using new line as delimited so that I can access the values. Something like for /f "tokens=1,2,3 delims='\n'" %%i in ('findstr /C:the value of abc 'filepath') do echo %%j 回答1: You can't set 'new line' as delimiter. Try this: @echo off &setlocal for /f "tokens=1*delims=:"

What is the best way to show a WPF window at the mouse location (to the top left of the mouse)?

六眼飞鱼酱① 提交于 2020-01-11 05:37:07
问题 I have found that this works PART of the time by inheriting the Windows Forms mouse point and subtracting out the height and width of my window to set the left and top (since my window's size is fixed): MyWindowObjectThatInheritsWindow window = new MyWindowObjectThatInheritsWindow(); System.Windows.Point mouseLocation = GetMousePositionWindowsForms(); window.Left = mouseLocation.X - 300; window.Top = mouseLocation.Y - 240; window.Show(); Edit: Here is the code for getting the mouse position..