Package javax.swing

Examples of javax.swing.JDesktopPane$ComponentPosition


    return pan;
  }
 
 
  public SkillAndActionsJPanel displaySkillAndActionsPanel(){
    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    final JInternalFrame internalFrame = new TransparentInternalFrame();
    final SkillAndActionsJPanel pan = new SkillAndActionsJPanel();

    pan.validate();
    pan.addUsable(ActionManager.getInstance().getActions(), jmeDesktop);
    internalFrame.add(pan);
    internalFrame.setVisible(true);
    internalFrame.pack();
    internalFrame.setLocation(desktopPane.getWidth()
        - internalFrame.getWidth(), 20);

    ArrayList<BaseUsable> acts = new ArrayList<BaseUsable>();
    acts.add(new SkillAndActionsPanelToggel(-10, "SkillAndActionsPanelToggel") {
      @Override
      public void onAction(String name, boolean isPressed, float tpf) {
        //only on release
        if (!isPressed) {
        if (internalFrame.isVisible()) {
          internalFrame.setVisible(false);
          desktopPane.remove(internalFrame);
          desktopPane.repaint();
          desktopPane.revalidate();
        } else {
          internalFrame.setVisible(true);
          desktopPane.add(internalFrame);
          desktopPane.repaint();
          desktopPane.revalidate();
        }
        }
      }
    });
    Singleton.get().getInputController().addInput(acts);
View Full Code Here


   * @return the initialized dialog for action wireing
   */
  //TODO store username in the config and preenter it for the user on next display
  public TransparentLoginPanel displayUserPasswordJPanel(){

    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    desktopPane.removeAll();

//    final JInternalFrame internalFrame = new TransparentInternalFrame();
//    internalFrame.setLocation(500, 200);

    final TransparentLoginPanel pan = new TransparentLoginPanel();
//    internalFrame.add(pan);
    //FIXME if pan is used it is the one to be removed on close
    //how do we do dragging of window?
    pan.setTransparency(0.8f);
//    internalFrame.add(pan);
//    internalFrame.setSize(new java.awt.Dimension(200, 140));
//    internalFrame.pack();
//    internalFrame.setVisible(true);
//    desktopPane.add(internalFrame);
   
    //interresting feature too, no borders, just the panel, works too and looks ok without borders
    pan.setLocation(jmeDesktop.getJDesktop().getWidth()/2+50, jmeDesktop.getJDesktop().getHeight()/2-100);

    //commented out, as we have now a check going on if the input is valid
//    //these are the actions for the gui, thy do not define what should be executed on login/cancel
//     // standard swing action:
//    pan.addCancelActionListener(new ActionListener() {
//      public void actionPerformed(ActionEvent e) {
//        // this gets executed in swing thread
//        // alter swing components only in swing thread!
//        pan.setVisible(false);
//        desktopPane.remove(pan);
//      }
//    });
//    pan.addLoginActionListener(new ActionListener() {
//      public void actionPerformed(ActionEvent e) {
//        // this gets executed in swing thread
//        // alter swing components ony in swing thread!
//       
//        pan.setVisible(false);
//        desktopPane.remove(pan);
//      }
//    });
    wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, pan);
    pan.setVisible(true);
    desktopPane.add(pan);
   
    return pan;
  }
View Full Code Here

   * @param serverInfos  The GameServerInfo to be displayed
   * @return The created gui component @see GameServerJPanel
   */
  public GameServerJPanel displayServerSelectionJPanel(final GameServerInfo[] serverInfos){

    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    desktopPane.removeAll();

    final JInternalFrame internalFrame = new TransparentInternalFrame();

    internalFrame.setLocation(desktopPane.getWidth()/2-200, desktopPane.getHeight()/2-150);
    final GameServerJPanel pan = new GameServerJPanel(serverInfos);
    internalFrame.add(pan);
   
    internalFrame.setVisible(true);
    internalFrame.setSize(new java.awt.Dimension(400, 300));
    internalFrame.pack();

    desktopPane.add(internalFrame);
   
    wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, pan);
   
     // standard swing action:
    pan.addCancelActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // this gets executed in swing thread
        // alter swing components only in swing thread!
        internalFrame.setVisible(false);
        desktopPane.remove(internalFrame);
      }
    });
    pan.addSelectActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // this gets executed in swing thread
        // alter swing components ony in swing thread!
        internalFrame.setVisible(false);
        desktopPane.remove(internalFrame);
      }
    });

    desktopPane.repaint();
    desktopPane.revalidate();
    return pan;
  }
View Full Code Here

    return pan;
  }
 
  public AdminTeleportJPanel displayAdminTelePanel(){

    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    desktopPane.removeAll();

    final JInternalFrame internalFrame = new TransparentInternalFrame();

    //internalFrame.setLocation(desktopPane.getWidth()/2-100, desktopPane.getHeight()/2-90);
    final AdminTeleportJPanel pan = new AdminTeleportJPanel();
    pan.validate();
   
    internalFrame.add(pan);
    internalFrame.setSize(new java.awt.Dimension(240, 110));
    internalFrame.setVisible(true);
    internalFrame.pack();
    internalFrame.setLocation(0,0);

    desktopPane.add(internalFrame);

    wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, pan);
   
    pan.addToTestAreaActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // this gets executed in swing thread
        // alter swing components only in swing thread!
        Singleton.get().getCharController().teleportToTestArea();
      }
    });
   
    pan.addFromTestAreaActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // this gets executed in swing thread
        // alter swing components only in swing thread!
        Singleton.get().getCharController().teleportFromTestArea();
      }
    });
   
    desktopPane.repaint();
    desktopPane.revalidate();
    return pan;
  }
