public static void main(String[] args) {
   /*use an appropriate look and feel*/
   try {
     /*
     	UImanager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     	UImanager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
     */
     UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
   } catch (UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   } catch (IllegalAccessException ex) {
     ex.printStackTrace();
   } catch (InstantiationException ex) {
     ex.printStackTrace();
   } catch (ClassNotFoundException ex) {
     ex.printStackTrace();
   }
   /*turn off metal's use of bold fonts*/
   UIManager.put("swing.boldMetal", Boolean.FALSE);
   /*
   	Schedule a job for the event dispatch thread
   	creating and showing this application's GUI
   */
   javax.swing.SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           createAndShowGUI();
         }
       });
 }
Example #2
0
 public static void main(String[] args) {
   /* Use an appropriate Look and Feel */
   try {
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
   } catch (UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   } catch (IllegalAccessException ex) {
     ex.printStackTrace();
   } catch (InstantiationException ex) {
     ex.printStackTrace();
   } catch (ClassNotFoundException ex) {
     ex.printStackTrace();
   }
   /* Turn off metal's use of bold fonts */
   UIManager.put("swing.boldMetal", Boolean.FALSE);
   // Schedule a job for the event-dispatching thread:
   // adding TrayIcon.
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           weather = new Wetter();
           createAndShowGUI();
         }
       });
 }
Example #3
0
  public UpdateAssetGUI() {
    try {
      PluginMgrClient.init();
      mclient = new MasterMgrClient();
      queue = new QueueMgrClient();
      plug = PluginMgrClient.getInstance();
      log = LogMgr.getInstance();

      pAssetManager = new TreeMap<String, AssetInfo>();

      project = "lr";
      charList = new TreeMap<String, String>();
      setsList = new TreeMap<String, String>();
      propsList = new TreeMap<String, String>();

      potentialUpdates = new TreeSet<String>();
      pSubstituteFields = new TreeMap<String, LinkedList<JBooleanField>>();

      /* load the look-and-feel */
      {
        try {
          SynthLookAndFeel synth = new SynthLookAndFeel();
          synth.load(
              LookAndFeelLoader.class.getResourceAsStream("synth.xml"), LookAndFeelLoader.class);
          UIManager.setLookAndFeel(synth);
        } catch (java.text.ParseException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to parse the look-and-feel XML file (synth.xml):\n" + "  " + ex.getMessage());
          System.exit(1);
        } catch (UnsupportedLookAndFeelException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to load the Pipeline look-and-feel:\n" + "  " + ex.getMessage());
          System.exit(1);
        }
      }

      /* application wide UI settings */
      {
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
        ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
      }
    } catch (PipelineException ex) {
      ex.printStackTrace();
    } // end try/catch
  } // end constructor
Example #4
0
  /** Launch the application. */
  public static void main(String[] args) {
    giorniArray = new String[31];
    anniArray = new String[50];
    oreArray = new String[24];
    minutiArray = new String[60];

    for (int i = 1; i < 32; i++) {
      giorniArray[i - 1] = Integer.toString(i);
    }

    int j = 0;
    for (int i = 2000; i < 2050; i++) {
      anniArray[j++] = Integer.toString(i);
    }

    for (int i = 0; i < 60; i++) {
      minutiArray[i] = Integer.toString(i);
    }

    for (int i = 0; i < 24; i++) {
      oreArray[i] = Integer.toString(i);
    }

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }
    EventQueue.invokeLater(
        new Runnable() {
          public void run() {
            try {
              FrontEnd1 window = new FrontEnd1();
              window.frame.setVisible(true);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
  }
Example #5
0
  public static void newIDEWindow() {

    try {
      System.getProperty("com.apple.laf.useScreenMenuBar", "true");
      System.getProperty("com.apple.mrj.application.apple.menu.about.name", "IDE");
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());

    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }
    new IDEWindow("IDE");
  }
Example #6
0
  /** @param args */
  public static void main(final String[] args) {

    try {
      Properties props = new Properties();
      props.put("logoString", "");
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e1) {
      e1.printStackTrace();
    } catch (InstantiationException e1) {
      e1.printStackTrace();
    } catch (IllegalAccessException e1) {
      e1.printStackTrace();
    } catch (UnsupportedLookAndFeelException e1) {
      e1.printStackTrace();
    }

    PhysicsUI pui = new PhysicsUI();
    pui.init();
  }
Example #7
0
  public static void main(String[] arguments) {
    // Schedule a job for the event dispatch thread:
    // creating and showing this application's GUI.

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
    } catch (IllegalAccessException ex) {
      ex.printStackTrace();
    } catch (InstantiationException ex) {
      ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
    }

    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            createAndShowGUI();
          }
        });
  }
