Beispiel #1
0
  public void showPanel(String name) {

    if (name.equals("Main")) {
      pnlTexts.setVisible(false);
      pnlCalls.setVisible(false);
      pnlContacts.setVisible(false);
      pnlMain.setVisible(true);
    } else if (name.equals("Texts")) {
      pnlCalls.setVisible(false);
      pnlContacts.setVisible(false);
      pnlMain.setVisible(false);
      pnlTexts.setVisible(true);
    } else if (name.equals("Calls")) {
      if (CallsPanel.isCall()) {
        pnlContacts.setVisible(false);
        pnlMain.setVisible(false);
        pnlTexts.setVisible(false);
        pnlCalls.setVisible(true);
        pnlCalls.Update();

      } else {
        pnlContacts.setVisible(false);
        pnlMain.setVisible(false);
        pnlTexts.setVisible(false);
        pnlCalls.setVisible(true);
      }
    } else if (name.equals("Contacts")) {
      pnlMain.setVisible(false);
      pnlTexts.setVisible(false);
      pnlCalls.setVisible(false);
      pnlContacts.setVisible(true);
    }
  }
Beispiel #2
0
  public MainFrame() {
    Service.createAndStoreSomeObjects();
    pnlContent = (JPanel) this.getContentPane();
    pnlContent.setLayout(null);

    pnlScreen = new JPanel();
    pnlContent.add(pnlScreen);
    pnlScreen.setSize(300, 380);
    pnlScreen.setLocation(10, 10);
    pnlScreen.setLayout(null);

    pnlButtons = new JPanel();
    pnlContent.add(pnlButtons);
    pnlButtons.setSize(300, 60);
    pnlButtons.setLocation(10, 400);
    pnlButtons.setLayout(null);

    btnHome = new JButton("Home");
    pnlButtons.add(btnHome);
    btnHome.setSize(70, 30);
    btnHome.setLocation(115, 10);
    btnHome.addActionListener(controller);

    // ---------------------------------------------------------------------

    Color color = new Color(99, 184, 255); // steelblue

    pnlMain = new MainPanel(this);
    pnlMain.setName("Main");
    pnlMain.setBackground(color);
    pnlMain.setLayout(null);
    pnlScreen.add(pnlMain, "Main");

    pnlTexts = new TextsPanel(this);
    pnlTexts.setName("Texts");
    pnlScreen.add(pnlTexts, "Texts");
    pnlTexts.setBackground(color);
    pnlTexts.setLayout(null);

    pnlCalls = new CallsPanel(this);
    pnlCalls.setName("Calls");
    pnlScreen.add(pnlCalls, "Calls");
    pnlCalls.setBackground(color);
    pnlCalls.setLayout(null);

    pnlContacts = new ContactsPanel(this);
    pnlContacts.setName("Contacts");
    pnlScreen.add(pnlContacts, "Contacts");
    pnlContacts.setBackground(color);
    pnlContacts.setLayout(null);

    showPanel("Main");
  }
Beispiel #3
0
  @Override
  public void run() {
    super.run();
    while (true) {
      try {

        mainPanel.getGame().runOnce();
        mainPanel.updateUI();
        // System.out.println("Tick");
        sleep(Settings.TICK_SPEED);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
 @Override
 public void actionPerformed(ActionEvent arg0) {
   System.out.println("\n change profile picture is clicked!");
   changeProfilePictureButton.setCursor(new Cursor(Cursor.WAIT_CURSOR));
   File pictureFile = askPictureFile();
   if (pictureFile != null) mainPanel.changeProfilePictureClicked(pictureFile);
   changeProfilePictureButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
 }