View Full Code Here

    return pan;
  }
 
  public RevivePanel displayReviveJPanel(int options, String itemtext){

    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    desktopPane.removeAll();

    final JInternalFrame internalFrame = new TransparentInternalFrame();

    internalFrame.setLocation(desktopPane.getWidth()/2-100, desktopPane.getHeight()/2-90);
    final RevivePanel pan = new RevivePanel();
    pan.setButtonOptions(options, itemtext);
    internalFrame.add(pan, 0);
    jmeDesktop.setModalComponent(internalFrame);
    internalFrame.setVisible(true);
    internalFrame.setSize(new java.awt.Dimension(200, 180));
    internalFrame.pack();

    desktopPane.add(internalFrame);
   
    wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, pan);
   
     // standard swing action:
    pan.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // this gets executed in swing thread
        // alter swing components only in swing thread!
        jmeDesktop.setModalComponent(null);   
        internalFrame.setVisible(false);
        desktopPane.remove(internalFrame);
        Singleton.get().getClientFacade().sendGamePacket(new RequestRestartPoint(e.getID()));
      }
    });
   
    desktopPane.repaint();
    desktopPane.revalidate();
    return pan;
  }
View Full Code Here

   * @param serverInfos  The GameServerInfo to be displayed
   * @return The created gui component @see GameServerJPanel
   */
  public ChatPanel displayChatJPanel(){

    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
//    desktopPane.removeAll();

    final JInternalFrame internalFrame = new TransparentInternalFrame();   
    final ChatPanel pan = new ChatPanel();
    pan.validate();
    internalFrame.add(pan);
    internalFrame.setVisible(true);
    internalFrame.setSize(new java.awt.Dimension(320, 250));
    internalFrame.pack();
    internalFrame.setLocation(0,desktopPane.getHeight()-internalFrame.getHeight());
    desktopPane.add(internalFrame);
   
    // minimize on mouse out maximize on mouse in
    MinMaxListener mima = new MinMaxListener(internalFrame, "Chatwindow", pan, desktopPane);
    pan.addMouseListener(mima);

    wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, pan);

    desktopPane.repaint();
    desktopPane.revalidate();
    return pan;
  }
View Full Code Here

   * @param input The InputHandler to be used with this gui
   * @return    The created @see CharCreateJPanel where the game logic can be added to
   */
  public CharCreateJPanel displayCharCreateJPanel(){

    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    desktopPane.removeAll();
   
    final JInternalFrame internalFrame = new JInternalFrame();

    internalFrame.setLocation(20, 20);
    internalFrame.setResizable(false);
    internalFrame.setFrameIcon(null);
    final CharCreateJPanel pan = new CharCreateJPanel();
    internalFrame.add(pan);
   
    internalFrame.setVisible(true);
    internalFrame.setSize(new java.awt.Dimension(200, 180));
    internalFrame.pack();

    desktopPane.add(internalFrame);
   
    wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, pan);
   
     // standard swing action:
    pan.addCancelActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // this gets executed in swing thread
        // alter swing components only in swing thread!
        internalFrame.setVisible(false);
        desktopPane.remove(internalFrame);
      }
    });
   
    //nothing done in swing thread, pane stays open and will be closed on
    //create ok or cancel case only!
//    pan.addCreateActionListener(new ActionListener() {
//      public void actionPerformed(ActionEvent e) {
//        // this gets executed in swing thread
//        // alter swing components ony in swing thread!
//        internalFrame.setVisible(false);
//        desktopPane.remove(internalFrame);
//      }
//    });

    desktopPane.repaint();
    desktopPane.revalidate();
    return pan;
  }
View Full Code Here

  //FIXME does not remove buttons though
  public void removeAll() {
    SwingUtilities.invokeLater(new Runnable() {

      public void run() {
        final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
        desktopPane.removeAll();
      }
    });
  }
View Full Code Here

 
  private void showOneButtonDialog(final String messageText, final int type/*JOptionPane*/) {
    SwingUtilities.invokeLater(new Runnable() {

      public void run() {
        final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
        final JInternalFrame modalDialog = new JInternalFrame("Info");

        JOptionPane optionPane = new JOptionPane(messageText, type);
        modalDialog.getContentPane().add(optionPane);
        jmeDesktop.setModalComponent(modalDialog);
        desktopPane.add(modalDialog, 0);
        wireInputSwitch(new ArrayList<BaseUsable>()/*must pass empty otherwise not overriden*/, optionPane);
        modalDialog.setVisible(true);
        modalDialog.setSize(modalDialog.getPreferredSize());
        modalDialog
            .setLocation((desktopPane.getWidth() - modalDialog
                .getWidth()) / 2,
                (desktopPane.getHeight() - modalDialog
                    .getHeight()) / 2);
        jmeDesktop.setFocusOwner(optionPane);

        optionPane.addPropertyChangeListener(
            JOptionPane.VALUE_PROPERTY,
            new PropertyChangeListener() {
              public void propertyChange(PropertyChangeEvent evt) {
                modalDialog.setVisible(false);
                jmeDesktop.setModalComponent(null);
                desktopPane.remove(modalDialog);
              }
            });
      }
    });
  }
View Full Code Here

    final JButton b = new JButton(name);
    Dimension dim = new Dimension(width, height);
    b.setSize( dim );
    b.setPreferredSize( dim );
    b.setBounds(x, y, width, height);
    final JDesktopPane desktopPane = jmeDesktop.getJDesktop();
    desktopPane.add(b);
    b.setVisible(true);
    desktopPane.repaint();
    desktopPane.revalidate();
    return b;
  }
View Full Code Here

TOP

Related Classes of javax.swing.JDesktopPane$ComponentPosition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.