Beispiel #1
0
  public static void main(String[] args) {

    try {
      // myFrame.add(newSubPanel);

      JTabbedPane tabbedPane = new JTabbedPane();
      isSmall = true;
      // tabbedPane.add(new JButton("asd"));
      JMenuBar menuBar = new JMenuBar();
      // menuBar.add(tabbedPane);
      menuBar.setBackground(Color.white);
      menuBar.setVisible(true);
      menuBar.add(new ResolutionButton());
      menuBar.add(new NextPanelbutton(false));
      menuBar.add(new NextPanelbutton(true));
      // menuBar.setPreferredSize(new Dimension(1024, 20));
      UpploaderView u = new UpploaderView();
      tabbedPane.addTab("Channel", u);
      tabbedPane.addTab("Videos", newSubPanel);
      //	menuBar.add(tabbedPane);
      // tabbedPane.setTabComponentAt(0,menuBar);

      // myFrame.add(u);
      // myFrame.add(tabbedPane);
      //	myFrame.setLayout(new FlowLayout());
      // Toolkit toolkit = Toolkit.getDefaultToolkit();
      // System.out.println(toolkit.getScreenSize().width+"x"+toolkit.getScreenSize().height);
      myFrame.setSize(1024, 600);
      myFrame.setJMenuBar(menuBar);
      myFrame.addWindowListener(new WindowClose());
      myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      myFrame.setVisible(true);
      Dimension panelDim = myFrame.getRootPane().getSize();
      // myFrame.add(newSubPanel);
      for (int i = 0; i < 3; i++) {
        if (i == 0) {
          newSubs = new DoublePanelStack(new NewSubVideoPanel(panelDim));
          myFrame.add(newSubs.getCurrentPanel());
          myFrame.validate();
          myFrame.repaint();
        }
        if (StatCol.newsubsStartIndex < StatCol.MAXNEWSUBVIDEOS)
          newSubs.add(new NewSubVideoPanel(panelDim));
      }
      // u.init();
      // sub2 = new NewSubVideoPanel(newSubPanel.init(),panelDim);
      myFrame.validate();
      // myFrame.pack();

    } catch (AuthenticationException e) {
      e.printStackTrace();
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (ServiceException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Beispiel #2
0
 @Test
 public void emptyPassword() {
   try {
     picasa.login("USERNAME", "");
     fail();
   } catch (AuthenticationException e) {
     assertEquals("Password can not be empty", e.getMessage());
   }
 }
Beispiel #3
0
 @Test
 public void emptyUsername() {
   try {
     picasa.login("", "PASSWORD");
     fail();
   } catch (AuthenticationException e) {
     assertEquals("Username can not be empty", e.getMessage());
   }
 }
 /**
  * Authenticates the user with the Google server after reading in the user email and password.
  *
  * @param service authenticated client connection to a Finance GData service
  * @param userID Finance portfolio user ID (e.g. "*****@*****.**")
  * @param userPassword Finance portfolio user password (e.g. "Bobs$tocks")
  * @return login success or failure
  */
 private static Boolean loginUser(FinanceService service, String userID, String userPassword) {
   try {
     service.setUserCredentials(userID, userPassword);
   } catch (AuthenticationException e) {
     System.err.println("Invalid Credentials!");
     e.printStackTrace();
     return false;
   }
   return true;
 }
 private void upload(CalendarEventEntry entry) {
   try {
     long startTime = System.currentTimeMillis();
     CalendarEventEntry createdEvent = createCalendarEvent(username, password, url, entry);
     logger.debug(
         "succesfully created new calendar event (title='{}', date='{}', content='{}') in {}ms",
         new Object[] {
           createdEvent.getTitle().getPlainText(),
           createdEvent.getTimes().get(0).getStartTime().toString(),
           createdEvent.getPlainTextContent(),
           System.currentTimeMillis() - startTime
         });
   } catch (AuthenticationException ae) {
     logger.error("authentication failed: {}", ae.getMessage());
   } catch (Exception e) {
     logger.error("creating a new calendar entry throws an exception: {}", e.getMessage());
   }
 }