detect « Development « Java Swing Q&A





1. How can I detect from a Swing app that the PC is being shut-down?    stackoverflow.com

Well behaved windows programs need to allow users to save their work when they are shutting the PC down. How can I make my app detect the shutdown event? Any solution should ...

2. How can I detect if caps lock is toggled in Swing?    stackoverflow.com

I'm trying to build a better username/password field for my workplace and would like to be able to complain when they have their caps lock on. Is this possible? And if ...

3. Detect design time in NetBeans    stackoverflow.com

When using the Swing graphical editor in NetBeans is it possible for a custom component to detect that it's design time? E.g.

public CustomComponent() {
    initComponents();

    ...

4. Detect if Java Swing component has been hidden    stackoverflow.com

Assume we have the following Swing application:

    final JFrame frame = new JFrame();

    final JPanel outer = new JPanel();
    frame.add(outer);

   ...

5. How do i have a collision and reaction between two classes? -Java    stackoverflow.com

I have an array of type Dot which carries a Point and radius and a Player which is a rectangle with a Point and size. I would to create a method which ...

6. Detect and identify GUI components from Java    stackoverflow.com

I need to create a Java application that can detect any GUI component of an application on Windows or Linux. For example, you have a Firefox browser running and I ...

8. detect a {    coderanch.com

9. Universal way to detect field changes?    coderanch.com

textField.getDocument().addDocumentListener(new MyDocumentListener()); class MyDocumentListener implements DocumentListener { String newline = "\n"; public void insertUpdate(DocumentEvent e) { updateLog(e, "inserted into"); } public void removeUpdate(DocumentEvent e) { updateLog(e, "removed from"); } public void changedUpdate(DocumentEvent e) { //Plain text components don't fire these events } public void updateLog(DocumentEvent e, String action) { Document doc = (Document)e.getDocument(); int changeLength = e.getLength(); displayArea.append( changeLength + " ...





10. Detecting user activity in other programs    coderanch.com

Im doing now a program which measures user activity. That program is in background, but it should be able to tell if user is doing something on computer or not. Now Im able to detect only mouse movements (by getting each second mouse X and Y and comparing them to precedent values) but how can I see if user is using ...

11. detecting circular motion of pointer    coderanch.com

is there a preset way to do this? Suppose the user moves his finger in a circular motion on the laptop touchpad, and we want to know the average angular velocity of this motion. I have some mathematical ideas that involve an analysis of position and time, but I am thinking that some experimenting is necessary to know how many points ...

12. how to detect the change?    coderanch.com

String name = "Label1"; private static final String TEXT_KEY = "jlabel_text_key"; JLabel test = new JLabel(name); test.setText(name); test.putClientProperty(TEXT_KEY,name); test.setFocusable(true); test.addFocusListener(app); test.addMouseListener(app); public void focusGained(FocusEvent e) { JLabel label = (JLabel) e.getComponent(); String text = (String) label.getClientProperty(TEXT_KEY); label.setText("" + text + ""); } public void focusLost(FocusEvent e) { JLabel label = (JLabel) e.getComponent(); String text = (String) label.getClientProperty(TEXT_KEY); label.setText(text); } public void ...

13. Edge Detection    coderanch.com

thanks for the reply good sir. i've read the wiki article regarding edge detection and i think it's kinda tough to swallow for me in one reading. but i'll study it for the next few days or so. the imagej was helpful, and it would help me more if i could take a look at it's source code. i currently have ...

14. Detecting system user privileges on XP OS?    java-forums.org

Hi FON, Thanks a lot for your support. I'm planning to user following SID to detect admin rights. Please see the description, i.e every domain admin group also part of this group. Considering this group for validation. I have tested on multiple XP systems. It is as it expected. SID: S-1-5-32-544 Name: Administrators Description: A built-in group. After the initial installation ...

15. Detecting a lost X connection    java-forums.org

Hi, I am using linux computers and on one computer I am setting my DISPLAY to COMP1 and then starting a Java Gui program on COMP2. The problem is that when I disconnect the network cord or log out of COMP1 the Java program continues running fine on COMP2 without any indication that the display is no longer accessable. This is ...

16. Detecting a lost Gui Connection    java-forums.org

Hi, I am using linux computers and on one computer I am setting my DISPLAY to COMP1 and then starting a Java Gui program on COMP2. The problem is that when I disconnect the network cord or log out of COMP1 the Java program continues running fine on COMP2 without any indication that the display is no longer accessable. This is ...





17. Detecting if the player presses q or e    java-forums.org

To see what keys are being pressed, add a println to the keyPressed method to print out the event that is passed to the listener. You will see that most of the keys on the keyboard will pass an event to the listener. Press the keys that you are interested in tracking and see what is printed. For keeping track of ...

18. Detecting 'KeyTyped' outside Swing?    forums.oracle.com

Solution : To have the 'keys' auto-pressed, I can use the Robot class to help me. However, I can only implement the KeyListener to a JFrame/GUI. Meaning I can only achieve the example above within a Swing. I want to do it outside swing, so if i run any program (like a game), and while the program(game) is running, everytime the ...

19. Detect GUI Availability    forums.oracle.com

20. External Swing Detection    forums.oracle.com