Package javax.swing

Examples of javax.swing.JLayeredPane


        TextCellFactory text = new TextCellFactory(new Font("Ariel", Font.BOLD, 18), cellWidth, cellHeight);
        display = new SwingPane(width, height, text, null);
        back = new SwingPane(width, height, text, null);
        clear();

        JLayeredPane layers = new JLayeredPane();
        layers.setLayer(display, JLayeredPane.PALETTE_LAYER);
        layers.setLayer(back, JLayeredPane.DEFAULT_LAYER);
        layers.add(display);
        layers.add(back);
        layers.setSize(display.getPreferredSize());
        layers.setPreferredSize(display.getPreferredSize());
        layers.setMinimumSize(display.getPreferredSize());
        frame.add(layers, BorderLayout.SOUTH);

        frame.getContentPane().setBackground(SColor.BLACK);
        frame.setVisible(true);
View Full Code Here


        BorderLayout layout = ( oldC.getLayout() instanceof BorderLayout )
                ? ( BorderLayout )oldC.getLayout()
                : null;

        JLayeredPane oldLayeredPane = (oldInstance instanceof JLayeredPane)
                ? (JLayeredPane) oldInstance
                : null;

        // Pending. Assume all the new children are unaltered.
        for(int i = newChildren.length; i < oldChildren.length; i++) {
            Object[] args = ( layout != null )
                    ? new Object[] {oldChildren[i], layout.getConstraints( oldChildren[i] )}
                    : (oldLayeredPane != null)
                            ? new Object[] {oldChildren[i], oldLayeredPane.getLayer(oldChildren[i]), Integer.valueOf(-1)}
                            : new Object[] {oldChildren[i]};

            invokeStatement(oldInstance, "add", args, out);
        }
    }
View Full Code Here

        Point finalLocation = getNewEditorLocation(mouseLocation, newEditor, parentEditor, editorContainer);
        newEditor.setLocation(finalLocation);        
       
        if (editorContainer instanceof JLayeredPane) {
           
            JLayeredPane jlp = (JLayeredPane) editorContainer;
            jlp.setLayer(newEditor, JLayeredPane.PALETTE_LAYER.intValue(), 1);
            jlp.add(newEditor);
            jlp.moveToFront(newEditor);
            jlp.revalidate();
           
        } else {
            editorContainer.add(newEditor, 0);
            editorContainer.revalidate();
        }
View Full Code Here

     * @param alignLeft whether the panel should be to the left of the point
     * @param source the source component in whose coordinate space the point/area lie
     */
    private void positionIntellicutPanel(Rectangle displayRect, boolean alignLeft, JComponent source) {
       
        JLayeredPane jlp = gemCutter.getLayeredPane();

        // Transform the coordinates between the source component and the layered pane.
        displayRect = SwingUtilities.convertRectangle(source, displayRect, jlp);

        // Calculate the ideal location for the panel.
        Dimension preferredSize = intellicutPanel.getPreferredSize();
        Dimension frameSize = jlp.getSize();

        Point displayPoint = new Point(displayRect.x + displayRect.width, displayRect.y + displayRect.height);

        if (alignLeft) {
            displayPoint.x = displayRect.x - preferredSize.width;
        }

        // If the panel extends below the bottom of the window, move it up
        if (preferredSize.height > (frameSize.height - displayPoint.y)) {
            displayPoint.y = displayRect.y - preferredSize.height;

            if (displayPoint.y < 0) {
                displayPoint.y = 0;
            }
        }

        // If the panel extends past the sides of the window, move it left or right
        if (preferredSize.width > (frameSize.width - displayPoint.x)) {
            displayPoint.x = displayRect.x - preferredSize.width;
        } else if (displayPoint.x < 0) {
            displayPoint.x = displayRect.x + displayRect.width;
        }
       
        // Finally add the panel to the layered pane.   
        intellicutPanel.setLocation(displayPoint);
        intellicutPanel.setSize(preferredSize);
        jlp.add(intellicutPanel, JLayeredPane.PALETTE_LAYER, 0);       
    }
View Full Code Here

        this.stack.setMinOffsetY(STACK_MIN_CARDS_OFFSET_Y);

        // Override layout (I can't edit generated code)
        this.setLayout(new BorderLayout());
        final JLayeredPane jLayeredBackgroundPane = new JLayeredPane();
        jLayeredBackgroundPane.setSize(1024, 768);
        this.add(jLayeredBackgroundPane);
        jLayeredBackgroundPane.add(jSplitPane0, JLayeredPane.DEFAULT_LAYER);

        Map<String, JComponent> myUi = getUIComponents(jLayeredBackgroundPane);
        Plugins.getInstance().updateGamePanel(myUi);

        // Enlarge jlayeredpane on resize
        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                int width = ((JComponent) e.getSource()).getWidth();
                int height = ((JComponent) e.getSource()).getHeight();
                jLayeredBackgroundPane.setSize(width, height);
                jSplitPane0.setSize(width, height);

                if (height < storedHeight) {
                    pnlBattlefield.setSize(0, 200);
                }
