javax.swing.JFrame.getLayeredPane()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(692)

本文整理了Java中javax.swing.JFrame.getLayeredPane()方法的一些代码示例,展示了JFrame.getLayeredPane()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getLayeredPane()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getLayeredPane

JFrame.getLayeredPane介绍

暂无

代码示例

代码示例来源:origin: com.samskivert/samskivert

/**
 * Creates a dialog that will display itself in the layered pane of
 * the supplied frame.
 */
public JInternalDialog (JFrame frame)
{
  this(frame.getLayeredPane());
}

代码示例来源:origin: threerings/tripleplay

public void removeOverlay (JavaNativeOverlay overlay) {
  if (_overlays.remove(overlay)) {
    _frame.getLayeredPane().remove(overlay.component);
  }
}

代码示例来源:origin: antlr/antlrworks

public JLayeredPane getLayeredPane() {
  if(useDesktop) {
    return jInternalFrame.getLayeredPane();
  } else {
    return jFrame.getLayeredPane();
  }
}

代码示例来源:origin: threerings/tripleplay

public void addOverlay (JavaNativeOverlay overlay) {
  _overlays.add(overlay);
  _frame.getLayeredPane().add(overlay.component);
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
 public void mouseClicked(MouseEvent e) {
  frame.getLayeredPane().remove(imagePanel);
  frame.getLayeredPane().remove(backgroundPanel);
  frame.validate();
  frame.repaint();
 }
});

代码示例来源:origin: tinyMediaManager/tinyMediaManager

private void show() {
 frame.getLayeredPane().add(backgroundPanel, JLayeredPane.PALETTE_LAYER);
 imagePanel.setLocation(((frame.getLayeredPane().getWidth() - imagePanel.getWidth()) / 2),
   (frame.getLayeredPane().getHeight() - imagePanel.getHeight()) / 2);
 frame.getLayeredPane().add(imagePanel, JLayeredPane.POPUP_LAYER);
}

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
 JPanel board = new JPanel();
 board.setLayout(null);
 board.setBounds(0, 0, 500, 500);
 for (int i = 0, x = 0; i < 10; i++, x += 50) {
   for (int j = 0, y = 0; j < 10; j++, y += 50) {
     JLabel lab = new JLabel("" + j);
     lab.setOpaque(true);
     lab.setBackground(Color.BLACK);
     lab.setBounds(x, y, 50, 50);
     board.add(lab);
   }
 }
 JLabel ladder = new JLabel();
 ladder.setBackground(Color.RED);
 ladder.setBounds(0, 0, 50, 200);
 ladder.setOpaque(true);
 JLayeredPane pane = frame.getLayeredPane();
 pane.add(ladder, new Integer(2)); // front
 pane.add(board, new Integer(1));  // back
 frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

import java.awt.Color;
import javax.swing.JFrame;

public class BFrame {

  public static void main(String[] args) {
    new JFrame() {{
      super.setBackground(Color.CYAN);
      this.getRootPane().setBackground(Color.BLUE);
      this.getLayeredPane().setBackground(Color.RED);
      this.getContentPane().setBackground(Color.YELLOW);
      this.setSize(400,340); 
      this.setVisible(true);
    }};
  }
}

代码示例来源:origin: stackoverflow.com

lblBG.setName("BackgroundImageLabel");
JLayeredPane layeredPane = frame.getLayeredPane();

代码示例来源:origin: stackoverflow.com

JLayeredPane lp = getLayeredPane();

代码示例来源:origin: Multibit-Legacy/multibit-hd

JLayeredPane layeredPane = Panels.getApplicationFrame().getLayeredPane();

代码示例来源:origin: stackoverflow.com

awtPanel1.setSize(300, 400);
awtPanel1.add(customCanvas, BorderLayout.CENTER);
frame.getLayeredPane().add(awtPanel1, JLayeredPane.DEFAULT_LAYER);
awtPanel2.setSize(100, 100);
awtPanel2.add(customPanel, BorderLayout.CENTER);
frame.getLayeredPane().add(awtPanel2, JLayeredPane.PALETTE_LAYER);

