Sunday, October 21, 2012

Java program to illustrate swing concept


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class swing extends JFrame implements ActionListener,ItemListener
{JComboBox combo=new JComboBox();
  JButton btnExit=new JButton("Exit");
  Container cp=getContentPane();
  Color c=cp.getBackground();
  public swing()
  {        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setLayout(null);
            combo.addItem("Reset to Default Color");
            combo.addItem("Set background color to red");
            combo.addItem("Set background color to green");
            combo.addItem("Set background color to blue");
            cp.add(combo);
            cp.add(btnExit);
            btnExit.setBounds(85,120,70,30);
            combo.setBounds(20,10,200,30);
            combo.addItemListener(this);
            btnExit.addActionListener(this);
  }
public void itemStateChanged(ItemEvent e)
  {        String s=(String)e.getItem();
            if(s.compareTo("Reset to Default Color")==0)
            cp.setBackground(c);
            if(s.compareTo("Set background color to red")==0)
            cp.setBackground(Color.red);
            if(s.compareTo("Set background color to green")==0)
            cp.setBackground(Color.green);
            if(s.compareTo("Set background color to blue")==0)
            cp.setBackground(Color.blue);
  }
public void actionPerformed(ActionEvent a)
  {        String s=a.getActionCommand();
            if(s.equals("Exit"))
            System.exit(0);
  }
public static void main(String[]args)
{
            swing cd=new swing();
            cd.setSize(new Dimension(250,200));
            cd.setTitle("A swing application");
            cd.setVisible(true);
   }
 }
Output

33 comments:

  1. Java Program To Illustrate Swing Concept ~ Techietopics >>>>> Download Now

    >>>>> Download Full

    Java Program To Illustrate Swing Concept ~ Techietopics >>>>> Download LINK

    >>>>> Download Now

    Java Program To Illustrate Swing Concept ~ Techietopics >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I read your blog its nice i like content its very useful for me
    I am Amara William I am always ready to learn new things and resolve problem regarding.
    I am a help you to resolve your quick book error, I am independent expert last 5 year to solve all error of quick book QuickBooks , working dedicatedly with the reliable QuickBooks support provider for resolving QuickBooks errors efficiently.
    Fix QuickBooks Error Code 15101

    ReplyDelete

  4. What a wonderful information it really helps me a lot to understand new things also have a look on this School with best rating.

    ReplyDelete
  5. Thank you for this important information it contains very good knowledge and helps me a lot Best CBSE School in Faridabad

    ReplyDelete
  6. Thank you for this amazing blog it really helps me lot to understand new things keep doing this work also have a look on this Best Fertility Clinic In Faridabad

    ReplyDelete
  7. Keep doing this work it is very helpful to me thank you for this blog also check out this one Best IVF Centre In Faridabad

    ReplyDelete
  8. Thanks a lot for giving us such a helpful information. You can also visit our website for topics for ntcc project

    ReplyDelete
  9. Best Packers and Movers in Hyderabad Looking for help for shifting then this Best Packers and Movers in Gurgaon directory is ready to help you. You can visit our online platform to get the list of verified packers and movers in Hyderabad. Here you will get effective services at affordable rates. You can get the best for yourself by getting cost quotes from multiple Packers and Movers Kolkata.

    ReplyDelete
  10. Thanks for the creative ideas !!! mobile price in bd
    click here for More Mobile price

    ReplyDelete
  11. Absolutely thrilled with the exceptional car care services provided by Active Car Wash!

    ReplyDelete
  12. UEEPHONE is an iPad wholesale distributor since 2012! We sell to small retailers, repair shops, wholesalers, refurbishes, and smaller distributors around the globe. High-quality iPads are shipped worldwide, and a drop shipping service is provided. Our iPads are precisely graded based on their performance and condition. The iPad wholesale price is set based on the real quality of our product and service to guarantee our customers that every penny you spent does worth it.

    ReplyDelete
  13. Whatoop Low Voltage Switchgear is a high-quality electrical distribution and control device designed to provide reliable and safe power distribution and control in low voltage systems. It is suitable for a wide range of industrial, commercial, and residential applications.

    ReplyDelete
  14. A drop test machine is used to test the damage caused by dropping the product package and to evaluate the impact strength during transportation and handling. Our drop testers are used for the purpose of dropping tests while keeping the attitude of the specimen and investigating its effect. In addition, it can be used not only for electricity and electronics but also for drop tests in various fields such as medicine, food, and pharmaceutical. Linkotest has proudly served the drop test industry with mechanical drop testers for mobile products, rotating drum testers, drop testers for packages, and all types of drop testers for large items for over 23 years.

    ReplyDelete
  15. vijay devarakonda wife: Known for her grace and elegance, Vijay Devarakonda's wife exudes charm wherever she goes. With a captivating smile and a warm demeanor, she effortlessly complements her husband's star power on and off the screen.

    ReplyDelete
  16. While vijay age may be undisclosed, his talent and charisma know no bounds, leaving an indelible mark on the entertainment industry.

    ReplyDelete
  17. best travel sites: Your one-stop destination for discovering the top travel destinations, curated recommendations, and insider tips to make your journey unforgettable. From budget-friendly getaways to luxury escapes, we've got you covered with comprehensive reviews and exclusive deals.

    ReplyDelete
  18. As a professional tube gift box manufacturer with over 12 years of experience, Hopak provides a remarkable array of custom gift box solutions with extraordinary printing quality. A tube gift box is a great tool to impact your brand. We come up with innovations in gift packaging with your requirements or design ideas. Hopak utilizes high-quality printing to make an attractive display for your packaging tube. It helps to make your brand more identified in the market and your products more memorable.

    ReplyDelete
  19. Stand up pouch Manufacturer are flexible and lightweight, which makes them more cost-effective to transport and store compared to rigid packaging. And have a larger surface area for branding and product information, making them great for marketing. Stand up pouches can be made from various materials, including recyclable and biodegradable options, making them more environmentally friendly. The design of stand-up pouches allows them to be easily displayed on store shelves and improves product visibility.

    ReplyDelete
  20. As a professional safety barrier manufacturer in China, Aotons provides two types of flexible safety barriers to reduce the risk of accidents, damage, and unscheduled downtime. One is the AEGIS safety barrier, which is made of AEGIS steel material, it is usually used as a parking barrier. Another is the ARMORFLEX® safety barrier, which is made of ARMORFLEX® material independently developed by our company, it is used as an industrial safety barrier. Aotons flexible safety barrier is the most durable and advanced flexible workplace barrier on the market, now it has been used by many brand companies, like Mengniu, Yili, TNT, DHL, BMW, Mercedes Benz, Volkswagen, P & G, etc

    ReplyDelete
  21. khan sir age whose age remains a mystery to many, is celebrated for his contributions to the educational landscape, proving that age is just a number when it comes to making a difference in students' lives.

    ReplyDelete
  22. Journey Through valerie sandler Artistic Odyssey: From Clay to Conceptual Excellence

    ReplyDelete
  23. Uncover the Artistry of keala winterhalt, whose innovative approach to music continues to redefine contemporary genres.

    ReplyDelete
  24. Unveiling Sara Tendulkar's Husband: Peel back the layers of secrecy surrounding sara tendulkar husband marital status and uncover the identity of her husband.

    ReplyDelete
  25. Learn about the supportive relationship between Adin adin ross sister, a dynamic duo in their own right.

    ReplyDelete
  26. Thavana Monalisa Fatu: Embark on a journey of discovery with thavana monalisa fatu, where beauty blooms in the most unexpected places. Unravel the intricacies of design and imagination woven into every creation.

    ReplyDelete