Results 1 to 4 of 4
  1. #1
    fishy8158 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default The method setVisable(boolean) is undefined for the type ChooseColor

    The method setVisable(boolean) is undefined for the type ChooseColor error. Can anyone help point out the problem?



    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;


    public class ChooseColor extends JFrame{
    private Color color=(Color.WHITE);
    private JPanel panel;
    private JButton button;

    public void colorComponet(){
    panel=new JPanel();
    panel.setBackground(color);
    button=new JButton("choose color");
    button.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent event){
    color=JColorChooser.showDialog(null, "Choose Color", color);
    if(color==null);
    color=color.WHITE;

    panel.setBackground(color);

    }
    }
    );
    add(panel, BorderLayout.center);
    add(button, BorderLayout.SOUTH);
    setSize(425,200);
    setVisable(true);

    }

    }


    import javax.swing.*;
    public class ChooseColorTester {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    ChooseColor a=new ChooseColor();
    a.colorComponet();
    a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }

    }

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default Re: The method setVisable(boolean) is undefined for the type ChooseColor

    That compiler message means that there is no such method. This can be because you spelt it wrong, or it may be that you passed the method the wrong number, or wrong type of arguments.

    Either way, the thing to do is consult the JFrame API docs to see what methods *are* defined and their arguments. (The one you are looking for is actually a Window method.)

  3. #3
    fishy8158 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: The method setVisable(boolean) is undefined for the type ChooseColor

    thanks alot , i got it to work.

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default Re: The method setVisable(boolean) is undefined for the type ChooseColor

    You're welcome.

Similar Threads

  1. operator undefined for argument type int, String
    By aconti in forum New To Java
    Replies: 8
    Last Post: 05-30-2011, 08:32 AM
  2. Replies: 0
    Last Post: 12-16-2010, 08:35 AM
  3. Replies: 10
    Last Post: 12-07-2010, 01:29 PM
  4. Replies: 2
    Last Post: 05-08-2010, 12:02 AM
  5. Replies: 0
    Last Post: 05-27-2009, 05:39 PM

Posting Permissions

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