How to use ActionListener to open a class file? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to use ActionListener to open a class file?

terryfreedomterryfreedom Posts: 9Member
public void actionPerformed(ActionEvent e)
{

if(e.getSource()== open)
{
Graph app=new Graph();
}
}
There is an error after compling. This is the comment.

C:Documents and Settingsstudent18aMy DocumentsJava ProjectColorSelect.java:55: unreported exception java.io.IOException; must be caught or declared to be thrown
Graph app=new Graph();
^
1 error

Any ways to solve this error to open this class file called "Graph"? Thanks to the personal who provide solutions.

Comments

  • zibadianzibadian Posts: 6,349Member
    : public void actionPerformed(ActionEvent e)
    : {
    :
    : if(e.getSource()== open)
    : {
    : Graph app=new Graph();
    : }
    : }
    : There is an error after compling. This is the comment.
    :
    : C:Documents and Settingsstudent18aMy DocumentsJava ProjectColorSelect.java:55: unreported exception java.io.IOException; must be caught or declared to be thrown
    : Graph app=new Graph();
    : ^
    : 1 error
    :
    : Any ways to solve this error to open this class file called "Graph"? Thanks to the personal who provide solutions.
    :
    :
    Either import a package containing the Graph class, or define the Graph class yourself.
  • terryfreedomterryfreedom Posts: 9Member
    : : public void actionPerformed(ActionEvent e)
    : : {
    : :
    : : if(e.getSource()== open)
    : : {
    : : Graph app=new Graph();
    : : }
    : : }
    : : There is an error after compling. This is the comment.
    : :
    : : C:Documents and Settingsstudent18aMy DocumentsJava ProjectColorSelect.java:55: unreported exception java.io.IOException; must be caught or declared to be thrown
    : : Graph app=new Graph();
    : : ^
    : : 1 error
    : :
    : : Any ways to solve this error to open this class file called "Graph"? Thanks to the personal who provide solutions.
    : :
    : :
    : Either import a package containing the Graph class, or define the Graph class yourself.
    :

  • terryfreedomterryfreedom Posts: 9Member
    : : : public void actionPerformed(ActionEvent e)
    : : : {
    : : :
    : : : if(e.getSource()== open)
    : : : {
    : : : Graph app=new Graph();
    : : : }
    : : : }
    : : : There is an error after compling. This is the comment.
    : : :
    : : : C:Documents and Settingsstudent18aMy DocumentsJava ProjectColorSelect.java:55: unreported exception java.io.IOException; must be caught or declared to be thrown
    : : : Graph app=new Graph();
    : : : ^
    : : : 1 error
    : : :
    : : : Any ways to solve this error to open this class file called "Graph"? Thanks to the personal who provide solutions.
    : : :
    : : :
    : : Either import a package containing the Graph class, or define the Graph class yourself.
    : :
    What u mean import package contain the Graph class? Can give examples? Thanks.

  • zibadianzibadian Posts: 6,349Member
    : : : : public void actionPerformed(ActionEvent e)
    : : : : {
    : : : :
    : : : : if(e.getSource()== open)
    : : : : {
    : : : : Graph app=new Graph();
    : : : : }
    : : : : }
    : : : : There is an error after compling. This is the comment.
    : : : :
    : : : : C:Documents and Settingsstudent18aMy DocumentsJava ProjectColorSelect.java:55: unreported exception java.io.IOException; must be caught or declared to be thrown
    : : : : Graph app=new Graph();
    : : : : ^
    : : : : 1 error
    : : : :
    : : : : Any ways to solve this error to open this class file called "Graph"? Thanks to the personal who provide solutions.
    : : : :
    : : : :
    : : : Either import a package containing the Graph class, or define the Graph class yourself.
    : : :
    : What u mean import package contain the Graph class? Can give examples? Thanks.
    :
    :
    I don't know which package defines the Graph class, so I cannot give you the specific code, but here are some examples:
    [code]
    import javax.swing.*;
    import java.io.*;
    import java.awt.event.*;
    import schets.gui.dialogs.*;
    import schets.io.*;
    [/code]
Sign In or Register to comment.