swing - GUI and MVC in Java -


I'm currently building a system that orders for snacks that the system has a GUI interface, in which There is an application code stored in a model package. So Ive done the main windows and it consists of three radio buttons and a sales button. So the radio buttons are "men", "sid", "drinks", I have the problem, how do I code the action listener for each button in the model package? What i have it

  import java.text *; Import java.util. *; Import model *; Import java.awt. *; Import java.awt.event. *; Import javax.swing *; Import javax.swing.event. *; Public Square LeftPanel Extended JPanel {Private Button Group Group = New Button Group (); Private string group name; Public Left (Group Group) {Setup (); Construction (); } Private zero setup () {setLayout (new grid layout (3,1)); } Private Zero Build () {box box = box.centrector box (); Box.add (Box.createHorizontalStrut (65)); Plus (button ("main", new message listener ()); Add (Button ("Side", New Bytes Listener ()); Add (button ("drink", new drinking water ()); } Private Jeremy Button Button (String S, Action Listener Listener) {JRDO Button Button = New JRDO Button; Button.addActionListener (listener); Group.add (button); Return button; } Private class manes listener executioner (Public Zero ActionPerfed (Action Event E) {groupName = e.getActionCommand ()) applies; Group Group = Group. Group (group name); New Stockwindows (Group); }} Private SidesListener Apply ActionListener {Public Zero Functionality (ActionEvent e) {groupName = e.getActionCommand (); Group Group = Group. Group (group name); New Stockwindows (Group); }} Applies to private class Drink Listener Performanceist {Public Zero Action Perfid (Action Avenue) {groupName = e.getActionCommand (); Group Group = Group. Group (group name); New Stockwindows (Group); }}}  

The group is in the package package that reads the stock

  package model; Import java.util. *; Viewable public square groups {Private Linkedlists & lt; Groups & gt; Groups = new linked list & lt; Groups & gt; (); Public group () {group group = new group ("main"); Group.add (new snack ("burger")); Group.add (new snack ("wrap")); Groups.add (group); Group = new group ("side"); Group.add (new snack ("fries")); Group.add (new snack ("muffin")); Group.add (new snack ("hash brush")); Groups.add (group); Group = new group ("drink"); Group.add (new snack ("coke")); Group.add (new snack ("coffee")); Group.add (new snack ("sloppy")); Group.add (new snack ("tea")); Group.add (new snack ("juice"); Groups.add (group); } Public Linkedist & lt; Groups & gt; Group () {returns group; }}  


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -