/** * Creates a dialog that will display itself in the layered pane of * the supplied frame. */ public JInternalDialog (JFrame frame) { this(frame.getLayeredPane()); }
public void removeOverlay (JavaNativeOverlay overlay) { if (_overlays.remove(overlay)) { _frame.getLayeredPane().remove(overlay.component); } }
public JLayeredPane getLayeredPane() { if(useDesktop) { return jInternalFrame.getLayeredPane(); } else { return jFrame.getLayeredPane(); } }
public void addOverlay (JavaNativeOverlay overlay) { _overlays.add(overlay); _frame.getLayeredPane().add(overlay.component); }
@Override public void mouseClicked(MouseEvent e) { frame.getLayeredPane().remove(imagePanel); frame.getLayeredPane().remove(backgroundPanel); frame.validate(); frame.repaint(); } });
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); }
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);
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); }}; } }
lblBG.setName("BackgroundImageLabel"); JLayeredPane layeredPane = frame.getLayeredPane();
JLayeredPane lp = getLayeredPane();
JLayeredPane layeredPane = Panels.getApplicationFrame().getLayeredPane();
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);
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; } }
for (Component c1 : frame.getLayeredPane().getComponents()) { if (c1.toString().contains("MetalTitlePane")) { for (Component c2 : ((Container) c1).getComponents()) {
/** * @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"); }
b.setSize(400, 200); this.getLayeredPane().add(a, JLayeredPane.DEFAULT_LAYER); // Map this.getLayeredPane().add(b, JLayeredPane.PALETTE_LAYER); // Menu
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()); }
theFrame.getLayeredPane().getComponentsInLayer( JLayeredPane.FRAME_CONTENT_LAYER.intValue());
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;