Ejemplo n.º 1
0
 public AddFriendsSheet(RobonoboFrame frame) {
   super(frame);
   setPreferredSize(size);
   double[][] cellSizen = {{10, 90, 5, 250, 10}, {10, 25, 10, 30, 10, 25, 10, 30, 10}};
   setLayout(new TableLayout(cellSizen));
   setName("playback.background.panel");
   RLabel titleLbl = new RLabel16B("Add friends");
   add(titleLbl, "1,1,3,1");
   JPanel blurb =
       new LineBreakTextPanel(
           "Enter your friends' email addresses below to invite them to robonobo:",
           RoboFont.getFont(13, false),
           345);
   add(blurb, "1,3,3,3");
   RLabel newFriendLbl = new RLabel12("New friends:");
   add(newFriendLbl, "1,5");
   emailField = new RTextField(DEFAULT_EMAILS);
   emailField.addKeyListener(
       new KeyAdapter() {
         public void keyReleased(KeyEvent e) {
           shareBtn.setEnabled(targetSelected());
         }
       });
   emailField.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (emailField.getText().equals(DEFAULT_EMAILS)) emailField.setText("");
         }
       });
   add(emailField, "3,5");
   add(new ButtonPanel(), "3,7,r,t");
 }
Ejemplo n.º 2
0
 private boolean targetSelected() {
   // Could bugger about with regexes here, but I don't think it's worth it
   return (emailField.getText().length() > 0 && !emailField.getText().equals(DEFAULT_EMAILS));
 }
Ejemplo n.º 3
0
 @Override
 public void onShow() {
   emailField.requestFocusInWindow();
   emailField.selectAll();
 }