Observable and ActionListener.. help

Is there anyway to pause update method and continue after I click the �Add Student� button?
The update method is called automatically when my observable object is changed, so I can�t display previous observable information via the button�s ActionListener.
Anyway to do that?
Thanks
import java.util.Observable;
import java.util.Observer;
import java.awt.event.*; //package for event handeler
import java.awt.*;
import javax.swing.*;
public class Lab5Frame extends JFrame implements Observer {     
     private JLabel label;
     private String name;     
     public TestFrame(Observable observable) {
          System.out.println("Windows created.");
          observable.addObserver(this);
     public Lab5Frame(String title) throws HeadlessException {
          super(title);          
          Container c = getContentPane();
          JPanel panel = new JPanel();
          label = new JLabel(name);
          panel.add(this.label);
          JButton button = new JButton("Add Studnet");
          button.addActionListener(new ListName());           
          c.add(button, BorderLayout.NORTH);
          c.add(panel, BorderLayout.CENTER);
          //*** window adapter
          addWindowListener(new WindowAdapter(){
               public void windowClosing(WindowEvent we){
                    System.exit(0);
     private class ListName implements ActionListener{
          public void actionPerformed(ActionEvent event){                    
               //what should I write here to performe the updated information
vai the update method?
     //oberver update     
     public void update(Observable arg0, Object arg1) {     
          System.out.println("LogConsole: " + arg1);
     }

Is there anyway to pause update method and continue after I click the �Add Student� button?
The update method is called automatically when my observable object is changed, so I can�t display previous observable information via the button�s ActionListener.
Anyway to do that?
Thanks
import java.util.Observable;
import java.util.Observer;
import java.awt.event.*; //package for event handeler
import java.awt.*;
import javax.swing.*;
public class Lab5Frame extends JFrame implements Observer {     
     private JLabel label;
     private String name;     
     public TestFrame(Observable observable) {
          System.out.println("Windows created.");
          observable.addObserver(this);
     public Lab5Frame(String title) throws HeadlessException {
          super(title);          
          Container c = getContentPane();
          JPanel panel = new JPanel();
          label = new JLabel(name);
          panel.add(this.label);
          JButton button = new JButton("Add Studnet");
          button.addActionListener(new ListName());           
          c.add(button, BorderLayout.NORTH);
          c.add(panel, BorderLayout.CENTER);
          //*** window adapter
          addWindowListener(new WindowAdapter(){
               public void windowClosing(WindowEvent we){
                    System.exit(0);
     private class ListName implements ActionListener{
          public void actionPerformed(ActionEvent event){                    
               //what should I write here to performe the updated information
vai the update method?
     //oberver update     
     public void update(Observable arg0, Object arg1) {     
          System.out.println("LogConsole: " + arg1);
     }

Similar Messages

  • Buttons and actionlistener help.

    the following code has 2 buttons, how would i use a button to get me differnt graphics but inside the same window,
    say i clicked next the graphics would be slightly altered which I will do but it wont open a new window it will be in the same window, but different shapes.
    I am having trouble with action listeners and really need help in how they work iv read up but dont understand, and how this would be implemented for this.
    much help would be appreciated.
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.RenderingHints;
    import java.awt.Stroke;
    import java.awt.geom.Ellipse2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class square extends JPanel
        public square()
            setPreferredSize(new Dimension(800, 700));
            int eb = 80;
            setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb));
            setLayout(new BorderLayout(5, 10));
           JPanel buttonPanel = createButtonPanel();
             add(buttonPanel, BorderLayout.SOUTH);
        private JPanel createButtonPanel()
            JPanel bp = new JPanel();
            bp.setOpaque(false);
                   JButton btn2 = new JButton("<-  Back Step ");
                    JButton btn = new JButton("Next Step   ->");
                    bp.add(btn2);
                    bp.add(btn);
            return bp;
        @Override
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            Rectangle2D rect = new Rectangle2D.Double(250, 150, 100, 100);
            Rectangle2D     rect2 = new Rectangle2D.Double(400, 150, 100, 100);
             Rectangle2D     rect3 = new Rectangle2D.Double(550, 150, 100, 100);
             Rectangle2D     rect4 = new Rectangle2D.Double(250, 300, 100, 100);
             Rectangle2D     rect5 = new Rectangle2D.Double(400, 300, 100, 100);
             Rectangle2D     rect6 = new Rectangle2D.Double(550, 300, 100, 100);
             Rectangle2D     rect7 = new Rectangle2D.Double(250, 450, 100, 100);
             Rectangle2D     rect8 = new Rectangle2D.Double(400, 450, 100, 100);
             Rectangle2D     rect9 = new Rectangle2D.Double(550, 450, 100, 100);
             g.drawString("b0,0", 300, 130);
            g.drawString("b1,0", 300, 110);
             g.drawString("b2,0", 300, 90);
                 g.drawString("b0,1", 450, 110);
            g.drawString("b1,1", 450, 90);
            g.drawString("b2,1", 450, 70);
                 g.drawString("b0,2", 600, 90);
            g.drawString("b1,2", 600, 70);
            g.drawString("b2,2", 600, 50);
             g.drawString("a0,0", 200, 200);
            g.drawString("a1,0", 150, 200);
             g.drawString("a2,0", 100, 200);
                 g.drawString("a0,1", 150, 350);
            g.drawString("a1,1", 100, 350);
            g.drawString("a2,1", 50, 350);
                   g.drawString("a0,2", 100, 500);
            g.drawString("a1,2", 50, 500);
            g.drawString("a2,2", 15, 500);
            g2.setPaint(Color.black);
            g2.draw(rect);
            g2.draw(rect);
              g2.draw(rect2);
             g2.draw(rect3);
              g2.draw(rect4);
             g2.draw(rect5);
              g2.draw(rect6);
             g2.draw(rect7);
              g2.draw(rect8);
              g2.draw(rect9);
            Stroke oldStroke = g2.getStroke();
            g2.setStroke(new BasicStroke(5));
            g2.setStroke(oldStroke);
        private static void createAndShowUI()
            JFrame frame = new JFrame("Matrix Multiplication - Step by Step ");
            frame.getContentPane().add(new square());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }

    ok I had a look over it, I got this
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.RenderingHints;
    import java.awt.Stroke;
    import java.awt.geom.Ellipse2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class square extends JPanel implements ActionListener
        public square()
            setPreferredSize(new Dimension(800, 700));
            int eb = 80;
            setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb));
            setLayout(new BorderLayout(5, 10));
           JPanel buttonPanel = createButtonPanel();
             add(buttonPanel, BorderLayout.SOUTH);
      public void actionPerformed(ActionEvent e) {
            System.out.println("hello");
        private JPanel createButtonPanel()
            JPanel bp = new JPanel();
            bp.setOpaque(false);
                   JButton btn2 = new JButton("<-  Back Step ");
                    JButton btn = new JButton("Next Step   ->");
                    bp.add(btn2);
                    bp.add(btn);
             btn.addActionListener(this);
            return bp;
        @Override
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            Rectangle2D rect = new Rectangle2D.Double(250, 150, 100, 100);
            Rectangle2D     rect2 = new Rectangle2D.Double(400, 150, 100, 100);
             Rectangle2D     rect3 = new Rectangle2D.Double(550, 150, 100, 100);
             Rectangle2D     rect4 = new Rectangle2D.Double(250, 300, 100, 100);
             Rectangle2D     rect5 = new Rectangle2D.Double(400, 300, 100, 100);
             Rectangle2D     rect6 = new Rectangle2D.Double(550, 300, 100, 100);
             Rectangle2D     rect7 = new Rectangle2D.Double(250, 450, 100, 100);
             Rectangle2D     rect8 = new Rectangle2D.Double(400, 450, 100, 100);
             Rectangle2D     rect9 = new Rectangle2D.Double(550, 450, 100, 100);
             g.drawString("b0,0", 300, 130);
            g.drawString("b1,0", 300, 110);
             g.drawString("b2,0", 300, 90);
                 g.drawString("b0,1", 450, 110);
            g.drawString("b1,1", 450, 90);
            g.drawString("b2,1", 450, 70);
                 g.drawString("b0,2", 600, 90);
            g.drawString("b1,2", 600, 70);
            g.drawString("b2,2", 600, 50);
             g.drawString("a0,0", 200, 200);
            g.drawString("a1,0", 150, 200);
             g.drawString("a2,0", 100, 200);
                 g.drawString("a0,1", 150, 350);
            g.drawString("a1,1", 100, 350);
            g.drawString("a2,1", 50, 350);
                   g.drawString("a0,2", 100, 500);
            g.drawString("a1,2", 50, 500);
            g.drawString("a2,2", 15, 500);
            g2.setPaint(Color.black);
            g2.draw(rect);
            g2.draw(rect);
              g2.draw(rect2);
             g2.draw(rect3);
              g2.draw(rect4);
             g2.draw(rect5);
              g2.draw(rect6);
             g2.draw(rect7);
              g2.draw(rect8);
              g2.draw(rect9);
            Stroke oldStroke = g2.getStroke();
            g2.setStroke(new BasicStroke(5));
            g2.setStroke(oldStroke);
        private static void createAndShowUI()
            JFrame frame = new JFrame("Matrix Multiplication - Step by Step ");
            frame.getContentPane().add(new square());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }it produces hello once I click the button, but how would I produce the same frame once the button is clicked, not a new frame, the same one iv got with slight adjustments inside it..which i will do.

  • Help please on Observer / Observable and Serial Communications!

    Help!
    I have a project where I need a java application to talk to some test equipment via the serial port. I have studied the java comm api and played around with the SerialDemo example which I used to model my code.
    I have a SeialConnection class which is very similar to the example except I made it to extend Observable and I have it notify observers when data is detected on the serial port.
    I created a second class which extends Obserable which communicates with the SerialConnection and implemented the observer interface. This class process the incomming and outgoing data and provides some higher level methods, like getSerialNumber(), for my application to use. The application frame is an Observer of this class so the GUI can show the status as well.
    An example method from this class:
    private String Get590AROMString() {
    SendString("EZR-V"); //Send a command to the s.p.
    serialConnection.pause(750); //Basically a sleep(750)
    return ROMVersion; //Return the data from update()
    Excerpt from update method:
    // If return from serialConnection starts with VER: parse the RV and SN.
    if(T.startsWith("VER:")) {
    ROMVersion = new String(T.substring(0,T.indexOf('~')));
    SpeciesName = new String(T.substring(T.indexOf('~')+2));
    return;
    This works great when the test equipment sends a message or when the user selects a command from the program interface. My problem is when I try to send a command to the serial port from within the update method of the observer. There are instances where a result from the serial port needs to initiate another request for information.
    Here is a fragment from the update method of the application frame:
    public void update(Observable obs, Object obj) {
    DensTalkStatus DTS;
    if( obs==DT ) {
    DTS = (DensTalkStatus)obj;
    else if(DTS.GetStatus()==DensTalkStatus.NOTIFY_ZEROOK) {
    if(FIRSTCONNECT590A) {
    GDD.GetDensimeterInfo(); // *** This is the Request
    GDD.SetDensID(EDM);
    FIRSTCONNECT590A = false;
    When I make a request for additional information from the serial port within the update method I get nothing returned and the requested data arrives later after the update method has completed.
    I do not know the fine details of how the javax.comm or observer/obserable works but it appears to me that my strategy can only process one command at a time.
    Can anyone think of a way to allow the application's frame update method to request information and wait for the data to be ready?
    Does anybody have an example of how to do this type of communications?
    I am sorry for the length of this question... Thank you for your time.
    Doug

    I have not received any suggestions yet on an alternate method for this problem, but I have come up with a solution I think will work. I am posting it here so others who have the same problem can at least see what path I followed...
    The basic problem seems to be that I am trying to have my observer ask for information that requires the same observer / observable thread to respond.. duh! :) To requst additional information from the serial port I need to move the requests out of the update() method to a different thread.
    I implemented the SerialWorker class to make the request so the observer update() method could return normally without waiting for the result of the new request.
    Doug

  • Observable and Observer

    I am trying to use Java Observable and Observer to notify the change in one object to other.
    So i have to extend Observable class on the object which i want to montior on and
    my observer class implements the observer to listen toupdate.
    I have achieved the basic Observable and observer running.
    Where I am having problem is, I couldn't figure out how to monitor, lets say 100 instance of the same object, with one object? I am not even
    sure whether it is possible or not, if yes, can somebody tell me how
    this can be achieved.
    what i want to do in code
    //The Observable class
    public class Foo extends Observable {
        public void setFoo(String abc){
             //blah blah
             setChanged();
              notifyObservers();
    //Observer class
    public class observeFoo implements Observer{
        public void update(Observable o, Object oo){
            //blah blah
    }Lets say i have 100 threads running each holding one instance of Foo
    class. Is it possible to observe all those Foo instance running on each
    thread by one observeFoo class? If yes how?
    any help will be appreciated.
    thanx in advance.

    Just add the single Observer as an observer to all the observable objects. NotifyObservers() will do the rest.

  • Quick advice needed on Observer and Observable...

    Ok at the moment i have about 10 sorting algorithms in 10 classes. They all extend another class which includes methods like print, randomise, user input etc etc which all sorting classes use. So basically my sorting classes only sort and nothing more is done in those classes.
    Now what i want to do is have some statistics on a GUI. This will include copy coperations, compare operations and total operations. I will obviously need to input where these operations occur for each sorting class. I want the GUI to be updated each time an operation happens. All my sorts run in a thread, i did this so i can choose the speed of the sort with a JSlider.
    My question is, will i need to be using the Observer and Observable interface? If so, can i have some advice into how i would structure this. If not, then how else can i do a statistics class. I tried a way without this approach, but it didn't seem too OO friendly. Any help is appreciated.
    Thanks in advance.

    I'm not a GUI guy and this is definitely not the best way to do it - but you could probably call an update method after each calculation or whatever. Make a static method that has a reference to your GUI form.
    This is definitely not an elegant solution - but I think it's explicit and readable, and that can be more valuable than elegance.

  • UICommand action and actionListener - invoke in different phases

    Hi,
    I am trying to get the action and actionListener methods of a command button invoked in different phases. When the button is pressed I would like the actionListener to be invoked immediately, but the action method only in the "invoke applications phase", unless the form validation failed.
    Setting immediate to "true" doesn't work, as I can't get the action method to be queued for later processing. I also can't make them both actionListeners as the action method controls navigation.
    Any way round this?
    Thanks!

    Action = Executed in the invoke application phase. Runs a method in a bean that returns a String object. The String is used by the navigation system to determine which page to render next. The rules for this are set up in the faces-config.xml file, in the navigation-rule sections.
    ActionListener = Executed in the invoke application phase. Is triggered when the action event occurs for the component the listener is attached too. This listener can perform miscellaneous actions required when the button is clicked, but does not return a String that affects the navigation.
    What order do they get called? Try this out!
    http://www.jsftutorials.net/faces-config/phaseTracker.html
    It'll help you understand the JSF lifecycle. Which is VERY important, especially when those weird errors start occurring (or JSF seems to be ignoring your commands).
    CowKing

  • Help Please Needed for Java Calculator - ActionListener HELP

    Hi. I am constructing a simple Java calculator and need help with the actionlistener and how it could work with my program. I am not too sure how to begin constructing the actionlistener. I would like to know the best and most simple solution to get this program work the way it should, like a real calculator. If anyone can help me, that would be much appreciated.
    package calculator;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class CalculatorGUI extends JFrame implements ActionListener{
    JTextField screen;
    JButton button7;
    JButton button8;
    JButton button9;
    JButton button4;
    JButton button5;
    JButton button6;
    JButton button1;
    JButton button2;
    JButton button3;
    JButton button0;
    JButton add;
    JButton minus;
    JButton multiply;
    JButton divide;
    JButton equals;
    JButton clear;
    private JTextField m_displayField;
    private boolean m_startNumber = true;
    private String m_previousOp = "=";
    private CalculatorLogic m_logic = new CalculatorLogic();
    public CalculatorGUI() {
    CalculatorGUILayout customLayout = new CalculatorGUILayout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    screen = new JTextField("textfield_1");
    getContentPane().add(screen);
    button7 = new JButton("7");
    getContentPane().add(button7);
    button7.addActionListener(this);
    button8 = new JButton("8");
    getContentPane().add(button8);
    button8.addActionListener(this);
    button9 = new JButton("9");
    getContentPane().add(button9);
    button9.addActionListener(this);
    button4 = new JButton("4");
    getContentPane().add(button4);
    button4.addActionListener(this);
    button5 = new JButton("5");
    getContentPane().add(button5);
    button5.addActionListener(this);
    button6 = new JButton("6");
    getContentPane().add(button6);
    button6.addActionListener(this);
    button1 = new JButton("1");
    getContentPane().add(button1);
    button1.addActionListener(this);
    button2 = new JButton("2");
    getContentPane().add(button2);
    button2.addActionListener(this);
    button3 = new JButton("3");
    getContentPane().add(button3);
    button3.addActionListener(this);
    button0 = new JButton("0");
    getContentPane().add(button0);
    button0.addActionListener(this);
    add = new JButton("+");
    getContentPane().add(add);
    add.addActionListener(this);
    minus = new JButton("-");
    getContentPane().add(minus);
    minus.addActionListener(this);
    multiply = new JButton("*");
    getContentPane().add(multiply);
    multiply.addActionListener(this);
    divide = new JButton("/");
    getContentPane().add(divide);
    divide.addActionListener(this);
    equals = new JButton("=");
    getContentPane().add(equals);
    equals.addActionListener(this);
    clear = new JButton("Clear");
    getContentPane().add(clear);
    clear.addActionListener(this);
    setSize(getPreferredSize());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void actionPerformed(ActionEvent event) {
    public static void main(String args[]) {
    CalculatorGUI window = new CalculatorGUI();
    window.setTitle("Calculator");
    window.pack();
    window.show();
    class CalculatorGUILayout implements LayoutManager {
    public CalculatorGUILayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 421 + insets.left + insets.right;
    dim.height = 494 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+8,408,64);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+80,96,56);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+120,insets.top+80,96,56);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+232,insets.top+80,96,56);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+144,96,56);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+120,insets.top+144,96,56);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+232,insets.top+144,96,56);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+208,96,56);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+120,insets.top+208,96,56);}
    c = parent.getComponent(9);
    if (c.isVisible()) {c.setBounds(insets.left+232,insets.top+208,96,56);}
    c = parent.getComponent(10);
    if (c.isVisible()) {c.setBounds(insets.left+120,insets.top+272,96,56);}
    c = parent.getComponent(11);
    if (c.isVisible()) {c.setBounds(insets.left+344,insets.top+80,72,56);}
    c = parent.getComponent(12);
    if (c.isVisible()) {c.setBounds(insets.left+344,insets.top+144,72,56);}
    c = parent.getComponent(13);
    if (c.isVisible()) {c.setBounds(insets.left+344,insets.top+208,72,56);}
    c = parent.getComponent(14);
    if (c.isVisible()) {c.setBounds(insets.left+344,insets.top+272,72,56);}
    c = parent.getComponent(15);
    if (c.isVisible()) {c.setBounds(insets.left+344,insets.top+336,72,56);}
    c = parent.getComponent(16);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+408,408,72);}
    }

    Yeah, I have a rough idea of what the calculator
    should do, like most people would. Its just that I
    dont know how to implement this in Java. Thats the
    problem. Can anyone provide me with code snippets
    that I can try?No I would rather see you make an effort from what has been discussed here. This is not a Java problem this is a general programming problem.

  • ItemListemer and ActionListener...and others...how can they live together?

    Hi,
    I want to have a couple of DropDown Menus, some Buttons and some Checkboxes in the same class....How can I do that knowing that my class needs to implement ItemListener and ActionListener ?
    I've tried something like:
    "public class extends Applet implements ItemListener implements ActionListener"
    but not surprisingly it doesn't work....
    and what if on top of that I want a MouseListener, a WindowListener or God knows what else...?
    Thanks in advance for your help...
    Tom

    You need to read the basics about Swing events.
    For starters, you do not implement listeners in your Applet class. Instead, you add new listeners to specific components that you want to listen on. For example, if you need to perform certain actions when a JComboBox's selection changes, you would do something like:
    my_combo.addActionListener(  new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("selection changed to: " + my_combo.getSelectedItem());
    });And for buttons:
    my_button.addActionListener( new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("You clicked " + ((JButton) e.getSource()).getText() " button);
    }MoustListener and other listeners can be similarily added. See JDK Documentation or Tutorials

  • Pattern Observer and Observable

    Hi,
    I have a class that contains two methods. Can I observer each method from tha same class?
    I show you an example:
    public class Menu extends Observable implements ActionListener {
    public void method1(){
    setChanged();
    notifyObservers(foo);
    public void method2(){
    setChanged();
    notifyObservers(foo2);
    Now I want to observe this methods from another one class.
    public class pannelloDX implements Observer{
    public void update(Observable obs, Object obj) {
    //How can I distinguish the two observed methods?
    thanks
    }

    If you're using the "push" model of the observer pattern, Buddy, you can use the second parameter (is
    it cleverly called "arg" in the API?) to indicate how the observable has changed. By the way, Observable
    and Observer in java.util aren't exactly God's gift to the observer pattern. Check out PropertyChangeListener
    and PropertyChangeSupport, etc... in java.beans.

  • Help, new to Linux and need help installing 8i

    I am new to Linux and some of this stuff..
    Yet,I have gotten the JDK116_v5 installed and working on my box.
    I have cut a cd for Oracle8i and need help..
    I have also recopiled my kernal as well...
    Does any one know where I can get help...
    null

    Al Pivonka (guest) wrote:
    : I am new to Linux and some of this stuff..
    : Yet,I have gotten the JDK116_v5 installed and working on
    : my box.
    : I have cut a cd for Oracle8i and need help..
    : I have also recopiled my kernal as well...
    : Does any one know where I can get help...
    Try http://www.akadia.com/html/dod-frame.html for Redhat.
    http://www.suse.de/~mha/oracle/ for SuSE
    Also peruse these
    http://www.akadia.com/html/dod-frame.html
    http://jordan.fortwayne.com/oracle/
    Colin.
    null

  • Software update and iLife help not working in Admin account

    For the last few weeks (maybe since iLife 11 was installed) software update and iLife help has quit working on the single administration account on my iMac. All works fine on the secondary accounts.
    If I try to use software update it says everything is up to date, even though I know there are updates available that can be seen if checking from a different account on the machine. In iLife, if I try to access the help files it tells me I need to download them. I click to download and after a few seconds it takes me back to the front help page and I then go through the entire process again but the help download never happens. On secondary accounts the help files work no problem.
    I've tried many of the tips for deleting helpfile plists, but nothing seems to work for me.
    Can any kind person list for me everything I should look to delete or move in the account to get these things working again?
    It would be much appreciated!

    Since the issue is specific to your original user account, you can proceed in two ways. One is to log into your new account, make a list of the preference files (plists) located in /username/Library/Preferences/, including any in the ByHost subfolder, log back into the original account, move everything on that other account's list from the original account's Preferences folder into a newly created folder on the Desktop, log out and back in, and see if the problem goes away. If so, you can copy the ones in the Desktop folder (one at time) back into /Preferences/, restart, and see if the problem returns. If so, you've identified the corrupt/conflicting one. Continue with all of them until isolating the bad ones. That'll save you the trouble of resetting preferences.
    The second way is much more detailed and I'll not burden you with the steps unless the above doesn't fix the issue.

  • A follow up question to Introducing Apple Recommends, Manage Subscriptions, and This Helped Me

    In Introducing Apple Recommends, Manage Subscriptions, and This Helped Me it was written
    Now anyone can click "This helped me" to say thanks to helpful members. When several people mark the same post, it will earn a gold star and appear at the top of the discussion, so it’s easier for others to find. The poster will also earn five reputation points for a job well done.
    Does anyone know (or is it written anywhere) just how many is 'serveral'? Is it decided on the fly? Or does it depend on the phase of the moon?
    Will the points be awarded to the poster only once, or if say 100 people mark it as helpful will more then 5 points be awarded?
    Sounds like a really good system but it seems that a bit more thought should have gone into it, no? Or at least the explanation could be clearer.
    Ciao.
    (Another question) Can the original post (this one) get marked as helpful also? Imagine  earning points for posting :-)

    Howdy GeoCo et al
    I sort of agree with this new "Helpie-ette" deal. I wonder why while at this portion of the UX they didn't address the ongoing issue of the "irrevocable nature " of the OP awards of the traditional Green Stamp and Gold Star - I have made the mistake (once) but I see the silliest things marked Solved frequently. THAT is bad for business in that it gives false visual info and false statistical results.
    We'll see... BTW, the [People] TAB itself is the only new thing (the CONTROL in the TAB bar) - the URL has always been alive and well if one knew to add " /people "

  • Google maps and google help not loading anymore! help!

    Google maps and google help aren't loading since I've updated firefox. Works in Chrome no problem. Tried everything listed here: https://support.mozilla.com/en-US/kb/Error%20loading%20web%20sites, re-installed flash, cleared cache, etc... what am I missing?

    Anyone have any ideas?

  • How can I get no answers and no help!

    Hi All,
    I am so angry frustrated and fed up with BT its not real and after a month of useless customer service people in every country in the world I have decided to get ofcom involved as BT just dont care at all.
    I have been a customer for BT for about 7 years and always paid my bills ontime and have many time in the past recommended BT (Not anymore) alot not only to friend but also to businesses.
    After a messy split with my partner i had to move from my property so on the 6th of January i called BT's moving team and got the process moving to move all my services (phone, broadband & bt vision) the guy was really helpful and said that the old phone and services would be disconnected on the 17th Jan and broadband the same day, he then went on to say that an engineer would have to come to my property on the 21st to check that the bt vision would work correctly as there was low bandwith where i lived but thought it would be ok.
    So i thought great all done but on the 17th nothing happened at the new property i call CS and the lady did try to help and after talking to the old line user said a mistake had happed with a cancellation and they would sort it all out by the 19th so dont worry. 19th comes nothing so another call to CS they could not work it out so put me through to a guy in the UK who could not have been more unhelpful if he tried. He said that the engineer had reported a problem but i would have to wait. At this point i thought i would complain as i had not had any comms from BT at all i had to do all the calling even though they say on the website if the date are moved they will contact you.
    i tried the only complaint messaging service this time. The guy tried to be helpful but then informed me that my order was cancelled? Why i asked he said he did not know but would have to call me back. Well he did call back the next day and still had no idea what had happened and i have now not heard a thing from him since last thursday.
    On Monday i logged into my account and now it shows i wont get any connections until the 7th of feb so i called and said its a joke and whats going on. The guy said what do you expect you only placed the order yesterday? I asked what? and then looked at the only account and true enough the order date had changed to the 23rd and they could not see the previous order even though the order number had not changed. Its a disgrace as i think you will find the moving team dont work sundays so i know someone has changed that so it did not look so bad. The person said he would escalate the connection (I bet he did not as naff all has happened). He said he would get his manager who i have to say i dont think was i just think he passed me to his mate to try and get me off the line. He said they would get it sorted and come back to me with 24hrs and guess what Nothing.
    So if you are a good customer and pay ontime this is what BT really thinks of you and will help you if things go wrong. I have got a complaint reference now and will be keeping a diary of events in order to contact Ofcom when it is all sorted and to post on onther forum the outcome and how i was dealt with.
    Kinga

    Well the useless system has done yet another update and useful as usual it now says my connection date for BT Vision is 26th Jan (2 days ago) but the phone and broadband will be 7th of Feb so that will be a full month since i placed the order and still nothing from anyone at BT.
    Nothing about the original engineer visit or anything so this is going to roll on and on and the so called escalation, well they may as well said what can we say to you to get you off the line as i bet there is no such thing as escalition at all as so far all its done is push these so called dates further and further away.
    Oh and here is a another nugget of so called customer service for you is you ask about compensation for all the calls, hassle and stress they say you cant have a thing as it says it in the terms & conditions. Oh well in that case why call you team customer services if you cant really stand the customers and cant admit when you make a massive mistake causing untold hardship to the customer that you would like to make up for it in someway.
    Kinga

  • IOS 8 - Disentangling Camera Roll and Photostream - help!

    In iOS 8, Apple removed the “Camera Roll” and “Photostream” albums and collapsed them into a single stream of photos on the camera that can be accessed under “Collections”.  “Collections” also includes all other photos otherwise loaded onto the phone, e.g., via iPhoto. This new arrangement upsets several familiar ways in which I’ve been using my iPhone and its camera, and I am wondering if anyone has any suggestions for how to recapture a few simple functions.  (I have submitted Feedback on the elimination of the Camera Roll, and with this post I am looking for practical solutions to a series of new problems.)
    Question #1.  I maintained my Camera Roll as a reasonably-well curated set of maybe 300 photos & videos, taken on my phone, that I could pull up easily to show to people.  I would like to know if there is a way to restore that functionality in iOS 8.  “Recently added” does not go back far enough (one of my favorites was the very first photo I took with any iPhone, back in 2007); and “Collections” shows way too much – it includes everything in Photostream, as well as photos from Albums of scans, non-iPhone photos and other sources that I’ve synced to the phone with iPhoto.  Thousands of photos.  I also don’t care for the way in which Collections interrupts the thumbnails with date and location information.
    Question #2.  I kept Photostream turned on on my phone, because I liked the idea of automatically uploading photos to the cloud, particularly on trips when I was not in a position to download the photos directly to a computer for backup and safekeeping.  However, now that Apple has eliminated the distinction between “photos in my pocket” and “photos in the cloud”, it appears that whenever I want to delete a photo from my phone (e.g. to save space) I must also delete the corresponding Photostream copy.  Is there a way, with Photostream on, to delete local photos without also deleting the copy that has been uploaded to the cloud?
    Question #3.  I have a few old iOS devices that I let my kids use.  They like to take photos and screenshots.  Most of them are pretty stupid but once in a while they do something great. I’ve left Photostream on on those devices to see what they’re up to, and to capture the occasional gem.  This was fine, when “Photostream” was a separate Album that I could look at, or not, as I chose.  In iOS 8 however, all of their junk photos appear in “Collections” and are as much a part of my phone’s photo repository as the carefully-curated Camera Roll photos used to be.  Is there a way to keep Photostream photos out of my “Collection”?
    Question #4.  I suppose someone could write an app that does nothing but display photos that were captured by, and reside physically, on the device.  Perhaps someone already has, if anyone knows.  Of course I’d prefer to use the native app for this function, but I’d take the function over nativity if I had to choose.
    Question #5. Does anyone know (“know” – please no speculation, and nothing that an NDA forbids) how the iCloud Photo Library, which dropped back to beta in the final release of iOS 8, works? Does it provide the backup and safekeeping function of Photostream, along with the ability to view that set of photos separately?  If so then I could turn off Photostream and at least get rid of that clutter.
    Thanks for any and all help.  And by way of reminder - https://www.apple.com/feedback/iphone.html .

    Here's one, eh, kludgy fix for Question #1.  I don't exactly recommend it - it can be pretty laborious - but in the end it seems to get me back to about where I started with my Camera Roll.
    Go into "Collections" and scroll back to about the date at which you expect to find your first native iPhone photo.  (I have many imported photos that predate iPhone, so I can't just look at the first ones.)  Tap through until you are looking at a single photo.  Look at the bottom.  If it displays a "Favorites" heart, it's physically on your iPhone (and as best I can tell, was taken by the device).  Tag it as a favorite.  Swipe to the next photo.  Skip if it shows no Favorites heart - that means it's not on your phone - and tag it if it does.
    At the end of this process (did I mention it's laborious?), you should have a Favorites album that matches the photos that were on your Camera Roll when you upgraded to iOS 8.

Maybe you are looking for

  • Syncing iPhone and Outlook Calendar - bug?

    I have an issue syncing my iPhone 3G Calendar with Outlook's Calendar (Outlook 2007). In general, the sync works fine, but: If I delete the current (ie first) instance of a repeating event in Outlook, when I sync, my iPhone will still display ALL ins

  • Updating the key field in a table

    I am trying to assign new values to the primary key column in a table. As it is necessary to hold a permanent record of the relationship between the new and old values, I am extracting the old values into another table and assigning the new values fr

  • Getting list of all users and their group memberships from Active Directory

    Hi, I want to retrieve a list of all the users and their group memberships through JNDI from Active Directory. I am using the following code to achieve this: ================== import javax.naming.*; import java.util.Hashtable; import javax.naming.di

  • Adobe Reader X Not Converting To / From PDF ?

    I have a licensed copy of Adobe Reader X Version 10.1.08 which was purchased a couple of years ago & registered. I cannot now convert to / from PDF without being redirected to an obligatory online subscription. Why is this so ?

  • Pricing procedure for billin

    Hi,        How system copies pricing procedure from sales document to billing document