domingo, 22 de septiembre de 2013

Menús Con Java Swing

Ya vimos los componentes atómicos y los componentes de Texto, ahora es el turno para conocer los componentes de Menús que nos provee Java Swing...

Seguiremos con la estructura de los últimos artículos, veremos unas definiciones generales y al final se presentará una aplicación de ejemplo usando estos componentes.


Que Son?

Todos debemos conocer lo que es un Menú, los que estamos en este campo a diario debemos interactuar con algún tipo de menú que nos brinda opciones que queremos realizar, un editor de texto, una ventana, un navegador etc, todos deben tener un Menú desde el cual administrar nuestro sistema....

Cuales Son?

Java Swing nos provee ciertos componentes para crear una barra de Menú, en ella podemos combinar diferentes elementos con un mismo fin, proveer las opciones necesarias para trabajar con el sistema....Veamos

JMenuBar.
Es el elemento principal cuando vamos a crear menús, ya que provee la barra donde se alojaran cada uno de los items u opciones deseadas.
barraMenu = new JMenuBar();
barraMenu.add(menuArchivo);
setJMenuBar(barraMenu);

JMenu.
Si bien el elemento anterior permite crear una Barra donde alojar el resto de componentes, el JMenu es quien contiene dichos componentes, a este se le agregan el resto de opciones, podemos asociarlo con un contenedor el cual aloja otros elementos como botones, etiquetas, campos entre otros...... el JMenu permite agregar los elementos o items correspondientes, así como otros JMenus.....
menuArchivo = new JMenu();
menuArchivo.add(menuItemNuevo);   
menuArchivo.addSeparator();

JMenuItem.
Representan Items u opciones del menú, cuando creamos un JMenu decimos que tipo de opciones puede contener y al crear un JMenuItem decimos cuales son las opciones para ese menú en especifico, por ejemplo el Menú "Archivo", contendrá los items "Abrir", "Guardar", "Nuevo", "Principal", etc....
menuItemNuevo = new JMenuItem();
menuItemNuevo.setText("Nuevo");
menuArchivo.add(menuItemNuevo); 


JCheckBoxMenuItem.
Este compontes es otro item que almacena el JMenu, permite vincular casillas de  verificación o Checkbox, muy útil cuando vamos a parametrizar mas de una opción o característica de nuestro sistema...
jCheckMenu1 = new JCheckBoxMenuItem("Check1");
menuOpciones.add(jCheckMenu1);

JRadioButtonMenuItem.
Este componente es similar al anterior, la diferencia es que permite vincular  componentes RadioButton los cuales brindan opciones de selección única, por ejemplo si en un editor de texto queremos un único tipo de letra, podemos usar este componente....
jRadioButtonMenu1 = new JRadioButtonMenuItem("Radio1");
grupoRadios.add(jRadioButtonMenu1);
menuOpciones.add(jRadioButtonMenu1);

JPopupMenu.
Por ultimo tenemos el JPopupMenu, a diferencia de los anteriores, este componente no es contenido en la Barra de Menú, sino que se asocia al contenedor principal que para nuestro ejemplo es un JPanel (del cual hablaremos en el siguiente articulo), permite brindar opciones emergentes o popup con tan solo dar click derecho sobre algún área del panel....... el JPopup funciona también como un contenedor similar al JMenu....
menuEmergente = new JPopupMenu();
itemEmergente1.setText("Opcion Emergente 1");
menuEmergente.add(itemEmergente1)


El Ejemplo.

En este ejemplo agrupamos los componentes anteriores, la única función es dar a conocer lo básico de estos elementos.


Nuevamente resalto el hecho de que se brinda una idea general de cada componente, mas no un ejemplo a profundidad, eso lo dejamos para próximas entradas.....

Descarga.

Como es costumbre en el enlace de descarga se encuentra el archivo .rar con la aplicación, solo es cuestión de descomprimir y abrir con Eclipse pero si usas NetBeans te interesará esta entrada con un vídeo paso a paso de como abrirlo en el.......... recuerden que es gratis, nada cuesta opinar, compartir o agradecer :)



También te podría Interesar.


¿Hay algo que quieras anexar o comentar sobre esta entrada?  no dudes en hacerlo.....y si te gustó...... te invito a compartir
 y Suscribirte ingresando al botón "Participar en este sitio" para darte cuenta de mas entradas como esta ;)

