jwindow

How do I make my JWindow window always stay focused

北慕城南 提交于 2019-12-17 16:54:32
问题 I am making a java application that includes a JWindow. I want to be able to track the mouse without the user having to click the window after going to another window. 回答1: Your question is little vague on why you want to continue processing the mouse once it's left the JWindow ...but You have two (basic) choices when it comes to mointoring the mouse outside of your application, you can use a JNI/JNA solution or you can poll MouseInfo. The following demonstrates the latter, using MouseInfo

transparent JDialog becomes opaque when dragging to second screen (ubuntu 14.04 with Cinnamon, java 1.8.0_74-b02)

可紊 提交于 2019-12-12 16:34:26
问题 I created transparent JDialog which unfortunately does not work with two screens. When its dragged to other screen it becomes opaque. The code is below, just run it and drag label to other screen. public class TransparentFrame{ public static void main(String[] args) { JDialog dialog = createDialog(); SwingUtilities.invokeLater(() -> dialog.setVisible(true)); } private static JDialog createDialog() { JDialog dialog = new JDialog(); JLabel label = new JLabel("drag me to the other screen");

Implementing auto complete in Java - am I doing it right? [duplicate]

≯℡__Kan透↙ 提交于 2019-12-12 08:25:53
问题 This question already has answers here : Create a autocompleting textbox in Java with a dropdown list (7 answers) Closed 6 years ago . Algorithm Start Input a city name - partial or complete If the user hits enter , take the text from JTextField Begin brute force search. If the matches are found, put them in a Vector and put it in a JList If no match is found, add a String "No Match Found" in Vector Display JWindow to user containing the results Stop Code: package test; import javax.swing.*;

Make JWindow retain focus when children are focused, including another window as child

荒凉一梦 提交于 2019-12-12 04:06:52
问题 I have created JWindow , which has several JTextInput fields. This JWindow parent is JFrame . Now the situation - if text fields are clicked - they get the focus BUT JWindow also stays focused. That is good. But if I create another JWindow (child of first JWindow ), and set it visible, then focus on first JWindow is lost, and the child JWindow is focused. This is bad. Is there some way to retain focus on the parent JWindow , and to make the child JWindow get the focus like JTextInput fields?

How to get the parent container of a JWindow in Swing?

守給你的承諾、 提交于 2019-12-11 14:37:52
问题 I have one JFrame and calling a JDialog from that frame while initializing. In the dialog have a JButton , when clicking on the button a new JWindow opens. Can I fix the position of window in the main frame? How to access the parent container ( JFrame extended) from JWindow extended class? 回答1: Use SwingUtilities.getWindowAncestor, if inside the JWindow class, refer it as this , if no, simply put object inside: JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this); JFrame topFrame

JWindow region opacity

余生颓废 提交于 2019-12-11 08:32:53
问题 I want to implement a screenshot functionality like in snipping tool. I can already select a rectangle and make a screenshot, but I this rectangle to be full opacity. I wonder if there is a function in Swing or AWT which I can use like this: window.setOpacityAt(Rectangle r, 0.5f); I hope you got my problem! 回答1: See How to Create Translucent and Shaped Windows: How to Implement Per-Pixel Translucency. 来源: https://stackoverflow.com/questions/16373327/jwindow-region-opacity

Is really not possible remove on Runtime any of JDialog or JWindow [closed]

为君一笑 提交于 2019-12-08 13:33:03
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . as I tried, looks like as that isn't possible, without success as I tried, or exist there another way? import java.awt.*; import java.awt.event.WindowEvent; import java.util.logging.Level; import java.util

Java Swing: JWindow appears behind all other process windows, and will not disappear

喜夏-厌秋 提交于 2019-12-07 21:59:24
问题 I am using JWindow to display my splash screen during the application start up. however it will not appear in front of all windows as it should, and it will not disappear as well. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Toolkit; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JWindow; public class MySplash { public static

Make a Java application invisible to a user

怎甘沉沦 提交于 2019-12-07 21:30:55
问题 I'm trying to figure out a way to make a Java application invisible to the user. Basically just trying to remove this <- Image How can this be done? public class TransparentWindow extends JFrame { public TransparentWindow() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { setExtendedState(Frame.MAXIMIZED_BOTH); setResizable(false); setUndecorated(true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setAlwaysOnTop(true); System.setProperty(

Make a Java application invisible to a user

我与影子孤独终老i 提交于 2019-12-06 07:31:33
I'm trying to figure out a way to make a Java application invisible to the user. Basically just trying to remove this <- Image How can this be done? public class TransparentWindow extends JFrame { public TransparentWindow() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { setExtendedState(Frame.MAXIMIZED_BOTH); setResizable(false); setUndecorated(true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setAlwaysOnTop(true); System.setProperty("sun.java2d.noddraw", "true"); WindowUtils.setWindowTransparent(this, true); WindowUtils.setWindowAlpha