Example #8
0
  private static void initUserInterface() {
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Draw 9-patch");
    try {
      if (Platform.isWindows()) {
        UIManager.put("RootPane.setupButtonVisible", false);
        BeautyEyeLNFHelper.translucencyAtFrameInactive = false;
        BeautyEyeLNFHelper.launchBeautyEyeLNF();

        // impl a demo PopupFactory
        PopupFactory.setSharedInstance(new CoolPopupFactory());
      } else UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #9
0
  public ReverseFlashCard() {
    // basic init
    setTitle("WayMemo -Reverse Flash Card Mode");
    this.setSize(800, 600);
    paneCenter = new JPanel(new GridLayout(7, 1));

    add(ln, "North");
    add(paneCenter, "Center");
    add(b2, "West");
    add(bReset, "South");
    add(b1, "East");
    paneCenter.add(l1);
    paneCenter.add(l2);
    paneCenter.add(l3);
    paneCenter.add(l4);
    paneCenter.add(l5);
    paneCenter.add(b3);
    paneCenter.add(pMark);
    pMark.add(bMark);
    pMark.add(bUnMark);
    pMark.add(lt);

    // text area init

    Utility.initTextAreaView(l1);
    Utility.initTextAreaView(l2);
    Utility.initTextAreaView(l3);
    Utility.initTextAreaView(l4);
    Utility.initTextAreaView(l5);

    // action

    //
    Action actionNext =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            num++;
            wordDisplay();
          }
        };
    b1.getInputMap().put(KeyStroke.getKeyStroke("C"), "pressed");
    b1.getActionMap().put("released", actionNext);
    //
    Action actionBack =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            num--;
            wordDisplay();
          }
        };
    b2.getInputMap().put(KeyStroke.getKeyStroke("Z"), "pressed");
    b2.getActionMap().put("released", actionBack);
    //
    Action actionShow =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            l1.setText(dtr[num]);
            l3.setText(d2[num]);
            l4.setText(d3[num]);
            l5.setText(d4[num]);
          }
        };
    b3.getInputMap().put(KeyStroke.getKeyStroke("X"), "pressed");
    b3.getActionMap().put("released", actionShow);
    //
    //
    Action actionMark =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            d1[num] = "[MARKED*]" + d1[num];
            l2.setText(d1[num]);
          }
        };
    bMark.getInputMap().put(KeyStroke.getKeyStroke("S"), "pressed");
    bMark.getActionMap().put("released", actionMark);
    //
    //
    //
    Action actionUnmark =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            d1[num] = od1[num];
            l2.setText(d1[num]);
          }
        };
    bUnMark.getInputMap().put(KeyStroke.getKeyStroke("F2"), "pressed");
    bUnMark.getActionMap().put("released", actionUnmark);
    //
    //
    Action actionReset =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            num = 0;
            wordDisplay();
          }
        };
    bReset.getInputMap().put(KeyStroke.getKeyStroke("r"), "pressed");
    bReset.getActionMap().put("released", actionReset);
    //
    //
    b1.setMnemonic(KeyEvent.VK_C);
    b2.setMnemonic(KeyEvent.VK_Z);
    b3.setMnemonic(KeyEvent.VK_X);
    bMark.setMnemonic(KeyEvent.VK_S);
    bUnMark.setMnemonic(KeyEvent.VK_D);
    bReset.setMnemonic(KeyEvent.VK_R);

    b1.addActionListener(actionNext);
    b2.addActionListener(actionBack);
    b3.addActionListener(actionShow);
    bReset.addActionListener(actionReset);
    bMark.addActionListener(actionMark);
    bUnMark.addActionListener(actionUnmark);
    //
    //
    try {
      this.fileScan(new OpenFileDTR().getPathDTR());
    } catch (IOException e) {
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (InstantiationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #10
0
  public Atm() // constructor
        // sets the customer array to that found in the file if the file exists
      {
    try {
      // Set cross-platform Java L&F (also called "Metal")
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    }

    if (logFile.exists()) {
      try {
        adminLogs = returnLog("p2.log");
        if (!adminLogs.isEmpty()) {
          // there may be customer data but perhaps no transactions yet.
          ArrayList<Integer> allTransactions = new ArrayList<>(100);
          for (AdminLog a : adminLogs) {

            int transaction = a.getTransactionID();
            ;
            allTransactions.add(transaction);
          }
          transaction_counter = Collections.max(allTransactions) + 1;
        }
      } catch (ClassNotFoundException | IOException e) {
        e.printStackTrace();
      }
    }

    if (DBfile.exists()) {
      try {

        cust = returnSavedData("p2.dat");

        // sets the starting ID to the max of all the IDs stored in the file.
        allIDs = new ArrayList<Integer>(100);
        ArrayList<Integer> allAccounts = new ArrayList<>();
        for (Customer customer : cust) {
          String idString = customer.returnID();
          int id = Integer.parseInt(idString);
          allIDs.add(id);
          int accountNumber = customer.returnMaxAccount();
          allAccounts.add(accountNumber);
        }
        // checks to see if the customer has even made any accounts, if not, max accounts will be
        // set at 1001
        if (starting_account_number != 1) {
          starting_account_number = Collections.max(allAccounts) + 1;
        }
        starting_customer_number = Collections.max(allIDs) + 1;

      } catch (ClassNotFoundException | IOException e) {
        e.printStackTrace();
      }
    } else {
      cust = new ArrayList<>(100);
      // creates the file if it does not exist
      try {
        saveFile(cust, DBfile);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    interest_rate = 5;
  }
Example #11
0
  /** Set up the GUI. */
  private void initialize() {
    frame = new JFrame("Email client");
    frame.setBounds(100, 100, 552, 448);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    // Make the UI look like that of Windows, Java default is ugly.
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }

    SwingUtilities.updateComponentTreeUI(frame);

    // Inbox button, made to refresh the emails and reload if new ones came in.
    JButton btnInbox = new JButton("Inbox");
    btnInbox.setFont(new Font("Consolas", Font.PLAIN, 11));
    btnInbox.setBounds(25, 43, 89, 23);
    frame.getContentPane().add(btnInbox);

    // Compose button, opens the compose an email UI
    JButton btnComposse = new JButton("Compose");
    btnComposse.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Compose.run();
          }
        });
    btnComposse.setFont(new Font("Consolas", Font.PLAIN, 11));
    btnComposse.setBounds(160, 43, 89, 23);
    frame.getContentPane().add(btnComposse);

    // Junk button, made to show your emails in the junk folder
    JButton btnJunk = new JButton("Junk");
    btnJunk.setFont(new Font("Consolas", Font.PLAIN, 11));
    btnJunk.setBounds(289, 43, 89, 23);
    frame.getContentPane().add(btnJunk);

    // Used to show the emails that you have sent
    JButton btnSent = new JButton("Sent");
    btnSent.setFont(new Font("Consolas", Font.PLAIN, 11));
    btnSent.setBounds(420, 43, 89, 23);
    frame.getContentPane().add(btnSent);

    /*
     * Displays the name of the user at the top of UI,
     * was planning on having another dialog box to enter email
     * address so it would work with every gmail account that
     * doesn't have 2-step verification.
     */
    JLabel lblEmails = new JLabel(Main.username + " emails");
    lblEmails.setFont(new Font("Consolas", Font.PLAIN, 11));
    lblEmails.setHorizontalAlignment(SwingConstants.CENTER);
    lblEmails.setBounds(10, 11, 516, 14);
    frame.getContentPane().add(lblEmails);

    // Makes the inbox scrollable if there are to many emails to view.
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(25, 77, 484, 310);
    frame.getContentPane().add(scrollPane);

    // Main table where all the emails are viewed.
    table = new JTable();
    // If there are no emails to view then have a label in the middle, rather than looking like
    // somethings broke.
    if (main.messageCount == 0) {
      JLabel label = new JLabel("No emails :(");
      label.setFont(new Font("Consolas", Font.PLAIN, 11));
      label.setHorizontalAlignment(SwingConstants.CENTER);
      label.setBounds(170, 200, 200, 100);
      frame.getContentPane().add(label);
    } else // If not then gather all the data, it gets stored in a 2D array based on what I want and
           // where I want it.
    {
      String[] nameTheColoumns = {"Sender", "Subject", "Date", "Read?"};

      String[][] data = new String[main.messageCount][nameTheColoumns.length];
      for (int i = 0; i < main.messageCount; i++) {
        String subject = main.subjects.get(i);
        String sender = main.senders.get(i);
        String date = main.dates.get(i);
        String read = main.seen.get(i).toString();
        String[] details = {sender, subject, date, read};

        data[i] = details;
      }
      // Now we can fill the table with the data and the coloumn names.
      table.setModel(new DefaultTableModel(data, nameTheColoumns));
    }
    scrollPane.setViewportView(table);
  }