本文整理汇总了Java中com.sun.jna.platform.WindowUtils类的典型用法代码示例。如果您正苦于以下问题:Java WindowUtils类的具体用法?Java WindowUtils怎么用?Java WindowUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WindowUtils类属于com.sun.jna.platform包,在下文中一共展示了WindowUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getProcessWindowTitle
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
/**
* @param processName .exe name
* @return window title, if found - else null
*/
public static String getProcessWindowTitle(String processName) {
final String[] res = {null};
List<DesktopWindow> windows = WindowUtils.getAllWindows(true);
for (DesktopWindow dw : windows) {
if (dw.getFilePath().endsWith(processName)) {
String result = dw.getTitle();
if (!result.isEmpty()) {
if (!result.contains("MSCTFIME") && !result.contains("Default IME")) {
if (res[0] == null || res[0].length() < result.length()) {
if(res[0] != null) {
log.db("Changing window name from " + res[0]);
}
res[0] = result;
String msg = "Set to " + result;
if (!msg.equals(lastMessage)) {
log.db(msg);
lastMessage = msg;
}
}
}
}
}
}
return res[0];
}
开发者ID:rococode,项目名称:rensa,代码行数:30,代码来源:WindowTitleFetcher.java
示例2: setAlphaMode
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
private static void setAlphaMode(Window window, float ratio) {
try {
if (SystemInfo.isMacOSLeopard) {
if (window instanceof JWindow) {
((JWindow)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
} else if (window instanceof JDialog) {
((JDialog)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
} else if (window instanceof JFrame) {
((JFrame)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
}
}
else if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT)) {
AWTUtilitiesWrapper.setWindowOpacity(window, 1.0f - ratio);
}
else {
WindowUtils.setWindowAlpha(window, 1.0f - ratio);
}
}
catch (Throwable e) {
LOG.debug(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:WindowManagerImpl.java
示例3: setAlphaMode
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
private static void setAlphaMode(Window window, float ratio) {
try {
if (SystemInfo.isMacOSLeopard) {
if (window instanceof JWindow) {
((JWindow)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
}
else if (window instanceof JDialog) {
((JDialog)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
}
else if (window instanceof JFrame) {
((JFrame)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
}
}
else if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT)) {
AWTUtilitiesWrapper.setWindowOpacity(window, 1.0f - ratio);
}
else {
WindowUtils.setWindowAlpha(window, 1.0f - ratio);
}
}
catch (Throwable e) {
LOG.debug(e);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:DesktopWindowManagerImpl.java
示例4: setWindowMask
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
@Override
public void setWindowMask(Window w, Icon mask) {
try {
WindowUtils.setWindowMask(w, mask);
} catch( ThreadDeath td ) {
throw td;
} catch( Throwable e ) {
LOG.log(Level.INFO, null, e);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NativeWindowSystemImpl.java
示例5: findAndShowWindow
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
public static DesktopWindow findAndShowWindow(String title) {
List<DesktopWindow> allWindows = WindowUtils.getAllWindows(true);
for (DesktopWindow window : allWindows) {
if (window.getTitle().equals(title)) {
user32.SetForegroundWindow(window.getHWND());
return window;
}
}
return null;
}
开发者ID:frolovm,项目名称:poker-bot,代码行数:11,代码来源:User32Utils.java
示例6: getProcessList
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
/**
* Gets a list of currently active processes by creating a snapshot.
*
* @return List of currently active processes
* @throws Win32Exception
* If the operation was not successful
*/
public static ProcessList getProcessList() throws Win32Exception {
final ProcessList plist = new ProcessList();
final List<PROCESSENTRY32> list = new LinkedList<>();
final HANDLE hProcessSnap = Kernel32.INSTANCE.CreateToolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS,
new DWORD(0));
PROCESSENTRY32 pe32 = new PROCESSENTRY32();
if (!Kernel32.INSTANCE.Process32First(hProcessSnap, pe32)) {
throw new Win32Exception(Native.getLastError());
}
do {
if (pe32.th32ProcessID.intValue() != 0) {
list.add(pe32);
}
pe32 = new PROCESSENTRY32();
} while (Kernel32.INSTANCE.Process32Next(hProcessSnap, pe32));
for (final PROCESSENTRY32 pe : list) {
plist.add(new Process(pe));
}
Kernel32.INSTANCE.CloseHandle(hProcessSnap);
final List<DesktopWindow> windows = WindowUtils.getAllWindows(false);
final IntByReference lpdwProcessId = new IntByReference();
int pid = 0;
for (final DesktopWindow window : windows) {
User32.INSTANCE.GetWindowThreadProcessId(window.getHWND(), lpdwProcessId);
pid = lpdwProcessId.getValue();
plist.add(pid, window.getHWND());
}
return plist;
}
开发者ID:ZabuzaW,项目名称:Mem-Eater-Bug,代码行数:44,代码来源:Kernel32Util.java
示例7: getGamePath
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
private static String getGamePath() {
return WindowUtils.getAllWindows(false).stream().filter(window -> {
char[] className = new char[512];
User32.INSTANCE.GetClassName(window.getHWND(), className, 512);
return Native.toString(className).equals("POEWindowClass");
}).map(it -> {
String filePath = it.getFilePath();
return StringUtils.substringBeforeLast(filePath, "\\");
}).findAny().orElse(null);
}
开发者ID:Exslims,项目名称:MercuryTrade,代码行数:11,代码来源:AppMain.java
示例8: testSoundReducer
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
@Test
public void testSoundReducer() throws IOException {
TestSubscriber<Map<String,String>> testSubscriber = new TestSubscriber<>();
List<DesktopWindow> allWindows = WindowUtils.getAllWindows(false);
allWindows.forEach(window -> {
System.out.println(window.getFilePath());
});
}
开发者ID:Exslims,项目名称:MercuryTrade,代码行数:9,代码来源:MercuryStoreCoreTest.java
示例9: calcAlphaModelSupported
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
private static boolean calcAlphaModelSupported() {
if (AWTUtilitiesWrapper.isTranslucencyAPISupported()) {
return AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT);
}
try {
return WindowUtils.isWindowAlphaSupported();
}
catch (Throwable e) {
return false;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:WindowManagerImpl.java
示例10: setWindowMask
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
@Override
public void setWindowMask(final Window window, @Nullable final Shape mask) {
try {
if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.PERPIXEL_TRANSPARENT)) {
AWTUtilitiesWrapper.setWindowShape(window, mask);
}
else {
WindowUtils.setWindowMask(window, mask);
}
}
catch (Throwable e) {
LOG.debug(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:WindowManagerImpl.java
示例11: setWindowMask
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
public void setWindowMask(final Window window, @Nullable final Shape mask) {
try {
if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.PERPIXEL_TRANSPARENT)) {
AWTUtilitiesWrapper.setWindowShape(window, mask);
}
else {
WindowUtils.setWindowMask(window, mask);
}
}
catch (Throwable e) {
LOG.debug(e);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:WindowManagerImpl.java
示例12: repaintUI
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
/**
* Repaints and revalidates the whole UI Tree.
*
* Calls {@link SwingUtilities#updateComponentTreeUI(Component c)}
* for every window owned by the application which cause UI skin and
* layout repaint.
*/
public void repaintUI()
{
if(!SwingUtilities.isEventDispatchThread())
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
repaintUI();
}
});
return;
}
if (UIManager.getLookAndFeel() instanceof SIPCommLookAndFeel)
((SIPCommLookAndFeel) UIManager.getLookAndFeel()).loadSkin();
Constants.reload();
ImageLoader.clearCache();
Window[] windows
= net.java.sip.communicator.plugin.desktoputil.WindowUtils
.getWindows();
for(Window win : windows)
{
reloadComponents(win);
ComponentUtils.updateComponentTreeUI(win);
}
}
开发者ID:jitsi,项目名称:jitsi,代码行数:38,代码来源:UIServiceImpl.java
示例13: update
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
@Override
public void update(float delta) {
compWin.update(delta, window);
if (run) {
compWin.dispose(window);
Container bottomBtns = new Container(0, 0, 200, 60);
char[] name = new char[1024];
User32Ext.INSTANCE.GetWindowTextW(hwndWin, name, name.length);
String title = Native.toString(name);
Button btnClose = new Button(0, 0, 200, 30, "Close");
btnClose.setPreicon(Theme.ICON_CHROME_CLOSE);
btnClose.setPreiconSize(12);
btnClose.setOnButtonPress(() -> {
User32.INSTANCE.PostMessage(this.hwndWin, WM_CLOSE, new WPARAM(), new LPARAM());
TaskManager.addTask(() -> window.setVisible(false));
});
Button btnOpen = new Button(0, 30, 200, 30, title);
btnOpen.setOnButtonPress(() -> {
char[] classNameC = new char[128];
User32.INSTANCE.GetClassName(hwndWin, classNameC, classNameC.length);
String className = Native.toString(classNameC);
if (!className.equals("ApplicationFrameWindow"))
try {
new ProcessBuilder(WindowUtils.getProcessFilePath(hwndWin), "").start();
} catch (IOException e) {
e.printStackTrace();
}
TaskManager.addTask(() -> window.setVisible(false));
});
bottomBtns.addComponent(btnClose);
bottomBtns.addComponent(btnOpen);
Image icon = new Image(13, 38, 16, 16, Util.getIcon(hwndWin, window), true);
bottomBtns.addComponent(icon);
compWin.addComponent(bottomBtns);
Container tasks = new Container(-20, 0, 220, 140);
tasks.setLayout(new FlowLayout(Direction.DOWN, 0, 10));
for (int i = 0; i < 4; i++) {
Button t = new Button(0, 0, 220, 30, "Task " + i);
t.setWindowAlignment(Alignment.LEFT_TOP);
t.setAlignment(Alignment.RIGHT_BOTTOM);
tasks.addComponent(t);
}
compWin.addComponent(tasks);
TaskManager.addTask(() -> window.setVisible(true));
run = false;
}
}
开发者ID:Guerra24,项目名称:NanoUI,代码行数:53,代码来源:ContextWindow.java
示例14: loadApplicationGui
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
/**
* Initializes all frames and panels and shows the GUI.
*/
void loadApplicationGui()
{
this.setDefaultThemePack();
// Initialize the single window container if we're in this case. This
// should be done before initializing the main window, because he'll
// search for it.
if (ConfigurationUtils.isSingleWindowInterfaceEnabled())
singleWindowContainer = new SingleWindowContainer();
// Initialize the main window.
this.mainFrame = new MainFrame();
if (UIManager.getLookAndFeel() instanceof SIPCommLookAndFeel)
initCustomFonts();
/*
* The mainFrame isn't fully ready without the MetaContactListService so
* make sure it's set before allowing anything, such as LoginManager, to
* use the mainFrame. Otherwise, LoginManager, for example, will call
* back from its event listener(s) into the mainFrame and cause a
* NullPointerException.
*/
mainFrame.setContactList(GuiActivator.getContactListService());
// Initialize main window bounds.
this.mainFrame.initBounds();
// Register the main window as an exported window, so that other bundles
// could access it through the UIService.
GuiActivator.getUIService().registerExportedWindow(mainFrame);
// Initialize the login manager.
this.loginManager = new LoginManager(new LoginRendererSwingImpl());
this.popupDialog = new PopupDialogImpl();
this.wizardContainer = new AccountRegWizardContainerImpl(mainFrame);
if (ConfigurationUtils.isTransparentWindowEnabled())
{
try
{
WindowUtils.setWindowTransparent(mainFrame, true);
}
catch (UnsupportedOperationException ex)
{
logger.error(ex.getMessage(), ex);
ConfigurationUtils.setTransparentWindowEnabled(false);
}
}
if(ConfigurationUtils.isApplicationVisible()
|| Boolean.getBoolean("disable-tray")
|| ConfigurationUtils.isMinimizeInsteadOfHide())
{
mainFrame.setFrameVisible(true);
}
SwingUtilities.invokeLater(new RunLoginGui());
this.initExportedWindows();
KeyboardFocusManager focusManager
= KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.addKeyEventDispatcher(
new KeyBindingsDispatching(focusManager));
}
开发者ID:jitsi,项目名称:jitsi,代码行数:72,代码来源:UIServiceImpl.java
示例15: propertyChange
import com.sun.jna.platform.WindowUtils; //导入依赖的package包/类
/**
* Indicates that a <tt>PropertyChangeEvent</tt> has occurred.
*
* @param evt the <tt>PropertyChangeEvent</tt> that notified us
*/
public void propertyChange(PropertyChangeEvent evt)
{
String propertyName = evt.getPropertyName();
if (propertyName.equals(
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED"))
{
String isTransparentString = (String) evt.getNewValue();
boolean isTransparentWindowEnabled
= Boolean.parseBoolean(isTransparentString);
try
{
WindowUtils.setWindowTransparent( mainFrame,
isTransparentWindowEnabled);
}
catch (UnsupportedOperationException ex)
{
logger.error(ex.getMessage(), ex);
if (isTransparentWindowEnabled)
{
ResourceManagementService resources
= GuiActivator.getResources();
new ErrorDialog(
mainFrame,
resources.getI18NString("service.gui.ERROR"),
resources.getI18NString(
"service.gui.TRANSPARENCY_NOT_ENABLED"))
.showDialog();
}
ConfigurationUtils.setTransparentWindowEnabled(false);
}
}
else if (propertyName.equals(
"impl.gui.WINDOW_TRANSPARENCY"))
{
mainFrame.repaint();
}
}
开发者ID:jitsi,项目名称:jitsi,代码行数:49,代码来源:UIServiceImpl.java
注:本文中的com.sun.jna.platform.WindowUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论