View Full Code Here

    /**
     * Setup of the elements and layout.
     */
    public StartScreen() {

        JLayeredPane pane = new JLayeredPane();

        // language drop down menu
        JComboBox<String> languageComboBox = new JComboBox<>();
        languageComboBox.setModel(new DefaultComboBoxModel<>(new String[]{"English", "Spanish", "German", "Chinese"}));   // set model
        languageComboBox.setToolTipText("Select language");     // tooltip

        // background image and image map items
        ImageMapLabel menuLabel = new ImageMapLabel();
        menuLabel.setIcon(IOManager.getAsIcon(Places.GraphicsStartup, "start.background.jpg"));    // set image
        // add all icons
        ActionListener editorAction = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                UIFrame frame = new EditorScreen();
                frame.switchTo();
            }
        };
        ActionListener helpAction = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                URL index = IOManager.getURL(Places.Help, "en_index.html");
                BrowserPanel browser = new BrowserPanel(index, index, IOManager.getAsLoader(Places.GraphicsBrowserIcons), IOManager.getAsImage(Places.GraphicsIcons, "misc/dialog.background.png"));
                UIDialog.make(browser, "Help");
            }
        };
        menuLabel.addMapItem(new Rectangle(421, 459, 110, 90), new Point(421, 459), "Game Center", IOManager.getAsImage(Places.GraphicsStartup, "start.overlay.throne.png"), new UIDialogStartAction(GameCenterDialog.class));
        menuLabel.addMapItem(new Rectangle(821, 60, 200, 375), new Point(821, 60), "Editor", IOManager.getAsImage(Places.GraphicsStartup, "start.overlay.map.png"), editorAction);
        menuLabel.addMapItem(new Rectangle(575, 412, 70, 140), new Point(575, 412), "Exit", IOManager.getAsImage(Places.GraphicsStartup, "start.overlay.door.right.png"), StartClient.ExitAction);
        menuLabel.addMapItem(new Rectangle(832, 505, 65, 130), new Point(832, 505), "Preferences", IOManager.getAsImage(Places.GraphicsStartup, "start.overlay.fireplace.png"), new UIDialogStartAction(OptionsDialog.class));
        menuLabel.addMapItem(new Rectangle(127, 397, 130, 130), new Point(127, 397), "Help", IOManager.getAsImage(Places.GraphicsStartup, "start.overlay.window.left.png"), helpAction);

        // Version label
        JLabel versionLabel = new JLabel("Version " + Option.General_Version.get());
        versionLabel.setForeground(Color.WHITE);    // white color

        RelativeLayout layout = new RelativeLayout();
        pane.setLayout(layout);

        // add background image (centered)
        pane.add(menuLabel, new Integer(1));
        layout.addConstraint(menuLabel, RelativeLayoutConstraint.centered());

        // add Version in the same layer (right, lower border)
        pane.add(versionLabel, new Integer(2));
        layout.addConstraint(versionLabel, RelativeLayoutConstraint.corner(WindowCorner.SouthEast, 20, 20));

        // add language combo box
        pane.add(languageComboBox, new Integer(4));
        // layout.addConstraint(languageComboBox, RelativeLayoutConstraint.relative(0.7f, 0.5f));
        layout.addConstraint(languageComboBox, RelativeLayoutConstraint.corner(WindowCorner.NorthWest, 5, 5));

        pane.setOpaque(true);
        pane.setBackground(new Color(30, 20, 0));

        setContent(pane);

        FrameManager.getInstance().setShutDownOnClose();
    }
View Full Code Here

   *            Root pane
   * @param titlePane
   *            The <code>JComponent</code> to use for the window title pane.
   */
  private void setTitlePane(JRootPane root, JComponent titlePane) {
    JLayeredPane layeredPane = root.getLayeredPane();
    JComponent oldTitlePane = this.getTitlePane();

    if (oldTitlePane != null) {
      // fix for defect 109 - memory leak on skin change
      if (oldTitlePane instanceof SubstanceTitlePane)
        ((SubstanceTitlePane) oldTitlePane).uninstall();
      // oldTitlePane.setVisible(false);
      layeredPane.remove(oldTitlePane);
    }
    if (titlePane != null) {
      layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
      titlePane.setVisible(true);
    }
    this.titlePane = titlePane;
  }
View Full Code Here

   * look and feel are controlled by the plaf. The plaf creates and sets this
   * value; the default is null, implying a native operating system window
   * title pane.
   */
  private void setTitlePane(JRootPane root, JComponent titlePane) {
    JLayeredPane layeredPane = root.getLayeredPane();
    JComponent oldTitlePane = getTitlePane();

    if (oldTitlePane != null) {
      oldTitlePane.setVisible(false);
      layeredPane.remove(oldTitlePane);
    }
    if (titlePane != null) {
      layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
      titlePane.setVisible(true);
    }
    this.titlePane = (SkinTitlePane)titlePane;
  }
View Full Code Here

  public static JButton getWindowButton(JDialog window, String name) {
      return getWindowButton(window.getRootPane(), name);
  }

  public static JButton getWindowButton(JRootPane rootPane, String name) {
      JLayeredPane jlp = rootPane.getLayeredPane();
      for (int i=0;i<jlp.getComponentCount();i++) {
          Component comp = jlp.getComponent(i);
          if (comp instanceof SkinTitlePane) {
              SkinTitlePane  stp = (SkinTitlePane) comp;
              for (int j=0;j<stp.getComponentCount();j++) {
                  Component comp2 = stp.getComponent(j);
                  if (comp2 instanceof SkinWindowButton) {
View Full Code Here

 
  /** Set the overlay component to be displayed.
   * @param component the overlay component to display, null to remove any displayed component
   */
  public void setOverlay(Component component) {
    JLayeredPane layeredPane = getLayeredPane();
    if (overlayComponent != null) {
      layeredPane.remove(overlayComponent);
    }
    overlayComponent = component;
    if (overlayComponent != null) {
      layeredPane.add(overlayComponent, JLayeredPane.PALETTE_LAYER);
      resizeOverlayComponent();
    }
  }
View Full Code Here

TOP

Related Classes of javax.swing.JLayeredPane

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.