Results 1 to 2 of 2
  1. #1
    arcelivez is offline Member
    Join Date
    Apr 2011
    Posts
    12
    Rep Power
    0

    Default Signals and slots in Java?

    Hello,

    Well I'm currently developing a database application with Java and here's what I need to do:
    let's say there's a tableView on form1 class and when I select an item in it, I want the class to somehow send a signal to a different class to execute a specific method. I kind of have found a way to write a listener for the table, but it can only execute a method inside a class, I need it to send some kind of a signal outside...

    I used to work with Qt C++ a little and it had such thing like signals and slots, where a class get's a signal connected to a slot(which is a normal method that has the ability to be called by a signal) and this way different classes could communicate if I remember right.

    So how do I do this in Java?

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    So you mean you just need to call a method in one class from another?

    Java Code:
    public class myClass {
       //fields
       //constructor
       //methods
       public void doSomething() {
           //do something
       }
    }
    
    public class myOtherClass {
        //fields
        //constructor
        //methods
        public void doTheSameThing() {
            myClass.doSomething();
        }
    }

Similar Threads

  1. Working with network signals
    By islamfunny in forum Sun Java Wireless Toolkit
    Replies: 0
    Last Post: 09-27-2008, 01:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •