Add to Favorites    Make Home Page 20981 Online  
 Language Categories  
 Our Services  

Home » Java Home » GUI Home » GUI with menu

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title GUI with menu
Author aseem
Author Email aseemshrestha [at] hotmail.com
Description Design of simple GUI with menu items

Category Java » GUI
Hits 52394
Code Select and Copy the Code
Code : import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; public class LibGui extends JFrame { private JMenuBar menu; private JMenu m1,m2,m3; private JMenuItem AddNew,Search,Display,Delete,Exit,Modify,Help; private JButton btnAddNew,btnSearch,btnDelete,btnDisplay,btnModify,btnExit; private JPanel pMain,pSouth,pNorth,pCenter; private JTextArea tac; private JLabel lbllogo; public LibGui() { //menu bar and menu item initialization menu = new JMenuBar(); m1 = new JMenu("Options"); m2 = new JMenu("Programs"); m3 = new JMenu("Help"); AddNew = new JMenuItem("AddNew"); Search = new JMenuItem("Search"); Display = new JMenuItem("Display"); Delete = new JMenuItem("Delete"); Modify = new JMenuItem("Modify"); Exit = new JMenuItem("Exit"); Help = new JMenuItem("Help"); //text area initialization tac = new JTextArea(2,3); tac.setText("For: Birgang Institute of Technology"+" "+"Birganj,Parsa"); tac.setForeground(Color.red); tac.setEditable(false); //button intialization btnAddNew = new JButton("ADDNEW"); btnAddNew.setToolTipText("Add new Details"); btnSearch = new JButton("SEARCH"); btnSearch.setToolTipText("Search particular student"); btnDelete = new JButton("DELETE"); btnDelete.setToolTipText("Delete particular student"); btnDisplay = new JButton("DISPLAY"); btnDisplay.setToolTipText("Display particular student"); btnModify = new JButton("MODIFY"); btnModify.setToolTipText("Modifies particular student"); btnExit = new JButton("EXIT"); btnExit.setToolTipText("Out of Program"); //initialization panel pMain = new JPanel(); pNorth = new JPanel(); pSouth = new JPanel(); pCenter = new JPanel(); lbllogo = new JLabel(new ImageIcon("//G:/MFCfinish.gif"),JLabel.CENTER); //add menuitem to menu m1.add(AddNew); m1.add(Search); m1.add(Display); m1.add(Delete); m1.add(Modify); m2.add(Exit); m3.add(Help); menu.add(m1); menu.add(m2); menu.add(m3); pMain.add(btnAddNew); pMain.add(btnSearch); pMain.add(btnDelete); pMain.add(btnDisplay); pMain.add(btnModify); pMain.add(btnExit); pMain.setLayout(new BoxLayout(pMain,BoxLayout.Y_AXIS)); pMain.setBorder(BorderFactory.createTitledBorder("OPTIONS")); pMain.setLayout(new GridLayout(6,1)); pMain.setBackground(Color.white); pCenter.setBackground(Color.red); pCenter.setLayout(new BoxLayout(pMain,BoxLayout.Y_AXIS)); pCenter.setLayout(new GridLayout(2,1)); pCenter.add(lbllogo); pCenter.add(tac); pNorth.setBackground(Color.white); pNorth.add(menu); this.getContentPane().add(pMain,"West"); this.getContentPane().add(pCenter,"Center"); this.getContentPane().add(pNorth,"North"); this.setSize(400,300); this.setResizable(false); this.setLocation(150,150); this.setTitle("MENU"); this.show(); } public static void main() { LibGui lg = new LibGui(); } }

Related Source Codes

Script Name Author
Sending mail Using JavaMail to Yahoo and Gmail accounts sai prasad
Simple Program in Java to Implement Multithreading Satish.K
Simple Calculator in Java Using Remote Method Invocation Satish.K
Guest Book Application Using Servlets Satish.K
String Manipulation Using Stringification Satish.K
String Manipulation Using Stringification Satish.K
Moving Ball Application Using Java Beans Satish.K
Rapid Roll game subrahmanyeswararao
student mgm arpan
Sourav Datta
Download Manager Sagar
Address Book in Java Rahul Chouhan
address book using java database connectivity(jdbc-msaccess) shekhar bansal
sun Steganography B.Rajavel
Connecting Java with MS-Access - Inserting data in Aseem

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions
Copyright ©2003-2017 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=1055


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review