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
|
Java Program To Illustrate Swing Concept ~ Techietopics >>>>> Download Now
ReplyDelete>>>>> Download Full
Java Program To Illustrate Swing Concept ~ Techietopics >>>>> Download LINK
>>>>> Download Now
Java Program To Illustrate Swing Concept ~ Techietopics >>>>> Download Full
>>>>> Download LINK
This comment has been removed by the author.
ReplyDeleteI read your blog its nice i like content its very useful for me
ReplyDeleteI 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
ReplyDeleteWhat a wonderful information it really helps me a lot to understand new things also have a look on this School with best rating.
Thank you for this important information it contains very good knowledge and helps me a lot Best CBSE School in Faridabad
ReplyDeleteThank 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
ReplyDeleteKeep doing this work it is very helpful to me thank you for this blog also check out this one Best IVF Centre In Faridabad
ReplyDeleteThanks a lot for giving us such a helpful information. You can also visit our website for topics for ntcc project
ReplyDeleteBest 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.
ReplyDeleteProvide very useful information. Also read about International boarding schools for girls in India
ReplyDeleteThanks for the creative ideas !!! click here for More Scholar's Forum - Best IIT-JEE and NEET Coaching in Lucknow Thanks.
ReplyDeleteThank You, wholesale cereal
ReplyDeleteThanks for the creative ideas !!! mobile price in bd
ReplyDeleteclick here for More Mobile price
Best digital marketing institute in palam
ReplyDeleteThanks for sharing this Great article Wordpress website development
ReplyDeleteAbsolutely thrilled with the exceptional car care services provided by Active Car Wash!
ReplyDeleteThanks for the creative ideas !!! - B Des Interior Design Colleges in Coimbatore
ReplyDeleteUEEPHONE 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.
ReplyDeleteWhatoop 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.
ReplyDeleteA 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.
ReplyDeletevijay 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.
ReplyDeleteWhile vijay age may be undisclosed, his talent and charisma know no bounds, leaving an indelible mark on the entertainment industry.
ReplyDeletebest 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.
ReplyDeleteAs 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.
ReplyDeleteStand 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.
ReplyDeleteAs 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
ReplyDeletekhan 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.
ReplyDeleteJourney Through valerie sandler Artistic Odyssey: From Clay to Conceptual Excellence
ReplyDeleteUncover the Artistry of keala winterhalt, whose innovative approach to music continues to redefine contemporary genres.
ReplyDeleteUnveiling Sara Tendulkar's Husband: Peel back the layers of secrecy surrounding sara tendulkar husband marital status and uncover the identity of her husband.
ReplyDeleteLearn about the supportive relationship between Adin adin ross sister, a dynamic duo in their own right.
ReplyDeleteThavana 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.
ReplyDeleteThanks for sharing this content
ReplyDeleteTop Electrical Engineering Colleges in Coimbatore
here's a simple Java program that illustrates the Swing concept by creating a basic Swing GUI window:
ReplyDeletejava
Copy code
import javax.swing.*;
public class SwingExample {
public static void main(String[] args) {
// Creating the frame
JFrame frame = new JFrame("Swing Example");
// Setting the width and height of frame
frame.setSize(400, 300);
// Setting the layout for the frame
frame.setLayout(null);
// Creating a label
JLabel label = new JLabel("Hello, Swing!");
// Setting the bounds of the label
label.setBounds(50, 50, 200, 30);
// Adding the label to the frame
frame.add(label);
// Setting the frame visibility to true
frame.setVisible(true);
// Setting default close operation for the frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
This program creates a simple Swing window with a label saying "Hello, Swing!" placed at coordinates (50, 50) within the window. You can further explore Swing by adding components like buttons, text fields, etc., and arranging them using various layout managers provided by Swing.
kamrun seo
Discover endless fun at Club Cabana, the premier amusement park in Bangalore! Enjoy thrilling rides, relaxing water features, and family-friendly activities. Book your adventure today!
ReplyDeleteLev Cameron, a multifaceted talent, captivates audiences with his dynamic presence both on and off the screen. With a magnetic charm and undeniable charisma, lev cameron has established himself as a force to be reckoned with in the entertainment industry. From his early days as a competitive dancer to his rise as a social media sensation, Lev's journey has been nothing short of extraordinary. Whether he's dazzling viewers with his impeccable dance moves or inspiring them with his genuine personality, Lev Cameron continues to leave an indelible mark on the hearts of millions worldwide.
ReplyDeleteLooking for Wireless Keyboard And Mouse Combo? Buy the best Keyboard and Mouse Sets Online and grab ongoing discounts both online and offline. Get top-quality sets at unbeatable prices. To know more, visit us!
ReplyDeleteAre you looking for Drawing Room Furniture in Delhi? We offer the best drawing room design in Delhi, providing custom interior design and decoration services to create the perfect space for your home.
ReplyDeleteNice Blog, thank you so much for sharing this informative blog.
ReplyDeletetesting-tools-training-in-hyderabad
Stand up pouch Manufacturer are flexible and lightweight, which makes them more cost-effective to transport and store compared
ReplyDeleteNeil And Roo offers premium baby socks for boys in the UK, created to remain set up and give greatest comfort the entire day. baby socks for boys in uk
ReplyDeleteThanks for sharing
ReplyDeletejava-full-stack-developer