代码示例来源:origin: stackoverflow.com

JButton button = new JButton(" Menu \u25be ");

JFrame frame = new JFrame("Title");
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);

// Force creation of title bar components.
frame.setPreferredSize(new Dimension(400, 400));
frame.pack();

JLayeredPane layeredPane = frame.getLayeredPane();
JComponent titlePane = (JComponent) layeredPane.getComponentAt(0, 0);
for (Component c : titlePane.getComponents()) {
  if (c instanceof Container &&
    ((Container) c).getLayout() instanceof DefaultMenuLayout) {

    int layer = layeredPane.getLayer(titlePane);
    layeredPane.setLayer(button, layer + 1);

    button.setLocation(c.getX() + c.getWidth() + 3, 1);
    Dimension size = button.getPreferredSize();
    size.height = Math.min(size.height, titlePane.getHeight() - 2);
    button.setSize(size);
    layeredPane.add(button);

    break;
  }
}

代码示例来源:origin: stackoverflow.com

for (Component c1 : frame.getLayeredPane().getComponents()) {
  if (c1.toString().contains("MetalTitlePane")) {
    for (Component c2 : ((Container) c1).getComponents()) {

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * @param screenPanel The panel containing the light box components (e.g. a wizard screen panel)
 * @param layer       The layer which to place the panel (JLayeredPane.MODAL_LAYER for wizards, DRAG_LAYER for popovers within wizards)
 */
public LightBoxPanel(JPanel screenPanel, Integer layer) {
 Preconditions.checkNotNull(screenPanel, "'panel' must be present");
 Preconditions.checkState(screenPanel.getWidth() > 0, "'width' must be greater than zero");
 Preconditions.checkState(screenPanel.getHeight() > 0, "'height' must be greater than zero");
 this.screenPanel = screenPanel;
 // Ensure we set the opacity (platform dependent)
 setOpaque(false);
 // Ensure we are visible
 setVisible(true);
 // Ensure this panel covers all the available frame area
 setSize(Panels.getApplicationFrame().getWidth() + 100, Panels.getApplicationFrame().getHeight() + 100);
 // Prevent mouse events reaching through the darkened border
 addMouseListener(new ModalMouseListener());
 // Add this panel to the frame's layered panel as the palette layer (directly above the default)
 if (JLayeredPane.MODAL_LAYER.equals(layer)) {
  Panels.getApplicationFrame().getLayeredPane().add(this, JLayeredPane.PALETTE_LAYER);
 } else {
  Panels.getApplicationFrame().getLayeredPane().add(this, JLayeredPane.POPUP_LAYER);
 }
 // Provide a starting position
 calculatePosition();
 // Add the light box panel to the frame
 Panels.getApplicationFrame().getLayeredPane().add(screenPanel, layer);
 log.debug("Light box panel added to application frame");
}

代码示例来源:origin: stackoverflow.com

b.setSize(400, 200);
this.getLayeredPane().add(a, JLayeredPane.DEFAULT_LAYER); // Map
this.getLayeredPane().add(b, JLayeredPane.PALETTE_LAYER); // Menu

代码示例来源:origin: omegat-org/omegat

AlphabeticalMarkers(JScrollPane scrollPane) {
  this.parent = Core.getMainWindow().getApplicationFrame().getLayeredPane();
  this.scrollPane = scrollPane;
  String sourceLang = Core.getProject().getProjectProperties()
      .getSourceLanguage().getLanguageCode();
  this.sourceLangIsRTL = EditorUtils.isRTL(sourceLang);
  this.colorScheme = createColorScheme(scrollPane.getViewport().getView().getBackground());
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

theFrame.getLayeredPane().getComponentsInLayer(
  JLayeredPane.FRAME_CONTENT_LAYER.intValue());

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

fr.getLayeredPane().add(heavyShape, JLayeredPane.DRAG_LAYER);
  heavyShape.validate();
  fr.getLayeredPane().add(heavyShape.label, JLayeredPane.DRAG_LAYER);
} else if(aboveWindow instanceof JDialog) {
  JDialog dlg = (JDialog) aboveWindow;

相关文章

JFrame类方法