Actionlisteners in underlaying classes

Hi all
I have a problem with the actionlistenermodel.
My main class is setting up the entire swingcoordination, except the one panel with buttons on.
I made a new classe that extends Jpanel implementing actionlistener, and then i add this class to my main frame.
The problem is how to interact with each other. With the Jpanel containing the buttons i want to call a method inside the main class... How can i do that?
I've tried with parent and i've tried to do it with an actionlistener in the main class..
I hope i express myself clear..
Here is an example... I have commented out the things i was trying, otherwise it wouldn't compile
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class InterFace extends JFrame implements ActionListener {
     JPanel JPMASTER = new JPanel();
     JLabel JLhey = new JLabel("Hey");
     IndstillingerPanel JPindstilling = new IndstillingerPanel();
     public InterFace() {
          super("Hey you...");
          setSize(500, 500);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          GridBagConstraints c = new GridBagConstraints();
          c.fill = GridBagConstraints.HORIZONTAL;
          c.ipadx = 0;
          c.ipady = 0;
          c.anchor = GridBagConstraints.CENTER;
          c.insets = new Insets(5, 5, 5, 5);
          GridCont(c, 0, 0, 1, 1, 1, 1);
          JPMASTER.add(JPindstilling, c);
          // here i can't add JPindstilling.addActionListener(this);
          c.anchor = GridBagConstraints.NORTH;
          GridCont(c, 1, 0, 1, 1, 1, 1);
          JPMASTER.add(JLhey, c);
          setContentPane(JPMASTER);
          setLocationRelativeTo(null);
     public void actionPerformed(ActionEvent evt) {
          Object source = evt.getSource();
          // how do I set up the actionevent
          /*if (source == JPindstilling.JBafslut) { // this doesn't work
               System.exit(0);
          repaint();
     public void setLabel(String text) {
          JLhey.setText(text);
     public static void main(String[] argumenter) {
          JFrame frame = new InterFace();
          frame.setVisible(true);
     private void GridCont(GridBagConstraints GBC, int gx, int gy, int gw, int gh, double wx, double wy) {
          GBC.gridx = gx;
          GBC.gridy = gy;
          GBC.gridwidth = gw;
          GBC.gridheight = gh;
          GBC.weightx = wx;
          GBC.weighty = wy;
}And the other class
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class IndstillingerPanel extends JPanel implements ActionListener {
     JToggleButton JBTskift = new JToggleButton("Shift");
     JButton JBafslut = new JButton("Afslut");
     public IndstillingerPanel() {
          setLayout(new GridBagLayout());
          JBafslut.addActionListener(this);
          GridBagConstraints c = new GridBagConstraints();
          c.fill = GridBagConstraints.HORIZONTAL;
          c.ipadx = 0;
          c.ipady = 0;
          c.anchor = GridBagConstraints.CENTER;
          c.insets = new Insets(5, 5, 5, 5);
          GridCont(c, 0, 0, 2, 1, 1, 1);
          add(JBTskift, c);
          GridCont(c, 0, 1, 2, 1, 1, 1);
          add(JBafslut, c);
     public void actionPerformed(ActionEvent evt) {
          Object source = evt.getSource();
          if (source == JBafslut) {
               System.exit(0);
          else if (source == JBTskift ) {
               //InterFace.setLabel("hey to"); //interface is the name of the main class
          repaint();
     private void GridCont(GridBagConstraints GBC, int gx, int gy, int gw, int gh, double wx, double wy) {
          GBC.gridx = gx;
          GBC.gridy = gy;
          GBC.gridwidth = gw;
          GBC.gridheight = gh;
          GBC.weightx = wx;
          GBC.weighty = wy;
}That should do it a bit clearer... And also.. How do i determine if the Togglebutton is true or false? I havn't been able to find any useful sites regarding this problem.
Many thanks

Many thanks for the supplied code...
I implemented it as exactly your code: This is the final code:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class InterFace extends JFrame implements ActionListener {
     JPanel JPMASTER = new JPanel();
     JLabel JLhey = new JLabel("Hey");
     IndstillingerPanel JPindstilling = new IndstillingerPanel();
     public InterFace() {
          super("Semesterplanl�gning...");
          setSize(500, 500);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          GridBagConstraints c = new GridBagConstraints();
          c.fill = GridBagConstraints.HORIZONTAL;
          c.ipadx = 0;
          c.ipady = 0;
          c.anchor = GridBagConstraints.CENTER;
          c.insets = new Insets(5, 5, 5, 5);
          GridCont(c, 0, 0, 1, 1, 1, 1);
          JPMASTER.add(JPindstilling, c);
          c.anchor = GridBagConstraints.NORTH;
          GridCont(c, 1, 0, 1, 1, 1, 1);
          JPMASTER.add(JLhey, c);
          setContentPane(JPMASTER);
          setLocationRelativeTo(null);
          JPindstilling.setcancelAddListener( new ActionListener() {
                    public void actionPerformed(ActionEvent arg) {
                         System.exit(0);
     public void actionPerformed(ActionEvent evt) {
          Object source = evt.getSource();
          repaint();
     public void setLabel(String text) {
          JLhey.setText(text);
     public static void main(String[] argumenter) {
          JFrame frame = new InterFace();
          frame.setVisible(true);
     private void GridCont(GridBagConstraints GBC, int gx, int gy, int gw, int gh, double wx, double wy) {
          GBC.gridx = gx;
          GBC.gridy = gy;
          GBC.gridwidth = gw;
          GBC.gridheight = gh;
          GBC.weightx = wx;
          GBC.weighty = wy;
}And:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class IndstillingerPanel extends JPanel {
     JToggleButton JBTskift = new JToggleButton("Shift");
     JButton JBafslut = new JButton("Afslut");
     public IndstillingerPanel() {
          setLayout(new GridBagLayout());
          GridBagConstraints c = new GridBagConstraints();
          c.fill = GridBagConstraints.HORIZONTAL;
          c.ipadx = 0;
          c.ipady = 0;
          c.anchor = GridBagConstraints.CENTER;
          c.insets = new Insets(5, 5, 5, 5);
          GridCont(c, 0, 0, 2, 1, 1, 1);
          add(JBTskift, c);
          GridCont(c, 0, 1, 2, 1, 1, 1);
          add(JBafslut, c);
     public void setcancelAddListener(ActionListener listener) {
          JBafslut.addActionListener(listener);
     private void GridCont(GridBagConstraints GBC, int gx, int gy, int gw, int gh, double wx, double wy) {
          GBC.gridx = gx;
          GBC.gridy = gy;
          GBC.gridwidth = gw;
          GBC.gridheight = gh;
          GBC.weightx = wx;
          GBC.weighty = wy;
}h4. Just beautiful

Similar Messages

  • Executing an actionlistener in separate class

    Hi all,
    This is my first question on the Java forum. Hope I express myself clearly and I hope that someone can help me.
    I have created two classes (i.e. modified files that I found in Java books) - one which creates the user interface using JFrame (a text field and menu structure) and a second class which is basically the action listener for when the "menuFileLoad" button is pressed in the application.
    I would like to move the code for all "actionlisteners" to separate classes to make the code more transparent.
    I've moved the code for the action listener for the "menuFileLoad" button to the separate class "alistener".
    The code compiles well, but the action in the alistener class is not performed. It should put "Another text" in a text field. For test purposes, I've also put
    "System.out.println ("dada");" in the action listener and this is executed well.
    Has it something to do with the accessibility of the "TextField" ?
    This is the class that builds up the GUI
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.Object;
    import java.awt.Container;
    import javax.swing.JFileChooser;
    * Sample application using Frame.
    * @author
    * @version 1.00 08/09/10
    public class Getstring_ArrayFrame extends Frame {
         * The constructor.
         public TextField text = new TextField(20);
         public Getstring_ArrayFrame() {
            MenuBar menuBar = new MenuBar();
            Menu menuFile = new Menu();
            MenuItem menuFileExit = new MenuItem();
            MenuItem menuFileLoad = new MenuItem();
            MenuItem menuFileParse = new MenuItem();
            Menu menuFileTwo = new Menu();
            MenuItem menuFileDo = new MenuItem();
            menuFile.setLabel("File");
            menuFileExit.setLabel("Exit");
            menuFileLoad.setLabel("Load");
            menuFileDo.setLabel("Import Tool");
            menuFileParse.setLabel("Parse");
            menuFileTwo.setLabel("Tools");
            add(text);
            // Add action listener.for the menu button
            menuFileExit.addActionListener
                new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Getstring_ArrayFrame.this.windowClosed();
    // DIT IS HEM - DE EERSTE ECHTE ACTION LISTENER
           menuFileLoad.addActionListener (new alistener ());
               // new ActionListener() {
                 //   public void actionPerformed(ActionEvent e) {
                   // text.setText ("Eerste tekstje, joepie. Misschien nu nog den xml erbij krijgen");
                   // text.setBackground(Color.black);
                   // text.setForeground(Color.white);
    menuFileParse.addActionListener
                new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                    text.setText ("Opnieuw een tekstje, met tevens ook al een nieuwe knop.");
                    //text.setBackground(Color.black);
                    // text.setForeground(Color.white);
            menuFile.add(menuFileExit);
            menuFile.add(menuFileLoad);
            menuFile.add(menuFileParse);
            menuFileTwo.add(menuFileDo);
            menuBar.add(menuFile);
            menuBar.add(menuFileTwo);
            setTitle("Getstring_Array");
            setMenuBar(menuBar);
            setSize(new Dimension(400, 400));
            // Add window listener.
            this.addWindowListener
                new WindowAdapter() {
                    public void windowClosing(WindowEvent e) {
                        Getstring_ArrayFrame.this.windowClosed();
         * Shutdown procedure when run as an application.
        protected void windowClosed() {
             // TODO: Check if it is safe to close the application
            // Exit application.
            System.exit(0);
    }==> This is the alistener class
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.Object;
    import java.awt.Container;
    import javax.swing.JFileChooser;
    public class alistener implements ActionListener {
         TextField text = new TextField(20);
    public alistener () {
    public void actionPerformed(ActionEvent e) {
                  System.out.println ("dada");
                   text.setText ("Another text.");
                   text.setBackground(Color.black);
                   text.setForeground(Color.white);
    }

    I don't know AWT, just Swing, but it appears that your listener needs a reference to the GUI which may be passed perhaps in the Listener's constructor, and the GUI needs public methods to allow the listener to change things -- but to limit this ability so as not to compromise encapsulation. This should work the same with AWT For instance:
    import java.awt.Color;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JComponent;
    import javax.swing.JTextField;
    public class SwingTest
      private JPanel mainPanel = new JPanel();
      private JTextField textfield = new JTextField(20);
      public SwingTest()
        textfield.setEditable(false);
        JButton testListenerBtn = new JButton("Test Listener");
        testListenerBtn.addActionListener(new SwingTestListener(this));
        mainPanel.add(textfield);
        mainPanel.add(testListenerBtn);
      // public methods to allow the listener to change things,
      // but limit this ability to only what we want to let it change
      public void textfieldSetText(String text)
        textfield.setText(text);
      public void textSetBackground(Color color)
        textfield.setBackground(color);
      public void textSetForeGround(Color color)
        textfield.setForeground(color);
      public JComponent getComponent()
        return mainPanel;
      private static void createAndShowUI()
        JFrame frame = new JFrame("SwingTest");
        frame.getContentPane().add(new SwingTest().getComponent());
        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();
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class SwingTestListener implements ActionListener
      private SwingTest swingtest;
      public SwingTestListener(SwingTest swingtest)
        this.swingtest = swingtest;
      public void actionPerformed(ActionEvent arg0)
        swingtest.textfieldSetText("This Listener works!");
        swingtest.textSetBackground(Color.black);
        swingtest.textSetForeGround(Color.white);
    }Edited by: Encephalopathic on Nov 5, 2008 12:27 AM

  • Actionlistener in different class then the button

    hello,
    i am stuck on this piece of code and i think somebody here will be able to help me out :).
    i have these classes.
    ButtonPanel, Test.
    in the buttonpanel i have a few buttons, but the actionlistener is an innerClass in Test.
    when i want to add one of my actionlisteners in my ButtonPanel class the compiler cannot resolve symbol.
    this is a snippet of code:
    the buttons in buttonpanel class:
    btnStart = new JButton("Start");
    btnStart.addActionListener(new startActionListener());
    btnStop = new JButton("Stop");
    btnStop.addActionListener(new stopActionListener());
    btnTest = new JButton("Test");
    btnTest.addActionListener(new testActionListener());The actionlisteners in Test class:
    public class startActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e){
    java.awt.Toolkit.getDefaultToolkit().beep();//werkt niet
    public class stopActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e){
    java.awt.Toolkit.getDefaultToolkit().beep();//werkt niet
    public class testActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e){
    java.awt.Toolkit.getDefaultToolkit().beep();//werkt niet
    }so basically its just how do use actionlisteners in the class that extends from the JFrame, in stead of in de ButtonPanel class where the buttons are?

    URgent help need.
    i need to link the page together : by clicking the button on the index page.
    it will show the revelant class file. I have try my ationPerformed method to the actionlistener, it cannot work.
    Thanks in advance.
    // class mtab
    // the tab menu where it display the gui
    import javax.swing.*;
    import java.awt.*;
    public class mtab {
    private static final int frame_height = 480;
    private static final int frame_width = 680;
    public static void main (String [] args){
    JFrame frame = new JFrame ("Mrt Timing System");
    frame.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE);
    frame.setSize(frame_width,frame_height);
    JTabbedPane tp = new JTabbedPane ();
    tp.addTab("Mrt Timing System", new sample());
    frame.setResizable(false);
    frame.getContentPane().add(tp);
    frame.setSize(680,480);
    frame.show();
    // index page
    // class sample
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Image;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import java.text.*;
    import javax.swing.border.*;
    class sample extends JPanel implements ActionListener
    //button
    private JButton TimingButton;
    private JButton ViewButton;
    private JButton FrequencyButton;
    private JButton calculateButton;
    private CardLayout mycard;
    private JPanel SelectXPanel;
    private JPanel SelectYPanel;
    private JPanel SelectZPanel;
    private JPanel bigFrame, mainPane;
    // constructor
    public sample() {
    super(new BorderLayout());
    //create the object
    //create button and set it
    TimingButton = new JButton("MRT Timing Calculator");
    TimingButton.addActionListener(this);
    ViewButton = new JButton("View First and Last Train");
    ViewButton.addActionListener(this);
    FrequencyButton = new JButton("Show the Train Frequency");
    FrequencyButton.addActionListener(this);
    // Layout
    //Lay out the button in a panel.
    JPanel buttonPane = new JPanel(new GridLayout(3,0));
    buttonPane.add(TimingButton);
    buttonPane.add(ViewButton);
    buttonPane.add(FrequencyButton);
    // Layout the button panel into another panel.
    JPanel buttonPane2 = new JPanel(new GridLayout(0,1));
    buttonPane2.add(buttonPane);
    tfrequency x = new tfrequency();
    fviewl2 y = new fviewl2 ();
    timing z = new timing ();
    JPanel SelectXPanel = new JPanel(new GridLayout(0,1));
    SelectXPanel.add(x);
    JPanel SelectYPanel = new JPanel(new GridLayout(0,1));
    SelectYPanel.add(y);
    JPanel SelectZPanel = new JPanel(new GridLayout(0,1));
    SelectZPanel.add(z);
    // Layout the button by putting in between the rigid area
    JPanel mainPane = new JPanel(new GridLayout(3,0));
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.add(buttonPane2);
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.setBorder(new TitledBorder("MRT Timing System"));
    // x = new tfrequency();
    // The overall panel -- divide the frame into two parts: west and east.
    JPanel bigFrame = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    //bigFrame.add(x,BorderLayout.EAST); // this is where i want to link the page
    // this page being the index page. there being nothing to display.
    add(bigFrame);
    //Create the GUI and show it. For thread safety,
    public void actionPerformed (ActionEvent e){
    if (e.getSource() == TimingButton ){
    JPanel bigFrame = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    bigFrame.add(SelectZPanel,BorderLayout.EAST);
    add(bigFrame);
    else if (e.getSource() == ViewButton ){
    JPanel bigFrame = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    bigFrame.add(SelectYPanel,BorderLayout.EAST);
    add(bigFrame);
    else if (e.getSource() == FrequencyButton ){
    JPanel bigFrame2 = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    bigFrame.add(SelectXPanel,BorderLayout.EAST);
    add(bigFrame);
    // Train Frequency Page
    // class fviewl2
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Image;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import java.text.*;
    import javax.swing.border.*;
    class fviewl2 extends JPanel implements ActionListener
    //Labels to identify the fields
    private JLabel stationLabel;
    private JLabel firstLabel;
    private JLabel lastLabel;
    //Strings for the labels
    private static String station = "MRT Station:";
    private static String first = "First Train Time:";
    private static String last = "Last Train Time:";
    //Fields for data entry
    private JFormattedTextField stationField;
    private JFormattedTextField firstField;
    private JFormattedTextField lastField;
    //button
    private JButton homeButton;
    private JButton cancelButton;
    private JButton calculateButton;
    public fviewl2()
    super(new BorderLayout());
    //create the object
    //Create the Labels
    stationLabel = new JLabel(station);
    firstLabel = new JLabel (first);
    lastLabel = new JLabel (last) ;
    //Create the text fields .// MRT Station:
    stationField = new JFormattedTextField();
    stationField.setColumns(10);
    stationField.setBounds(300,300,5,5);
    //Create the text fields // First Train Time:
    firstField = new JFormattedTextField();
    firstField.setColumns(10);
    firstField.setBounds(300,300,5,5);
    //Create the text fields //Last Train Time:
    lastField = new JFormattedTextField();
    lastField.setColumns(10);
    lastField.setBounds(300,300,5,5);
    //Tell accessibility tools about label/textfield pairs, matching label for the field
    stationLabel.setLabelFor(stationField);
    firstLabel.setLabelFor(firstField);
    lastLabel.setLabelFor(lastField);
    //create button and set it
    homeButton = new JButton("Home");
    //homeButton.addActionListener(this);
    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(this);
    calculateButton = new JButton("Get Time");
    // Layout
    //MRT Station Label // insert into the panel
    JPanel StationPane = new JPanel(new GridLayout(0,1));
    StationPane.add(stationLabel);
    //MRT Station input field // insert into the panel
    JPanel StationInput = new JPanel(new GridLayout(0,1));
    StationInput.add(stationField);
    //Get Time Button // insert into the panel
    JPanel GetTime = new JPanel(new GridLayout(0,1));
    GetTime.add(calculateButton);
    //Lay out the labels in a panel.
    JPanel FlabelL = new JPanel(new GridLayout(0,1));
    FlabelL.add(firstLabel);
    FlabelL.add(lastLabel);
    // Layout the fields in a panel
    JPanel FFieldL = new JPanel(new GridLayout(0,1));
    FFieldL.add(firstField);
    FFieldL.add(lastField);
    //Lay out the button in a panel.
    JPanel buttonPane = new JPanel(new GridLayout(1,0));
    buttonPane.add(homeButton);
    buttonPane.add(cancelButton);
    // Layout all components in the main panel
    JPanel mainPane = new JPanel(new GridLayout(4,2));
    mainPane.add(StationPane);
    mainPane.add(StationInput);
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.add(GetTime);
    mainPane.add(FlabelL);
    mainPane.add(FFieldL);
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.add(buttonPane);
    mainPane.setBorder(new TitledBorder("View First and Last Train"));
    JPanel leftPane = new JPanel(new GridLayout(1,0));
    leftPane.add(Box.createRigidArea(new Dimension(0,1)));
    leftPane.add(mainPane);
    leftPane.add(Box.createRigidArea(new Dimension(0,1)));
    JPanel hahaFrame = new JPanel(new GridLayout(0,1));
    hahaFrame.add(Box.createRigidArea(new Dimension(0,1)));
    hahaFrame.setBorder(BorderFactory.createEmptyBorder(30, 10, 80, 150));
    hahaFrame.add(Box.createRigidArea(new Dimension(0,1)));
    JPanel bigFrame = new JPanel();
    bigFrame.add(hahaFrame, BorderLayout.NORTH);
    bigFrame.add(leftPane, BorderLayout.CENTER);
    add(bigFrame, BorderLayout.CENTER);
    //Create the GUI and show it. For thread safety,
    private void cancelButtonClicked()
    stationField.setText("");
    firstField.setText("");
    lastField.setText("");
    public void actionPerformed (ActionEvent e){
    if (e.getSource() == cancelButton){
    cancelButtonClicked();
    }

  • "Best practice" for components calling components on different panels.

    I'm very new to Swing. I have been learning from tutorials, but these are always relatively simple interfaces , in which every component and container is initialised and added in the constructor of a main JFrame (extension) object.
    I would assume that more complex, real-world examples would have JPanels initialise themselves. For example, I am working on a project in which the JFrame holds multiple JPanels. One of these Panels holds a group of JToggleButtons (grouped in a ButtonGroup). The action event for each button involves calling the repaint method of one of the other Panels.
    Obviously, if you initialise everything in the JFrame, you can simply have the ActionListener refer to the other JPanel directly, by making the ActionListener a nested class within the JFrame class. However, I would like the JPanels to initialise their own components, including setting the button actions, by using an extension of class JPanel which includes the ActionListeners as nested classes. Therefore the ActionListener has no direct access to JPanel it needs to repaint.
    What, then, is considered "best practice" for allowing these components to interact (not simply in this situation, but more generally)? Should I pass a reference to the JPanel that needs to be repainted to the JPanel that contains the ActionListeners? Should I notify the main JFrame that the Action event has fired, and then have that call "repaint"? Or is there a more common or more correct way of doing this?
    Similarly, one of the JPanels needs to use a field belonging to the JFrame that holds it. Should I pass a reference to this object to the JPanel, or should I have the JPanel use "getParent()", or some other method?
    I realise there are no concrete answers to this query, but I am wondering whether there are accepted practices for achieving this. My instinct is to simply pass a JPanel reference to the JPanel that needs to call repaint, but I am unsure how extensible this would be, how tightly coupled these classes would become.
    Any advice anybody could give me would be much appreciated. Sorry the question is so long-winded. :)

    Hello,
    nice to get feedback.
    I've been looking at a few resources on this issue from my last post. In my application I have been using the Observer and Observable classes to implement the MVC pattern suggested by T.PD.(...)
    Two issues (not fatal, but annoying) with this are:
    -Observable is a class, not an interface; since most of my Observers already extend JPanel (or some such), I have had to create inner classes.
    -If an Observer is observing multiple Observables, it will have to determine which Observer called its update() method (by using reference equality or class comparison or whatever). Again, a very minor issue, but something to keep in mind.I don't deem those issues are minor. The second one in particular, is rather annoying in terms of maintenance ("Err, remind me, which widget is calling this "update()" method?").
    In addition to that, the Observable/Observer are legacy non-generified classes, that incurr a loosely-typed approach (the subject and context arguments to the update(Observable subject, Object context) methods give hardly any info in themselves, and they generally have to be cast to provide app-specific information.
    Note that the "notification model" from AWT and Swing widgets is not Observer-Observable, but merely EventListener . Although we can only guess what reasons made them develop a specific notification model, I deem this essentially stems from those reasons.
    The contrasting appraoches are discussed in this article from Bill Venners: The Event Generator Idiom (http://www.artima.com/designtechniques/eventgenP.html).
    N.B.: this article is from a previous-millenary series of "Design Techniques" articles that I found very useful when I learned OO design (GUI or not).
    One last nail against the Observer/Observable model: these are general classes that can be used regardless of the context (GUI/non-GUI code), so this makes it easier to forget about Swing threading rules when using them (essentially: is the update method called in the EDT or not).
    If anybody has any information on the performance or efficiency of using Observable/ObserverI would be very surprised if this had any performance impact. If it had, that would mean that you have either:
    - a lot of widgets that are listening to one another (and then the Mediator pattern is almost a must to structure such entangled dependencies). And even then I don't think there could be any impact below a few thousands widgets.
    - expensive or long-running computation in the update methods. That's unrelated to the notification model itself.
    - a lot of non-GUI components that use the Observer/Observable to communicate among themselves - all the more risk then, to have a GUI update() called outside the EDT, see remark above.
    (or whether there are inbuilt equivalents for Swing components)See discussion above.
    As far as your remark 2 goes (if one observer observes more than one subjects, the update() method contains branching logic) : this also occurs with the Event Delegation model indeed: for example, it is quite common that people complain that their actionPerformed() method becomes unwieldy when the same class listens for several JButtons.
    The usual advice for this is, use anonymous listeners, each of which handles the event from only one source (and generally very close in code to the definition of that source), and that simply translates the "generic" event notification method into a specific method call of a Controller or Mediator .
    Best regards.
    J.
    Edited by: jduprez on May 9, 2011 10:10 AM

  • Problem in subclass with ActionListener

    Hello,
    I need to program two forms which are identical except for the actions their buttons should do and some other minor differences, therefore I made a superclass for one of the forms and then extended it to build the other form. I messed up and wrote the ActionListener's as inner classes inside the superclass. Now, the buttons in the subclass react exactly the same as the buttons in the superclass. A solution I can think of is to forget about extending the class and making a different class for each form, but this would mean having two different classes with very similar code, therefore I'm sure there is a more elegant solution. Any ideas?
    Thank you,
    Alfredo

    I believe that writing the ActionListeners as separate classes won't fix the problem, since the same ActionListeners would be called for each of the forms. The problem is how do I make the buttons in the subclass call different ActionListeners from the ones in the superclass.

  • InnerClass Actionlistener problem

    hello,
    i am stuck on this piece of code and i think somebody here will be able to help me out :).
    i have these classes.
    ButtonPanel, Test.
    in the buttonpanel i have a few buttons, but the actionlistener is an innerClass in Test.
    when i want to add one of my actionlisteners in my ButtonPanel class the compiler cannot resolve symbol.
    this is a snippet of code:
    the buttons in buttonpanel class:
    btnStart = new JButton("Start");
    btnStart.addActionListener(new startActionListener());
    btnStop = new JButton("Stop");
    btnStop.addActionListener(new stopActionListener());
    btnTest = new JButton("Test");
    btnTest.addActionListener(new testActionListener());
    The actionlisteners in Test class:
    public class startActionListener implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   java.awt.Toolkit.getDefaultToolkit().beep();//werkt niet
         public class stopActionListener implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   java.awt.Toolkit.getDefaultToolkit().beep();//werkt niet
         public class testActionListener implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   java.awt.Toolkit.getDefaultToolkit().beep();//werkt niet
    so basically its just how do use actionlisteners in the class that extends from the JFrame, in stead of in de ButtonPanel class where the buttons are?

    There are several options.
    If the classes don't at all refer to the class their nested in (as your examples seem to be), then just make them top-level, and refer to them anywhere you want.
    Or you could create anonymous inner classes, with identical functonality, in your ButtonPanel.
    Or you could add the listeners in a different place (say in a method of Test).
    The way you should go, depends on the details of the implementation.
    When you post code, please wrap it in [code][/code] tags.

  • Easy question: Give access to a class in another class.

    Stupid title, but dont know how to express myself :P Sorry for that.
    To the problem. Never had this problem before, and I know its a really easy solution to this.
    I have my Main class, which creates a MyView class. Inside this class, I make to new classes(or instances of classes i've already made), MyPanel and MyToolsPanel. Now I want to add buttons inside the MyToolsPanel class, and add actionlisteners to these buttons inside MyPanel.
    What I'v always done to grant access to MyToolsPanel inside of MyTools, is to simply add a
    //this is the MyPanel class
    MyToolsPanel mtp;
    public void setMtp(MyToolsPanel mtp){
    this.mtp = mtp;
    }and then in the MyView class which create these to classes, I put a command: mp.setMtp(mtp);
    When I run this it doesnt work.. Why? Should be easy to solve, since it obviously is a stupid problem that I just dont see. :P Feeling kind of stupid to ask this question, but this is how it is...
    EDIT: I might have to implement actionListener inside the MyToolsPanel class?
    Edited by: Stianbl on Sep 28, 2008 4:59 PM

    one way:
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    * Subclasses JPanel, can send text out via the getText() method
    * can hook into button press via addActionListener
    * @author Pete
    public class PanelCommSender extends JPanel
      private JTextField sendingField = new JTextField(12);
      private JButton sendButton = new JButton("Send");
      public PanelCommSender()
        add(sendingField);
        add(sendButton);
      public void addActionListener(ActionListener al)
        // attach this listener to the button
        sendButton.addActionListener(al);
       * call this to get the text currently in the textfield
       * @return String text
      public String getText()
        return sendingField.getText();
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    * Subclasses JPanel, receives text from another class
    * @author Pete
    public class PanelCommReceiver extends JPanel
      private JTextField showResultsField = new JTextField(12);
      public PanelCommReceiver()
        showResultsField.setEditable(false);
        add(new JLabel("Results from other panel: "));
        add(showResultsField);
       * call this to set text of textField
       * @param text
      public void setText(String text)
        showResultsField.setText(text);
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    public class PanelCommControl
      private static void createAndShowUI()
        // create new instances of the receiving and sending panels:
        final PanelCommReceiver receivePanel = new PanelCommReceiver();
        final PanelCommSender sendPanel = new PanelCommSender();
        // let the communicate w/ each other
        sendPanel.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
            receivePanel.setText(sendPanel.getText());
        // place the receiving JPanel into a JFrame
        JFrame frame = new JFrame("Receiving Panel");
        frame.getContentPane().add(receivePanel);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setPreferredSize(new Dimension(300, 300)); // make it bigger so it can be seen
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        // place the sending JPanel into a JDialog
        JDialog dialog = new JDialog(frame, "Sending Panel", false);
        dialog.getContentPane().add(sendPanel);
        dialog.pack();
        dialog.setLocationRelativeTo(null);
        dialog.setVisible(true);
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            // run the whole show in a thread-safe manner
            createAndShowUI();
    }

  • Class can't be instantiated

    Hi guys
    Just having trouble running this applet for some reason, in any browser. Other applets are working at the minute, so it doesn't look like a prob with the browsers or JVM.
    Heres the code, followed by the error message.
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public abstract class ColourButtons extends Applet
                                              implements ActionListener, MouseListener
         private Button colorButtons[] = new Button[7];
        private Color color = Color.black;
         int x1, y1, x2, y2 = 1;
        public void init()
              setLayout(new BorderLayout(20,20));
              Panel pWest = new Panel();
              pWest.setLayout(new GridLayout(7,1));
              for(int x =0; x <= 6; x++)
                   colorButtons[x] = new Button("   ");
                   pWest.add(colorButtons[x]);
                   add("West",pWest);
                   //add actionlisteners for each button
                   colorButtons[x].addActionListener(this);
                   if(x == 0){
                        color = Color.red;}
                   else if( x==1){
                        color = Color.blue;}
                   else if(x==2){
                        color = Color.green;}
                   else if(x==3){
                        color = Color.yellow;}
                   else if(x==4){
                        color = Color.orange;}
                   else if(x==5){
                        color = Color.black;}
                   else if(x==6){
                        color = Color.white;}
                   colorButtons[x].setBackground(color);
            setBackground(Color.gray);
        public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(color);
              //create Rectangle Object
              Rectangle myRectangle = new Rectangle(x1,y1,x2,y2);
              g2.draw(myRectangle);
                       g2.drawString("HELLO", 150,100);
        public void actionPerformed(ActionEvent a)
            Button button = (Button)a.getSource();
            color = button.getBackground();
            repaint();
        public void mouseClicked(MouseEvent e)
        public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
        public void mousePressed(MouseEvent e)
              x1 = e.getX();
              y1 = e.getY();
        public void mouseReleased(MouseEvent e)
              x2 = e.getX();
              y2 = e.getY();
    }And heres the error message.
    load: ColourButtons.class can't be instantiated.
    java.lang.InstantiationException
    at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance
    (InstantiationExceptionConstructorAccessorImpl.java:30)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
    at sun.applet.AppletPanel.run(AppletPanel.java:292)
    at java.lang.Thread.run(Thread.java:536)
    Any ideas at what is wrong?
    Any help/pointers greatly appreciated
    Cheers

    ok cheers thats sorted it. For some reason it wanted it to be abstract once i added mouse listener i think.
    Anyway cheers

  • What's the difference between Action Objects and ActionListeners

    Hello,
    in the Introduction to JSF two ways handling action are demonstrated. One way is "Combining Component Data and Action Object" the other way is "Handling Events."
    What's the difference? When do I use this or that way?
    The one thing I understand is when using "Combining Component Data and Action Objects" I use the default ActionListener and I may directly access the input values.
    TIA,
    Juergen

    Hi Juergen,
    The bottomline is 'not much', only in the details to these two approaches differ.
    The ActionListener object will have events broadcast to it for a particular object by the event mechanism in JSF. You can add one to a specific component via the f:action_listener tag. This will have your listener getting events during specific points in the request processing lifecycle (you specify via your return value for getPhaseId).
    The Action class that an actionRef reference refers to an Action that will be invoked during the invoke application phase. (see pg 71).
    I would recommend using actionRefs and Action objects wherever possible and going to ActionListeners only when you need notifications during a specific phase of the request/response cycle.
    Hope this helps,
    -bd-
    http://bill.dudney.net

  • Performance of mapping Oracle objects to Java classes

    Hi,
    By retrieving some test data from Oracle database in a Java application, I compared the traditional JDBC/RDBMS solution to JPublisher-generated-classes/Oracle-object-tables solution. The underlaying Oracle database and the client environment was the same in both tests. Although the table schemas were different, they represented the same data.
    It seems that the traditional JDBC/RDBMS solution is much faster. Is this a reality or did I make a mistake somewhere?
    BR,
    Timo

    I am also facing performance overhead when using Jpub generated
    classes for the object types.
    I am using 817 jdbc and jpub but my database is 816. I have seen
    that following statements each take around 2-3 seconds to
    execute. Is there any communication between driver and database
    to resolve the object type ?
    Please help.
    cCallableStatement =
    (OracleCallableStatement)m_cConnection.prepareCall("{call
    list_unsync_appts_array(?,?,?,?,?,?,?,?)}");
    ((OracleCallableStatement)cCallableStatement).setCustomDatum(1,ct_number_arr);
    cCallableStatement.registerOutParameter(2,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
    cCallableStatement.registerOutParameter(3,OracleTypes.ARRAY,"T_EVENT_DETAIL_ARR");
    cCallableStatement.registerOutParameter(4,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
    cCallableStatement.registerOutParameter(5,OracleTypes.ARRAY,"T_EVENT_DETAIL_ARR");
    cCallableStatement.registerOutParameter(6,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
    cCallableStatement.registerOutParameter(7,OracleTypes.ARRAY,"T_ATTENDEE_EMAIL_ARR");
    cCallableStatement.registerOutParameter(8,OracleTypes.ARRAY,"T_ATTENDEE_EMAIL_ARR");
    cCallableStatement.execute();

  • Linking classes - How do you make a new window?

    Hey
    Im currently working on a project for my final course grade, however, it requires that we create a gui interface in java (JCreator) whilst linking it to a microsoft access database we made perviously.
    I would like to know if it is possible to open/run/excute another class (either opening it in the same window / jframe, or more preferably opening another whole jframe) from clicking on a button in the origional class (which is the main menu, clicking on the button will open client details) if so, how?
    I greatly apperciate any feedback
    cheers

    I would advise you to have a look at the swing tutorial @ http://java.sun.com/docs/books/tutorial/uiswing/
    Read the basics and Swing Components for creating windows, for the button click part, read the section about ActionListeners.

  • Help with GUI (calling one class from other class)

    Hi everybody,
    I am new at GUI and I need your help..
    I have a JPanel, named "holdAll", layout of which is set to BorderLayout. I have implemented all other JPanels in different class files. For example, I have TopPanel, LeftPanel, etc. as shown below
    LeftPanel myLeft = new LeftPanel();
    holdAll.add(myLeft, BorderLayout.WEST);
    RightPanel myRight = new RightPanel();
    holdAll.add(myRight, BorderLayout.EAST);
    TopPanel myTop = new TopPanel();
    holdAll.add(myTop, BorderLayout.NORTH);
    MiddlePanel myMiddle = new MiddlePanel();
    holdAll.add(myMiddle, BorderLayout.CENTER);
    BottomPanel myBottom = new BottomPanel();
    holdAll.add(myBottom, BorderLayout.SOUTH);
    That works well but I have difficulties in ActionListeners.. For example, in my TopPanel class I have the code below:
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == btnInsert) {
    int returnVal = fc.showOpenDialog(fc);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    myImage newImage = new myImage(file);
    System.out.println(newImage.myHashCode());
    Here, if I have upload new image, then I have to update the listImage in the LeftPanel class.. But, I could not access the lstImage object in the LeftPanel class from the actionListener event in the TopPanel class.
    What should I do? Is my design poor?

    public class TopPanel extends JPanel implements ActionListener { //it doesn't allow "extends JPanel, Observable"
    JFileChooser fc;
    JButton btnInsert;
    JButton btnDelete;
    public TopPanel() {
    setLayout(new FlowLayout());
    setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.GRAY));
    btnInsert = new JButton("Insert");
    btnDelete = new JButton("Delete");
    JLabel myLabel = new JLabel(" Search : ");
    JTextField txtSearch = new JTextField();
    txtSearch.setColumns(20);
    JToolBar searchToolBar = new JToolBar();
    fc = new JFileChooser();
    btnInsert.addActionListener(this);
    searchToolBar.add(btnInsert);
    searchToolBar.add(btnDelete);
    searchToolBar.add(myLabel);
    searchToolBar.add(txtSearch);
    add(searchToolBar);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == btnInsert) {
    int returnVal = fc.showOpenDialog(fc);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    *//Here I want to send fc.GetName() to the JList in the LeftPanel*
    my LeftPanel class is below:
    public class LeftPanel extends JPanel{
    public LeftPanel(){
    this.setLayout(new BorderLayout());
    setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.GRAY));
    JPanel pnlButtons = new JPanel();
    JButton btnName = new JButton("Name");
    JButton btnSize = new JButton("Size");
    JButton btnDate = new JButton("Date");
    pnlButtons.add(btnName);
    pnlButtons.add(btnSize);
    pnlButtons.add(btnDate);
    pnlButtons.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel pnlImage = new JPanel();
    JList lstImage = new JList();
    lstImage.setVisible(true);
    pnlImage.add(new JScrollPane(lstImage));
    add(pnlButtons, BorderLayout.NORTH);
    add(pnlImage, BorderLayout.CENTER);
    Is there any simple way?

  • Annonymous and inner classes

    Hello,
    Can anyone tell me what the benefits of anonymous and inner classes are? inner classes are seem pretty complicated without any obvious benefit.
    I have read about these in books and have some understanding of them but these don't appear to have any benefits.
    Any info on either would be really cool.
    regards

    There are many places where inner classes can be useful. One place where anonymous inner classes are particularly neat is for ActionListeners. For example, compare the "normal" way of doing it:
         for(int i = 0; i < 2; i++)
              JButton button = new JButton("Button " + i);
              button.setActionCommand("ACTION" + i);
              button.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if("ACTION0".equals(e.getActionCommand()))
                   doSomething(0);
              else if("ACTION1".equals(e.getActionCommand()))
                   doSomething(1);
         }with the way using anonymous inner classes:
         for(int i = 0; i < 2; i++)
              final int index = i;
              JButton button = new JButton("Button " + index);
              button.addActionListener(new ActionListener()
                        public void actionPerformed(ActionEvent e)
                             doSomething(index);
         .In the first case you need a global actionPerformed method with some if statements inside. If there are many types of action then this can quickly become very large and error-prone. In the second case, each action is handled in its own class, right with the button that it's associated with. This is easier to maintain. Note that local variables must be declared final to be accessible from the inner class.

  • Actions and ActionListeners as parameters

    Hi everybody,
    I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
    method( action, action )
    method( action, listener )
    method( listener, action )
    method( listener, listener )It seems like doing it this way would result in a lot of extra code, and hence become a real pain in the neck. So, I was curious, has anyone else either tried to do this before, or do you have any ideas as to how I might be able to do this more efficiently? When I looked at the API it didn't look like Actions and ActionListeners share a root class I can use.
    Thanks,
    Jezzica85

    jezzica85 wrote:
    Hi everybody,
    I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
    method( action, action )
    method( action, listener )
    method( listener, action )
    method( listener, listener )
    Well, if you want to support that then you are just going to have to do suffer through it, the only shortcut I can recommend is that your method(action, listener) and method(listener, action) are the same so you only have to implement 1 and just use the other as a entry point to call the one you wish to contain the code.

  • 2 buttonhandlers in 1 class?

    Hi all,
    Just started at school with Java.
    So i'm learning ass much as a can, anyway i'm bizzy with making a calculator and when i press a button i learned @ school that you make a class:
    class button1 implements ActionListener {
    public void actionPerformed(ActionEvent e){
    action //etc...
    Oke this works fine with 1 button.
    But when I use multiple buttons they say at school for each button you've got to make a new class, so:
    class button1 implements ActionListener {
    public void actionPerformed(ActionEvent e){
    action //etc...
    class button2 implements ActionListener {
    public void actionPerformed(ActionEvent e){
    action //etc...
    etc...
    My question is: isn't it possible to put all the actions in 1 class?
    Like:
    class button1 implements ActionListener {
    public void button1(ActionEvent e){ //or sometthing
    action //etc...
    public void button2, etc, etc...
    So that i dont need to make 50 classes?
    Thanx in advance!
    Johan

    I have a similiar problem, except with my program i have two JButton's that have ActionListeners and two JTextFields that have ActionListeners. The information put into the two JTextFields has to be used when the either of the JButtons is pressed. My problem is I cannot get java to store the information inputed into the JTextFields so that the JButtons can use it once they are pressed. It really just an Addition/Subtraction calculator. here is the code i have so far that is not working. Im stumped on how to get the input from the two JTextFields to be stored so when the JButtons are pressed it uses that input to calculate the result. Please if you can offer any help it is greatly appreaciated.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.*;
    public class IntegerCalculatorPanel extends JPanel{
    private JButton getsum, subtract;
    private JLabel operand1label, operand2label, operation, Result;
    private JTextField operand1, operand2;
    IntegerCalculator myCalculator = new IntegerCalculator(0,0);
    int value1, value2, result;
    public IntegerCalculatorPanel() {
    getsum = new JButton ("+");
    subtract = new JButton ("-");
    getsum.addActionListener (new ActionListen());
    subtract.addActionListener(new ActionListen());
    Result = new JLabel("Result");
    operation = new JLabel ("Enter second operand:");
    operand1label = new JLabel ("Enter first operand:");
    operand2label = new JLabel ("Enter second operand:");
    operand1 = new JTextField (10);
    operand2 = new JTextField (10);
    operand1label.setText("Enter first operand:");
    operand1.addActionListener(new ActionListen());
    operand2label.setText("Enter second operand:");
    operand2.addActionListener(new ActionListen());
    operation.setText("Select operation");
    Result.setText("Result:" + result);
    add(operand1label);
    add(operand1);
    add(operand2label);
    add(operand2);
    add(operation);
    add(getsum);
    add(subtract);
    add(Result);
    setPreferredSize (new Dimension(275, 100));
    setBackground (Color.yellow);
    setLayout (new FlowLayout());
    private class ActionListen implements ActionListener{
    public void actionPerformed(ActionEvent event)
    if (event.getSource() == getsum);
    Result.setText("Result:" + myCalculator.getsum());
    }

Maybe you are looking for

  • PPPoE not working in 10.6

    hi guys. i have a problem with pppoe and 10.6. i installed 10.6 on my unibody macbook and now my network stopped working. i have a pppoe connection. i click to connect, it shows me that the connection was succesfully done, but when i open safari, i c

  • FUhr: myFirstMIDlet - what is the most compatible configuration? request fo

    Hello, I have just programmed for the first time in java, and in j2me, using sun's j2se and j2me. On my own phone, nokia 6230, the midlet works well. Also in the sun- and nokia6230-emulator. But a friend with a slightly older Nokia phone couldn't get

  • Please read question of carefully how to perform in SQLplus10g (dont give ans for 11g or previous release)

    There is table called department Depno  Employee_id  salary 101         E12             1000 101         E13             1000 101         E14             3000 101         E15             5000 102         E16             4000 102         E17          

  • TOC not displaying

    I am having problems with my TOC displaying after it is deployed to our test environment server.  When I view the help file on my own computer, the TOC displays on the left.  But after the output files are deployed to our servers, the TOC no longer d

  • Publish to Google WebDAV Server

    I want to publish my outlook calendar to Google Calander, but below errror was displayed 'The upload of "Calendar" failed. The calendar was not publichsed to the server. This might be because the calendar name is not valid. Rename your calendar in ou