how to access the object of one frame on clicking a button without using this keyword

how to access the object of one frame on clicking a button without using this keyword

import java.awt.*; import java.awt.event.*;

class Mybuttons1 extends Frame {

public static void main(String args[])
{
    Button b1;


    Mybuttons mb=new Mybuttons();
    mb.setSize(400,400);
    mb.setTitle("My buttons");
    mb.setVisible(true);


    mb.setLayout(new FlowLayout());

    b1=new Button("Yellow");


    mb.add(b1);
    mb.add(b2);
    mb.add(b3);

    b1.addActionListener(new Myclass());


    mb.addWindowListener(new WindowAdapter()
    {
        public void windowClosing(WindowEvent e)
        {
            System.exit(0);
        }
    });

}

}

class Myclass extends Frame implements ActionListener { public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand();

    if(str.equals("Yellow"))
        this.setBackground(Color.yellow);

}

}

View Answers









Related Tutorials/Questions & Answers:
how to access the object of one frame on clicking a button without using this keyword
how to access the object of one frame on clicking a button without using... extends Frame { public static void main(String args[]) { Button b1... Button("Yellow"); mb.add(b1); mb.add(b2); mb.add(b3
how to display the values of one list in other upon clicking a button in struts2
how to display the values of one list in other upon clicking a button in struts2  Hello friends..Am new to struts2..Please any one has to guide me... list upon clicking a button...Can any one provide me the sample code.. Hope
Advertisements
How to access sub class member using super class object
How to access sub class member using super class object  class A{ } class B extends A{ int b=1; } class Test{ public static void main(String args[]) { what to do here to access sub class variable b using super class object
how to go from one frame to another frame in swings - Java Beginners
how to go from one frame to another frame in swings  Hi, My task is to go from one frame to another.......... let us think that iam having two buttons on a frame........button names are ok and next........ when iam clicking
how to close the connection object,statement object,resultssetobject when using the microsoft access a database - SQL
how to close the connection object,statement object,resultssetobject when using the microsoft access a database   Hi Friend, I am developing the webapplication using the jsp(business logice-jsp).backend is microsoft access
How to Display Next question from database after clicking Next Button using "Arraylist concept"
How to Display Next question from database after clicking Next Button using "Arraylist concept"  </tr> <%if (pageName.equals("1")) {%> <tr> <td> <div style
How to Create Button on Frame
How to Create Button on Frame       In this section, you will learn how to create Button on ... button on the frame object. FlowLayout(): This is the constructor of FlowLayout class
Change paragraph by clicking button(Toggle effect)
Change paragraph by clicking button(Toggle effect) In this tutorial, we will discuss about how to change paragraph by clicking button using jQuery... on button , a new paragraph will be displayed and the old one will hidden
making consistency of data member in the whole programme without using static keyword
making consistency of data member in the whole programme without using static keyword  In the below programme i use one boolean variable named check , which is being accessed inside main function by two objects of Tst1 and Test2
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
Drag and Drop components from one frame to another frame
button etc.) from one frame to another frame. In this code we have used... Drag and Drop components from one frame to another frame... separate frames....... ADS_TO_REPLACE_3  One frame has five component
How to close a frame on action event of a button from a different class ?
How to close a frame on action event of a button from a different class ?  How to close a frame on action event of a button from a different class ? I have a designed a control-frame on 1 class which has jbutton components, I
How can we submit a form without a submit button?
How can we submit a form without a submit button?  How can we submit a form without a submit button
How to save form fields into the MySql Database without submit button in jsp?
How to save form fields into the MySql Database without submit button in jsp?  I want to store user inputs into the database using javasccript or ajax or jqury but without submit button. Form Contains three fields
frame with a vertical scrollbar but without a horizontal scrollbar.
frame with a vertical scrollbar but without a horizontal scrollbar.  How do I make a frame with a vertical scrollbar but without a horizontal scrollbar
create text box by clicking button and submittong text in text box using submit
create text box by clicking button and submittong text in text box using submit  Hi, I created a button when i click on button new textbox... will click submit button the text should be submitted(it shows the value in text
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
how to access windows registry information using java?
how to access windows registry information using java?  can any one help me how to access windows registry information using java
Toggle hide/show by clicking same button
Toggle hide/show by clicking same button In this tutorial, we will discuss about how to toggle hide/show by clicking button. In the given below 2 example, there is button ,by clicking on it, the paragraph will hide/show . In first
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button to jtable  Hello Sir, I made search button with textfield... and show multiple identical rows from database on clicking search button
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button to jtable  Hello Sir, I made search button with textfield... and show multiple identical rows from database on clicking search button
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button to jtable  Hello Sir, I made search button with textfield... and show multiple identical rows from database on clicking search button
Hide text by clicking button
Hide text by clicking button In this tutorial, we will discuss about hide/show text by clicking on button. In the below example, there are two buttons... clicking any button : ADS_TO_REPLACE_4 After click "Hide" button
how to convert string to char array in java without using tochararray
how to convert string to char array in java without using tochararray  Hi, I want to convert the String object in java without the toChararray() function. how to convert string to char array in java without using
how to display duplicate elements with out using collection Frame work?
how to display duplicate elements with out using collection Frame work?  how to display duplicate elements with out using collection Frame work
PHP Static Variable and Methods
then we can access the method using class, without instantiating any object... should use static methods and variables. Static keyword is used to make only one copy of the variable for the class. All objects of that class will access one copy
can we use scanner class,class , object and methods to get output without using constructor ????
can we use scanner class,class , object and methods to get output without using... am i getting error here... can we get output using scanner class , object and methods without using constructor??? //Program to illustrate the classes
how can i close a frame. - Java Beginners
and in that table is displayed and one button is added to that frame............my target is when i click on that button, a new frame is coming and updated table...how can i close a frame.  Hi, My question is how can we close
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... a dropdown menu to choose type of report and then click on submit button.On clicking
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... a dropdown menu to choose type of report and then click on submit button.On clicking
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... a dropdown menu to choose type of report and then click on submit button.On clicking
Compose mail by clicking on send mail button
Compose mail by clicking on send mail button  How i get microsof out look page opend for composing mail by just clicking on send mail button and when outlook page open then in to:my email id is written on my jsp page
how to delete a row in sql without using delete command.
how to delete a row in sql without using delete command.  how to delete a row in sql without using delete command. thanks in advance
how to validate the telephone number without using jquery in html with javascript
how to validate the telephone number without using jquery in html with javascript  how to validate the telephone number without using jquery in html with javascript
why using static keyword
why using static keyword  why using static keyword
Data Access Object
Data Access Object  Hi sir/madam please give me some tutorial/example about Data Access Object   Hi Please Find the example of Java Data Access Object http://www.roseindia.net/tutorial/java/jdbc
how to make seperate view count for each row while clicking view button
how to make seperate view count for each row while clicking view button  I am getting problem with view count when i click view button the seperate count should be happen for each row here is my code ** Tabledata.jsp <
how can i achieve multiple inheritance in java without using inheritance ?
how can i achieve multiple inheritance in java without using inheritance ?  how can i achieve multiple inheritance in java without using inheritance
Hide boxes by clicking on it using jQuery
Hide boxes by clicking on it using jQuery In this tutorial , we will discuss about how to hide boxes by clicking on it using jQuery. In the given below... is created using 'html' and it is replicated by using "for " loop
Hide/Show paragraph by button click
how to hide/show paragraph by clicking on button using jQuery. In the below... OUTPUT Before clicking any button : ADS_TO_REPLACE_2 After clicking button : After clicking above button :ADS_TO_REPLACE_3 Download Source code Click
Should not logout after clicking the back/forward button
he clicks on the back button user automatically gets logged out. very next if clicked the forward button user gets logged in..!! how can I solve this issue? What...Should not logout after clicking the back/forward button  Hi all I
How to declare a Combobox without using a string in its declaration?
How to declare a Combobox without using a string in its declaration?  What i mean to ask is how can i declare a combobox first and initialise... the examples and tutorials so far i haven't found any which tells me how to do
how to build a colorful clock in JSP without using Flash.
how to build a colorful clock in JSP without using Flash.  I have to make a colorful clock using java programming or some API in a JSP page. Please send me a code for it as soon as possible
Upload file without brouse button
Upload file without brouse button  Hi i want to upload 7 files without using browse button . I am using jscript to get the files and to view... help me .I am using FormFile API to upload files.I dont want to change my
Access properties of bean from request object using OGNL.
Access properties of bean from request object using OGNL. In this section, we will introduce you how to access beans properties from request object using OGNL expression language.  1-index.jsp <%@page language="
How to Hide Button using Java Swing
How to Hide Button using Java Swing  Hi, I just begin to learn java programming. How to hide the button in Java programming. Please anyone suggest... Programming application how to hide the buttons using Java Swing. Please Visit
Hibernate criteria - how to use criteria to return only one element of an object instead the entire object.
Hibernate criteria - how to use criteria to return only one element of an object instead the entire object.  How to use criteria to return only one... projection to select one element of object. Here is an example to retrieve only name
Setting the close button operation for the frame in Java
will learn how to implement the close button of any frame or window in java... closing the frame). Here, you will see how to set the close button... Setting the close button operation for the frame in Java
access into radio button
access into radio button  access the four fields of database called access,access file and stored in radio button.please help
add button to the frame - Swing AWT
add button to the frame  i want to add button at the bottom... table with database data JFrame frame = new JFrame("View Patients... JFrame implements ActionListener { JButton button = new JButton("Button

Ads