Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to access the object of one frame on clicking a button without using this keyword
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


burle sharma
how to access the object of one frame on clicking a button without using this keyword
0 Answer(s)      a year and 2 months ago
Posted in : Java Beginners


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);

}

}


Advertisement
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 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 ... a command button on the Java Awt Frame. There is a program for the best
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
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
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
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...;One frame has five component, user can drag and drop component from one
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
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
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... the animation will run OUTPUT Before clicking any button : After click "
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
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
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
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 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
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
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
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
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
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...; Description of the program : Inside "div" ,box is created using '
 

 

 

DMCA.com