Advertisement
DigiDuncan

GlucavaGUI

May 29th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.68 KB | None | 0 0
  1. import javax.swing.*;
  2.  
  3. import BreezySwing.*;
  4.  
  5. @SuppressWarnings({ "unused", "serial", "restriction"}) //Shut up, Eclipse.
  6. public class GlucavaGUI extends GBFrame
  7. {
  8.     //Make GUI objects.
  9.  
  10.     private JLabel          titleLabel;
  11.     private JLabel          sugarLabel;
  12.     private IntegerField    sugarField;
  13.     private JLabel          timeLabel;
  14.     private IntegerField    timeField;
  15.     private JLabel          seperator;
  16.     private JLabel          foodLabel;
  17.     private JTextField      foodField;
  18.     private JButton         addFoodButton;
  19.     private JLabel          currentFoodLabel;
  20.     private JTextArea       currentFoodArea;
  21.     private JButton         calculateButton;
  22.    
  23.     //Constructor
  24.     public GlucavaGUI ()
  25.     {
  26.         //GUI Positioning
  27.         titleLabel          =   addLabel        ("Welcome to Glucava", 1, 1, 5, 1);
  28.         sugarLabel          =   addLabel        ("Current Sugar", 2, 1, 2, 1);
  29.         sugarField          =   addIntegerField (150, 2, 4, 2, 1);
  30.         timeLabel           =   addLabel        ("Time (24h)", 3, 1, 2, 1);
  31.         timeField           =   addIntegerField (0000, 3, 4, 2, 1);
  32.         seperator           =   addLabel        ("", 4, 3, 5, 1);
  33.         foodLabel           =   addLabel        ("Food", 5, 2, 1, 1);
  34.         foodField           =   addTextField    ("", 6, 1, 5, 1);
  35.         addFoodButton       =   addButton       ("Add", 5, 4, 1, 1);
  36.         currentFoodLabel    =   addLabel        ("Current foods added:", 7, 1, 1, 1);
  37.         currentFoodArea     =   addTextArea     ("", 8, 1, 5, 3);
  38.         calculateButton     =   addButton       ("Calculate", 11, 1, 1, 1);
  39.        
  40.        
  41.     }
  42.     public void buttonClicked (JButton buttonObj)
  43.     {
  44.         GlucavaBackbone backbone = new GlucavaBackbone();
  45.        
  46.         if (buttonObj == addFoodButton)
  47.         {
  48.             //TODO Add food stuff.
  49.         }
  50.         else
  51.         {
  52.             //TODO Add calculate stuff.
  53.         }
  54.     }
  55.     public static void main (String [] args)
  56.     {
  57.         GlucavaGUI theGUI = new GlucavaGUI();
  58.         theGUI.setSize (330, 625);
  59.         theGUI.setVisible (true);
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement