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();
         }
       });
 }
Esempio n. 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();
         }
       });
 }
  public static void createCanvas(String appClass) {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);

    try {
      Class<? extends Application> clazz = (Class<? extends Application>) Class.forName(appClass);
      app = clazz.newInstance();
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
    } catch (InstantiationException ex) {
      ex.printStackTrace();
    } catch (IllegalAccessException ex) {
      ex.printStackTrace();
    }

    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas();

    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
  }
Esempio n. 4
0
 void btnChangeServer_actionPerformed(ActionEvent e) {
   setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   JID temp = null;
   try {
     temp = JID.checkedJIDFromString(txtServer.getText());
   } catch (InstantiationException ex) {
     nu.fw.jeti.util.Popups.errorPopup(ex.getMessage(), I18N.gettext("main.error.invalid_server"));
   }
   if (temp == null) return;
   server = temp;
   backend.getItems(server, this);
 }
Esempio n. 5
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();
            }
          }
        });
  }
Esempio n. 6
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");
  }
Esempio n. 7
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();
  }
  /**
   * Creates an iterator that returns an {@link Options} containing each possible parameter set
   * defined by these {@link
   * com.biomatters.plugins.barcoding.validator.research.options.BatchOptions}. Note that the {@link
   * Options} object returned is always the same to save on initializing multiple copies. Each time
   * {@link java.util.Iterator#next()} is called the next parameter set is set on the {@link
   * Options}.
   *
   * @return An iterator that will iterate over all possible parameter sets specified by this {@link
   *     com.biomatters.plugins.barcoding.validator.research.options.BatchOptions}
   * @throws DocumentOperationException if there is a problem creating the {@link Options} object
   */
  public Iterator<T> iterator() throws DocumentOperationException {
    List<Set<OptionToSet>> possibleValues = new ArrayList<Set<OptionToSet>>();

    Map<String, MultiValueOption<?>> multiValueOptions = getMultiValueOptions("", options);
    for (Map.Entry<String, MultiValueOption<?>> entry : multiValueOptions.entrySet()) {
      possibleValues.add(getOptionsToSet(entry.getKey(), entry.getValue()));
    }
    Set<List<OptionToSet>> lists = Sets.cartesianProduct(possibleValues);
    final Iterator<List<OptionToSet>> possibilityIterator = lists.iterator();

    final T template;
    try {
      //noinspection unchecked
      template = (T) options.getClass().newInstance(); // getClass() doesn't return Class<T> :(
      template.valuesFromXML(options.valuesToXML(XMLSerializable.ROOT_ELEMENT_NAME));
    } catch (InstantiationException e) {
      throw new DocumentOperationException("Failed to create Options: " + e.getMessage(), e);
    } catch (IllegalAccessException e) {
      throw new DocumentOperationException("Failed to create Options: " + e.getMessage(), e);
    }

    return new Iterator<T>() {
      @Override
      public boolean hasNext() {
        return possibilityIterator.hasNext();
      }

      @Override
      public T next() {
        List<OptionToSet> possibility = possibilityIterator.next();
        for (OptionToSet optionToSet : possibility) {
          template.setValue(optionToSet.name, optionToSet.value);
        }
        return template;
      }

      @Override
      public void remove() {
        new UnsupportedOperationException();
      }
    };
  }
Esempio n. 9
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();
          }
        });
  }
Esempio n. 10
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();
    }
  }
Esempio n. 11
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();
    }
  }
Esempio n. 12
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);
  }