63 comentarios:

  1. Hola, muy buena información, tengo una duda. Sabes como asignar una tecla o combinación de estas a un elemento del menú como en la primera imagen de esta publicación?

    ResponderEliminar
    Respuestas
    1. Hola Si señor......... se me pasó ponerla pero es muy simple, agrega esta linea al codigo y listo, le asigno el Ctrl+N al item Nuevo. si te sirve me avisas ;)

      menuItemNuevo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));

      Eliminar
  2. lo tome para guiarme , gracias!

    ResponderEliminar
  3. Felicidades por tu trabajo

    ResponderEliminar
  4. como se puede poner el codigo para guardar

    ResponderEliminar
    Respuestas
    1. Hola, no te entiendo, necesitas el codigo fuente, guardar archivos, datos de un formulario etc, cualquier cosa me comentas

      Eliminar
  5. se refiere ah que es si queremos guardar un archivo , como seria el codigo de ahi.

    ResponderEliminar
    Respuestas
    1. Hola, podrian utilizar el JFileChooser en alguno de los eventos del Menù, sea en un item o donde quieran......esta entrada les puede servir ;)
      http://codejavu.blogspot.com/2013/11/ejemplo-jfilechooser.html

      Eliminar
  6. hola buen dia cristian muy buen trabajo vengo mirando esta pagina hace mese me parece estupendo su trabajo me encantaría si me pudiera dar una idea de como hacer que un formulario se pueda abrir en diferentes pestañas le agradecería mucho tengo algo semejante pero no queda como quiero espero me puedas ayudar espero tenga buen dia

    ResponderEliminar
  7. muy buena información, muchas gracias por compartir tu buenos conocimientos,,....

    ResponderEliminar
  8. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing.
    Azure Training Classes

    ResponderEliminar
  9. And along side support for QuickBooks Customer Support Number, it is less difficult to handle most of the tools of QuickBooks in a hassle-free manner. Below is a summary of several QuickBooks errors that one may meet with if you are using it. Have a glimpse at it quickly.

    ResponderEliminar
  10. Creating a set-up checklist for payment both in desktop & online versions is a vital task that needs to be shown to every QuickBooks user. Hope, you liked your internet site. If any method or technology you can not understand, if that's the case your better option is which will make call us at our Quickbooks Payroll Support Phone Number.

    ResponderEliminar
  11. QuickBooks users are often found in situations where they have to face many of the performance and some other errors due to various causes in their computer system. If you need any help for QuickBooks errors from customer service to get the solution to these errors and problems, you can easily contact with Intuit QuickBooks Support Number and get instant help with the guidance of our technical experts.

    ResponderEliminar
  12. So, there is absolutely no point in wasting your time and effort, getting worried for the problem you are facing an such like. Just call and you'll get instant respite from the difficulty due to various QuickBooks Customer Support Number.

    ResponderEliminar
  13. QuickBooks Support Number have trained staff to soft your issue. Sometimes errors may possibly also happen as a result of some small mistakes. Those are decimals, comma, backspace, etc. Are you proceed through to handle this? Until you, we've been here that can help you.

    ResponderEliminar
  14. all at one place. Are QuickBooks Enterprise Tech Support errors troubling you? Are you completely fed up with freezing of QuickBooks? If yes, afterward you have browsed off to the right place.

    ResponderEliminar
  15. Every user can get 24/7 support services with our online technical experts using Quickbooks Support. When you’re stuck in a situation where you can’t find a way to get rid of an issue, all you need is to dial QuickBooks customer support phone number. Be patient; they will inevitably and instantly solve your queries.

    ResponderEliminar
  16. immediately at our QuickBook Support phone Number QuickBooks technical help is present at our dial this and gets your solution from our technical experts.

    ResponderEliminar
  17. At QuickBooks Technical Support Number, you will find solution every single issue that bothers your projects and creates hindrance in running your company smoothly.

    ResponderEliminar
  18. QuickBooks Enterprise Tech Support Phone Number enables you to manage your company operations by getting you the latest versions of QuickBooks Enterprise like QuickBooks Enterprise 2019. Just dial QuickBooks Enterprise number to know the advantages and cons of accounting software with the help of our QuickBooks tech support members.

    ResponderEliminar
  19. QuickBooks Technical Support Number understand your growing business need and that is the reason we provide only the best. We make sure to give worth of each penny by providing the customer friendly technical support services.

    ResponderEliminar
  20. To experience an amount of expertise in payroll management through QuickBooks, all of us tries to boost your understanding of the payroll updates occurring in QuickBooks Support, desktop, pro, premier 2019 versions. Intuit Payroll Online exports all the transactions to QuickBooks Desktop App along with QuickBooks Payroll Support Contact Number as standalone software.

    ResponderEliminar
  21. QuickBooks Support Number For Business All the above has a specific use. People working with accounts, transaction, banking transaction need our service. Some people are employing excel sheets for a few calculations.

    ResponderEliminar
  22. Well! If you’re not in a position to customize employee payroll in QuickBooks Payroll Support Number while making the list optimally, in QB and QB desktop, then browse the description ahead.

    ResponderEliminar
  23. QuickBooks 6000 series, QuickBooks PS series square measure a number of the foremost common and then the most dangerous errors that our Users need to face. therein case, they ought to forthwith dial the fee QuickBooks Support Phone Number.

    ResponderEliminar
  24. Professional Services: there are many other services where accounting could be the core part of the complete business functioning. QuickBooks Enterprise Tech Support Number has something for that as well.

    ResponderEliminar
  25. Everbody knows you will find always two sides to a coin and QuickBooks Support is not any different. This software also throws some errors over time. Sometimes it becomes rather difficult to know this might be with this error code or message.

    ResponderEliminar
  26. By usingQuickBooks Payroll Tech Support number, you're able to create employee payment on time. However in any case, you might be facing some problem when making use of QuickBooks payroll such as for instance issue during installation, data integration error, direct deposit issue, file taxes, and paychecks errors, installation or up-gradation or simply just about some other than you don’t panic, we provide quality QuickBooks Payroll help service. Here are some features handle by our QB online payroll service.

    ResponderEliminar
  27. Entering your details each time you make any transaction takes your time and in addition opens windows of committing mistake specially when you're in hurry and so this amazing property of QuickBooks Support Phone Number helps to make your work easy.

    ResponderEliminar
  28. Amended income tracker, pinned notes, better registration process and understandings on homepage are the large choice of general alterations for several versions of QuickBooks 2015. It can benefit for QuickBooks Enterprise Contact Phone Number to acquire technical help & support for QuickBooks.

    ResponderEliminar
  29. QuickBook Tech Support research team is always prepared beforehand because of the most suitable solutions which can be of good help and less time intensive. Their pre-preparedness helps them extend their hundred percent support to all or any the entrepreneurs as well as individual users of QuickBooks.

    ResponderEliminar
  30. Sometimes you don't forecast the precise budget. We've got experienced people to offer the figure. We're going to also provide you with the figure of your respective budget which you can be in the near future from now. This is only possible with QuickBooks Tech Support Number

    ResponderEliminar
  31. The application offers convenient features including Advanced inventory management, Advanced pricing points, Advanced reporting and an enhanced QuickBooks Enterprise Tech Support Phone Number mechanism to help you keep track of employee salaries with ease.

    ResponderEliminar
  32. QuickBooks is obviously a delightful and well-known name because of its 100% accuracy, certainty, and reliability. So that as we all know that QuickBooks Support Phone Number has its own great features and QuickBooks scan manager is just one of the amazing top features of QuickBooks to simply maintain your all documents.

    ResponderEliminar
  33. QuickBooks Customer Technical Support Phone Number Services provide solutions to your entire QuickBooks problem as well as assists in identifying the errors with QuickBooks data files and diagnose them thoroughly before resolving these issues.

    ResponderEliminar
  34. For all associated with the small or mid-sized businesses organizations, it will always be been the most challenging task to easily manage the QuickBooks Support Number business accounts in an effective and genuine way simply by finding the appropriate solutions.

    ResponderEliminar
  35. Why don't we show you in partitioning most of the QuickBooks errors by dialing the Intuit QuickBooks Support for any technical problem that you’re facing whereas victimization the code. Your final decision is used in a team of QuickBooks specialists WHO square measure extremely skillful and also have many years of expertise. they’ll resolve the errors fleetly and locate you back in business in no time.

    ResponderEliminar
  36. The probabilities are that this dilemma arises since the print head has been clogged by dried ink, or this hasn’t been cleaned up for many years. Hence, to solve HP printer print head problems, the consumer can go directly to the HP Printer Support Number option stating Control Panel – Device service -Clean Print head.

    ResponderEliminar
  37. HP inkjet printers are one of the most reliable and well known printers in the world that helps the HP Inkjet Printer Support Number users to print good quality documents. Hp inkjet printers are user compatible , easy to use.

    ResponderEliminar
  38. The principal intent behind QuickBooks Phone Number is to provide the technical help 24*7 so as in order to avoid wasting your productivity hours. This is completely a toll-free QuickBooks client Service variety that you won’t pay any call charges. Of course, QuickBooks is one among the list of awesome package in the company world. The accounting part of the many companies varies according to this package. You'll find so many fields it covers like creating invoices, managing taxes, managing payroll etc. However exceptions are typical over, sometimes it generates the down sides and user wants QuickBooks client Service help.

    ResponderEliminar
  39. QuickBooks Payroll Support Phone Number helps you to definitely resolve your entire technical and functional issues while looking after this well known extensive, premium and end-to-end business accounting and payroll management software. Our experts team at QuickBooks payroll support number is going to make you realize its advanced functions and assists anyone to lift up your business growth.

    ResponderEliminar
  40. Our instantly QuickBooks Support team is perfect in taking down every QuickBooks error. We can assure you this with an assurance. Call our QuickBooks Support telephone number. Our QuickBooks Tech Support Phone Number team will attend you.

    ResponderEliminar
  41. We have customer care executives which are exceptionally supportive and pay complete awareness of the demand of technical assistance made by QuickBooks Technical Support Phone Number users.

    ResponderEliminar
  42. In this web site, we are going to enable you to experience to make and place up the checklist for employee payment. To get more enhanced results and optimized benefits, you are able to take the assistance of experts making a call at QuickBooks Payroll Support Phone Number.

    ResponderEliminar
  43. Any QuickBooks user faces any sort of identified errors in their daily accounting routine; these errors can differ in one another to a sizable degree, so our dedicated QuickBooks Support Number are very well designed with their tools and expertise to produce most effective resolutions very quickly to the customers.

    ResponderEliminar
  44. QuickBooks Payroll Tech Support Number is assisted by our customer support specialists who answr fully your call instantly and resolve all of your issues at that moment. It is a backing portal that authenticates the users of QuickBooks to perform its services in a user-friendly manner.

    ResponderEliminar
  45. The QuickBooks Support Number stays top-notch because the technicians who will be going to cope with your queries are trained to what you need and versatile with regards to taking quick decisions that can instantly solve the reported error.

    ResponderEliminar

  46. QuickBooks Error 6000 832? What is it & How it occurs?! Call Quickbooks tech support number 1-888-238-7409 for resolution. Visit us:- https://www.enetquickbookenterprise.com/quickbooks-error-6000-832/

    ResponderEliminar
  47. Such an amazing stuff! Keep going like this and I hope you will reach your goal. Besides, if you want an accounting software that can handle all the task related to accounting with ease then go for QuickBooks. Moreover, there is a great support available in the form QuickBooks Helpline Number 1-855-907-0605. Read More: https://dentalphonenumber.com/quickbooks-helpline-number/

    ResponderEliminar
  48. QuickBooks users might face technical issues but they can resolve them shortly, with the help of brilliant executives. They can report all queries and problems to customer care executives. The squad would provide meaningful solutions to its users at QuickBooks Support Phone Number +1-844-232-O2O2.read more:-https://tinyurl.com/y42ywocq
    & visi us:-https://jamessmithsu.wixsite.com/quickbookssupport

    ResponderEliminar
  49. If you get any technical glitch in the software, get reliable assistance via QuickBooks Customer Service Phone Number 1-833-780-0086. It is quite common to observe technical issues in the software, resolve it by giving a call on the QuickBooks Service. For More Visit: https://g.page/quickbookssupporttexas

    ResponderEliminar
  50. Este comentario ha sido eliminado por el autor.

    ResponderEliminar
  51. Organization diagnostics apparatus and information harm fixing device are both coordinated with the Quickbooks file doctor. In this blog, we will examine all that you need to think about this device when you're a QuickBooks client.

    ResponderEliminar
  52. Hopefully, Quicbooks Error 103& 310 is now fixed! For better assistance in resolving Quickbooks error 103&310, contact QBSsolved at 1-888-910-1619

    ResponderEliminar
  53. That is great article from you , this is very informative stuff . Hope more articles from you . I also want to share some information about Quickbooks Won't open.

    ResponderEliminar
  54. Smart move for your career is Choosing to do Oracle Course in Chennai at Infycle!! Do you know why this name is chosen for Infycle. Infycle where the place we offered Infinity of Oracle.
    Yes!!! But not only Oracle, More than 20+ courses are offered here 5000+ students are placed in top MNC’s Company with good salary packages. For admission 7502633633.

    ResponderEliminar

Eres libre de realizar cualquier comentario, desde que pueda ayudar con gusto lo atenderé, y si es un critica, bienvenida sea!!!