Java 类javax.swing.OverlayLayout 实例源码

项目:stendhal    文件:InformationPanel.java   
/**
 * Create a new InformationPanel.
 */
InformationPanel() {
    setLayout(new OverlayLayout(this));
    JComponent container = SBoxLayout.createContainer(SBoxLayout.VERTICAL);
    glassPane = new JComponent(){};
    add(glassPane);
    add(container);

    // ** Zone name **
    nameField = new JTextPane();
    StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
    nameField.setAlignmentX(CENTER_ALIGNMENT);
    nameField.setOpaque(true);
    nameField.setBackground(getBackground());
    nameField.setForeground(Color.WHITE);
    nameField.setFocusable(false);
    nameField.setEditable(false);
    container.add(nameField, SLayout.EXPAND_X);

    // ** Danger display **
    dangerIndicator = new DangerIndicator(MAX_SKULLS);
    dangerIndicator.setAlignmentX(CENTER_ALIGNMENT);
    container.add(dangerIndicator);
    // Default to safe, so that we always have a tooltip
    describeDanger(0);
}
项目:olivia-swing    文件:MainContainer.java   
/**
 * OliviaWindowから生成.
 * @param mw OliviaWindowのインスタンス
 */
public MainContainer(OliviaWindow mw) {
    this.contentPanel = new ContentView();
    this.statusBar = new StatusBar();
    this.sideBar = new SideBar(Olivia.getProjects().getCurrentProject(), mw);
    this.setLayout(new OverlayLayout(this));

    BorderPanel main = new BorderPanel();
    main.add(sideBar, BorderLayout.WEST);
    main.add(contentPanel, BorderLayout.CENTER);
    main.add(statusBar, BorderLayout.SOUTH);

    this.add(new OverlayContainer());
    this.add(main);

}
项目:jabref    文件:OverlayPanel.java   
public OverlayPanel(JComponent overlay, String text) {
    OverlayLayout layout = new OverlayLayout(this);
    this.setLayout(layout);

    label = new JLabel(text);
    label.setFont(new Font(label.getFont().getName(), Font.ITALIC, 18));
    label.setForeground(new Color(224, 220, 220));
    label.setLocation(0, 0);

    JScrollPane scroller = new JScrollPane(overlay);
    scroller.setLocation(0, 0);
    scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    add(label);
    add(scroller);
}
项目:ArcanistCCG    文件:NerfableInternalFrame.java   
public NerfableInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) {
  super();
  super.setTitle(title);
  super.setResizable(resizable);
  super.setClosable(closable);
  super.setMaximizable(maximizable);
  super.setIconifiable(iconifiable);

  JPanel realContentPane = new JPanel(new BorderLayout());
    JPanel overlayPanel = new JPanel();
      overlayPanel.setLayout(new OverlayLayout(overlayPanel));
      realContentPane.add(overlayPanel);

    glassPane = new NerfableGlassPane();
      overlayPanel.add(glassPane);

    contentPaneHolder.add(new JPanel());
      overlayPanel.add(contentPaneHolder);

    contentPaneHolder.add(contentPane);

  super.setContentPane(realContentPane);
}
项目:incubator-netbeans    文件:OverlayLayoutSupport.java   
private static Constructor getOverlayLayoutConstructor() {
    if (overlayLayoutConstructor == null) {
        try {
            overlayLayoutConstructor = OverlayLayout.class.getConstructor(
                                       new Class[] { Container.class });
        } catch (NoSuchMethodException ex) { // should not happen
            Exceptions.printStackTrace(ex);
        }
    }
    return overlayLayoutConstructor;
}
项目:rapidminer    文件:CSVFormatSpecificationPanel.java   
/**
 * Fills the tablePane with content.
 */
private JComponent makePreviewTable() {
    previewTable = new ExtendedJTable(false, false, false);
    // ensure same background as JPanels in case of only few rows
    previewTable.setBackground(Colors.PANEL_BACKGROUND);
    previewTable.setColoredTableCellRenderer(new ColoredTableCellRenderer() {

        private final Font boldFont = getFont().deriveFont(Font.BOLD);

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {
            JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            adjustCell(row, label, boldFont);
            return label;
        }

    });

    loadingContentPane = new LoadingContentPane("loading_data", previewTable);

    tablePane = new JScrollPane(loadingContentPane);
    tablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    tablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tablePane.setBorder(null);

    // add PREVIEW label in front of scrollpane
    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setLayout(new OverlayLayout(layeredPane));
    layeredPane.add(tablePane, JLayeredPane.DEFAULT_LAYER);

    JPanel overlayPanel = new JPanel(new BorderLayout());
    overlayPanel.setOpaque(false);
    overlayLabel = new JLabel("", SwingConstants.CENTER);
    showPreviewLettering();
    overlayPanel.add(overlayLabel, BorderLayout.CENTER);

    layeredPane.add(overlayPanel, JLayeredPane.PALETTE_LAYER);
    return layeredPane;
}
项目:LuoYing    文件:TestLayered.java   
private void createFrame() {
        jframe = new JFrame("Test");
        jframe.setName("MainWindow");
        jframe.setSize(width, height);
        jframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        jframe.setUndecorated(false);
//        jframe.setBackground(new Color(0,0,0,0f));
//        jframe.add(SwingUtils.createCanvas());
//        jfxWindow = createJfxWindow(jframe);

        OverlayLayout layout = new OverlayLayout(jframe);



        JPanel jp1 = new TranslucentPane();
        jp1.setSize(width, (int) (height * 0.5));
        jp1.setBackground(new Color(0,0,0,0));
        jp1.add(new JButton("1111"));
//        jp1.setOpaque(false);

        JPanel jp2 = new JPanel();
        jp2.setSize(width, height);
//        jp2.setBackground(new Color(0,0,0,0.1f));
        jp2.add(new JButton("22222222222222"));
        jp2.add(SwingUtils.createCanvas());


        jframe.add(jp1);
        jframe.add(jp2);

    }
项目:LuoYing    文件:TestSwing.java   
private static void createTabs(){
        rootPanel = new JPanel();
//        canvasPanel.setSize(640, 480);
//        canvasPanel.add(canvas);
//        frame.setSize(640, 480);


        frame.getContentPane().add(rootPanel);
        OverlayLayout layout = new OverlayLayout(rootPanel);
//        BorderLayout layout = new BorderLayout(1, 1);

        JFXPanel jfxPanel = new JFXPanel();
        jfxPanel.setBounds(0, 0, 100, 100);
        jfxPanel.setSize(100, 100);

        rootPanel.setLayout(layout);
//        rootPanel.add(jfxPanel);
        rootPanel.add(new JButton("fsfdsfj;dsj;fjds;jfasf;afja;fd"));
        rootPanel.add(canvas);

        Platform.runLater(() -> {
            Button btn = new Button("Hello JFX!");
            StackPane root = new StackPane();
            root.setBackground(Background.EMPTY);
            root.getChildren().add(btn);
//            root.setStyle("-fx-background-color: transparent;");
//            root.setStyle("-fx-background-color:#0000FF;");

            Scene scene = new Scene(root);
            scene.setFill(Color.TRANSPARENT);

            Stage stage = new Stage();
            stage.initStyle(StageStyle.TRANSPARENT);
            stage.setScene(scene);
            stage.show();
        });
    }
项目:rapidminer-studio    文件:CSVFormatSpecificationPanel.java   
/**
 * Fills the tablePane with content.
 */
private JComponent makePreviewTable() {
    previewTable = new ExtendedJTable(false, false, false);
    // ensure same background as JPanels in case of only few rows
    previewTable.setBackground(Colors.PANEL_BACKGROUND);
    previewTable.setColoredTableCellRenderer(new ColoredTableCellRenderer() {

        private final Font boldFont = getFont().deriveFont(Font.BOLD);

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {
            JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            adjustCell(row, label, boldFont);
            return label;
        }

    });

    loadingContentPane = new LoadingContentPane("loading_data", previewTable);

    tablePane = new JScrollPane(loadingContentPane);
    tablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    tablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tablePane.setBorder(null);

    // add PREVIEW label in front of scrollpane
    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setLayout(new OverlayLayout(layeredPane));
    layeredPane.add(tablePane, JLayeredPane.DEFAULT_LAYER);

    JPanel overlayPanel = new JPanel(new BorderLayout());
    overlayPanel.setOpaque(false);
    overlayLabel = new JLabel("", SwingConstants.CENTER);
    showPreviewLettering();
    overlayPanel.add(overlayLabel, BorderLayout.CENTER);

    layeredPane.add(overlayPanel, JLayeredPane.PALETTE_LAYER);
    return layeredPane;
}
项目:mzmine2    文件:LabeledProgressBar.java   
public LabeledProgressBar() {

    setLayout(new OverlayLayout(this));

    label = new JLabel();
    label.setAlignmentX(0.5f);
    label.setFont(label.getFont().deriveFont(11f));
    add(label);

    progressBar = new JProgressBar(0, 100);
    progressBar.setBorderPainted(false);
    add(progressBar);

    }
项目:filthy-rich-clients    文件:ApplicationFrame.java   
private void addLayeredValidator() {
    validator = new Validator();

    JLayeredPane layeredPane = getRootPane().getLayeredPane();
    layeredPane.setLayout(new OverlayLayout(layeredPane));
    layeredPane.add(validator, (Integer) (JLayeredPane.DEFAULT_LAYER + 50));
    //validator.setBounds(0, 0, getWidth(), getHeight());
}
项目:spicy    文件:JLayeredPaneCorrespondences.java   
private void createComponents() {
    this.pannelloPrincipale = new javax.swing.JPanel();
    this.pannelloPrincipale.setLayout(new java.awt.BorderLayout());
    this.glassPane = new GraphSceneGlassPane();
    this.intermediatePanel = new JPanel();
    this.intermediatePanel.setName(Costanti.INTERMEDIE);
    this.intermediatePanel.setLayout(new AbsoluteLayout());
    this.intermediatePanel.setBackground(Costanti.getIntermediateColor());

    this.scrollSource = new JScrollPane();
    this.scrollSource.setMinimumSize(new Dimension(200, getHeight()));
    this.splitChild = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollSource, intermediatePanel);
    //this.splitChild.setOneTouchExpandable(true);

    this.scrollTarget = new JScrollPane();
    this.scrollTarget.setMinimumSize(new Dimension(200, getHeight()));
    this.split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.getSplitChild(), scrollTarget);

    this.pannelloPrincipale.setOpaque(false);
    this.glassPane.setOpaque(false);
    this.setOpaque(false);

    OverlayLayout overlaylayout = new OverlayLayout(this);
    this.setLayout(overlaylayout);

    this.add(this.glassPane);
    this.add(this.pannelloPrincipale);
    this.pannelloPrincipale.add(getSplit());

    setSplitPane();
    initMouseListener();
}
项目:passage    文件:MapBean.java   
public MapBean(boolean useThreadedNotification) {
   if (logger.isLoggable(Level.FINE)) {
      debugmsg("MapBean()");
   }
   if (!suppressCopyright) {
      Debug.output(copyrightNotice);
   }

   background = DEFAULT_BACKGROUND_COLOR;

   // Don't need one for every MapBean, just the first one.
   suppressCopyright = true;

   super.setLayout(new OverlayLayout(this));
   projectionSupport = new ProjectionSupport(this, useThreadedNotification);
   addComponentListener(this);
   addContainerListener(this);

   // ----------------------------------------
   // In a builder tool it seems that the OverlayLayout
   // makes the MapBean fail to resize. And since it has
   // no children by default, it has no size. So I add
   // a null Layer here to give it a default size.
   // ----------------------------------------
   if (java.beans.Beans.isDesignTime()) {
      add(new Layer() {
         public void projectionChanged(ProjectionEvent e) {
         }

         public Dimension getPreferredSize() {
            return new Dimension(100, 100);
         }
      });
   }

   setPreferredSize(new Dimension(projection.getWidth(), projection.getHeight()));

   DEBUG_TIMESTAMP = logger.isLoggable(Level.FINER);
   DEBUG_THREAD = logger.isLoggable(Level.FINER);
}
项目:Scribbling    文件:JSketchCanvas.java   
public JSketchCanvas()
{
    setLayout(new OverlayLayout(this));

    background = new BackgroundImagePanel();
    add(background, 0);

    drawPanel = new JDrawPanel();
    add(drawPanel, 0);
}
项目:chipster    文件:TrackGroup.java   
public TrackGroup(GBrowserView view) {
      this.view = view;
      component.setLayout(new GridBagLayout());    
      component.setInheritsPopupMenu(true);
      //Usually track fills the whole track group and listen for these events. 
      //When the height of the settings panel exceeds the height of the tracks, also the 
      //TrackGroup becomes visible and has to listen for events.
      component.addMouseListener(getView());
      component.addMouseMotionListener(getView());
      component.addMouseWheelListener(getView());

      component.setBackground(Color.white);     

component.setLayout(new OverlayLayout(component));              

trackLayer = new JPanel();
settingsLayer = new JPanel();

trackLayer.setInheritsPopupMenu(true);
settingsLayer.setInheritsPopupMenu(true);

//First component added is the topmost when drawn
component.add(settingsLayer);
component.add(trackLayer);      

trackLayer.setLayout(new MigLayout("flowy, fillx, gap 0! 0!, insets 0"));
settingsLayer.setLayout(new MigLayout("gap 0! 0!, insets 0"));

settingsLayer.setOpaque(false);     
trackLayer.setBackground(Color.white);          
  }
项目:incubator-netbeans    文件:OverlayLayoutSupport.java   
/** Gets the supported layout manager class - OverlayLayout.
 * @return the class supported by this delegate
 */
@Override
public Class getSupportedClass() {
    return OverlayLayout.class;
}
项目:incubator-netbeans    文件:HeaderPanel.java   
private void initComponents() {
    JTable impl = new JTable(new DefaultTableModel(new Object[] { "" }, 0)); // NOI18N
    TableColumnModel colMod = impl.getColumnModel();
    final TableColumn col = colMod.getColumn(0);
    impl.setFocusable(false);
    header = new Header(colMod);
    impl.setTableHeader(header);
    header.setResizingAllowed(false);
    header.setReorderingAllowed(false);

    final TableCellRenderer renderer = header.getDefaultRenderer();
    header.setDefaultRenderer(new TableCellRenderer() {
        public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {

            Component component = renderer.getTableCellRendererComponent(
                    table, getRendererValue(), isSelected(),
                    isSelected(), row, processMouseEvents() ? 0 : 1);

            setupRenderer(component);

            col.setWidth(header.getWidth());
            return component;
        }
    });

    JScrollPane scroll = new JScrollPane(impl, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
        public Dimension getPreferredSize() { return header.getPreferredSize(); }
        public void reshape(int x, int y, int width, int height) {
            header.setPreferredSize(new Dimension(width, height));
            super.reshape(x, y, width, height);
        }
    };
    scroll.setBorder(BorderFactory.createEmptyBorder());
    scroll.setViewportBorder(BorderFactory.createEmptyBorder());

    setLayout(new OverlayLayout(this));
    add(scroll);
}
项目:VASSAL-src    文件:BoardSlot.java   
public BoardSlot(BoardPicker bp, String prompt) {
  this.prompt = prompt;
  picker = bp;
  boards = new JComboBox();
  boards.addItem(prompt);

  final String lbn[] = picker.getAllowableLocalizedBoardNames();
  for (String s : lbn) {
    boards.addItem(s);
  }
  boards.setSelectedIndex(lbn.length == 1 ? 1 : 0);
  boards.addActionListener(this);

  reverseCheckBox =
    new JCheckBox(Resources.getString("BoardPicker.flip")); //$NON-NLS-1$
  reverseCheckBox.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      if (getBoard() != null) {
        getBoard().setReversed(reverseCheckBox.isSelected());
        picker.repaint();
      }
    }
  });

  reverseCheckBox.setVisible(false);

  setLayout(new OverlayLayout(this));

  final JPanel p = new JPanel();
  final Box b = Box.createHorizontalBox();
  b.add(boards);
  b.add(reverseCheckBox);
  p.add(b);
  p.setOpaque(false);
  p.setAlignmentX(0.5F);
  final JLabel l = new JLabel(this);
  l.setAlignmentX(0.5F);

  add(p);
  add(l);

  actionPerformed(null);
}
项目:jdk8u-jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:jdk8u-jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:openjdk-jdk10    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:openjdk-jdk10    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:openjdk9    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:openjdk9    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:Advanced-Java-Tools    文件:Installer.java   
/**
 * 
 * @param title the title of the window.
 * @param res the {@link InputStream} of the file to install.
 * @param defDir the default installation directory.
 * @param exec the name of the file in {@code res} that the shortcut will
 *            link to.
 * @param scname the name of the shortcut to be created.
 */
public Installer(String title, InputStream res, File defDir, String exec,
        String scname)
{
    super(title);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // this.setTitle(title);

    pan_Welcome = new PanelWelcome(scname);
    pan_SeleDir = new PanelSeleDir(scname, defDir);
    pan_DispPro = new PanelDispPro(scname);
    pan_FinDone = new PanelFinDone(scname);

    Panel bttns = new Panel(new GridLayout(1, 2));

    Panel pan_prev = new Panel(new FlowLayout(FlowLayout.LEFT));
    btn_prev = new Button(lbl_Previous);
    pan_prev.add(btn_prev);
    btn_prev.setEnabled(false);
    btn_prev.addActionListener(this);

    Panel pan_next = new Panel(new FlowLayout(FlowLayout.RIGHT));
    btn_next = new Button(lbl_Next);
    pan_next.add(btn_next);
    btn_next.addActionListener(this);

    bttns.add(pan_prev);
    bttns.add(pan_next);

    this.add(bttns, BorderLayout.SOUTH);

    pan_overlay = new Panel();
    OverlayLayout layout = new OverlayLayout(pan_overlay);
    pan_overlay.setLayout(layout);

    pan_overlay.add(pan_Welcome);
    pan_overlay.add(pan_SeleDir);
    pan_overlay.add(pan_DispPro);
    pan_overlay.add(pan_FinDone);

    pan_overlay.getComponent(1).setVisible(false);
    pan_overlay.getComponent(2).setVisible(false);
    pan_overlay.getComponent(3).setVisible(false);

    this.add(pan_overlay, BorderLayout.NORTH);
}
项目:Advanced-Java-Tools    文件:EasyPanel.java   
public EasyPanel(int width, int height, String TITLE) {
    if (width < 0 || width > MAX_SIZE || height < 0 || height > MAX_SIZE) {
        throw new IllegalArgumentException("Illegal width/height: " + width + " x " + height);
    }

    synchronized (getClass()) {
        instances++;
        if (shutdownThread == null) {
            shutdownThread = new Thread(new Runnable() {
                // Runnable implementation; used for shutdown thread.
                public void run() {
                    try {
                        while (true) {
                            // maybe shut down the program, if no more DrawingPanels are onscreen
                            // and main has finished executing
                            if (instances == 0 && !mainIsActive()) {
                                try {
                                    System.exit(0);
                                } catch (SecurityException sex) {}
                            }

                            Thread.sleep(250);
                        }
                    } catch (Exception e) {}
                }
            });
            shutdownThread.setPriority(Thread.MIN_PRIORITY);
            shutdownThread.start();
        }
    }
    if (DEBUG) System.out.println("w=" + width + ",h=" + height);

    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {}

    //panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    //panel.setBackground(backgroundColor);


    // main window frame
    frame = new JFrame(TITLE);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setPreferredSize(new Dimension(width, height));
    frame.setSize(width, height);
    frame.setResizable(false);
    frame.setLayout(new BorderLayout());
    // listen
    frame.addComponentListener      (this);
    frame.addContainerListener      (this);
    frame.addFocusListener          (this);
    frame.addKeyListener            (this);
    frame.addMouseListener          (this);
    frame.addMouseMotionListener    (this);
    frame.addWindowListener         (this);
    frame.addWindowFocusListener    (this);
    frame.addWindowStateListener    (this);
    //frame.addActionListener         (this);
    //frame.addItemListener           (this);
    //frame.addAdjustmentListener     (this);
    //frame.addTextListener           (this);
    frame.addInputMethodListener    (this);
    frame.addHierarchyListener      (this);
    frame.addHierarchyBoundsListener(this);
    frame.addMouseWheelListener     (this);

    updateMenuBar();
    center();
    panel = new JPanel(null);
    LayoutManager overlay = new OverlayLayout(panel);
    pX = new JPanel();
    pX.setLayout(new BoxLayout(pX, BoxLayout.X_AXIS));
    pX.setPreferredSize(null);
    pX.setMinimumSize(null);
    pX.setMaximumSize(null);
    panel.setLayout(overlay);
}
项目:jdk8u_jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:jdk8u_jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:lookaside_java-1.8.0-openjdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:lookaside_java-1.8.0-openjdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:LuoYing    文件:TestSwing2.java   
private void createTabs() {
        rootPanel = new JPanel();
        rootPanel.setSize(640,480);
        rootPanel.setBackground(java.awt.Color.GREEN);
        OverlayLayout layout = new OverlayLayout(rootPanel);
        rootPanel.setLayout(layout);

        frame.getContentPane().add(rootPanel);

        Canvas canvas = createCanvas();
        canvas.setSize(200, 100);
        JPanel canvasPanel = new JPanel();
        canvasPanel.setSize(200, 100);
        canvasPanel.add(canvas);
        canvasPanel.setOpaque(false);


//        JFXPanel jfxPanel = new JFXPanel();
//        jfxPanel.setSize(100, 200);

        JPanel awtJfxPanel = new JPanel();
        awtJfxPanel.setOpaque(false);
        awtJfxPanel.setSize(100, 200);
//        awtJfxPanel.setBackground(java.awt.Color.red);

//        awtJfxPanel.add(jfxPanel);
        awtJfxPanel.add(new JButton("This button is on awtJfxPanel"));

        rootPanel.add(awtJfxPanel);
        rootPanel.add(canvasPanel);


//        Platform.runLater(() -> {
//            Button btn = new Button("Hello JFX!");
//            StackPane root = new StackPane();
//            root.setBackground(Background.EMPTY);
//            root.getChildren().add(btn);
////            root.setStyle("-fx-background-color: transparent;");
////            root.setStyle("-fx-background-color:#0000FF;");
//
//            Scene scene = new Scene(root);
//            scene.setFill(Color.TRANSPARENT);
//
//            jfxPanel.setScene(scene);
//
//        });
    }
项目:mzmine2    文件:PeakStatusCellRenderer.java   
/**
    * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
    *      java.lang.Object, boolean, boolean, int, int)
    */
   public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {

JPanel newPanel = new JPanel();
newPanel.setLayout(new OverlayLayout(newPanel));

Color bgColor;

if (isSelected)
    bgColor = table.getSelectionBackground();
else
    bgColor = table.getBackground();

newPanel.setBackground(bgColor);

if (hasFocus) {
    Border border = null;
    if (isSelected)
    border = UIManager
        .getBorder("Table.focusSelectedCellHighlightBorder");
    if (border == null)
    border = UIManager.getBorder("Table.focusCellHighlightBorder");

    /*
     * The "border.getBorderInsets(newPanel) != null" is a workaround
     * for OpenJDK 1.6.0 bug, otherwise setBorder() may throw a
     * NullPointerException
     */
    if ((border != null) && (border.getBorderInsets(newPanel) != null)) {
    newPanel.setBorder(border);
    }

}

if (value != null) {
    FeatureStatus status = (FeatureStatus) value;

    switch (status) {
    case DETECTED:
    newPanel.add(greenCircle);
    break;
    case ESTIMATED:
    newPanel.add(yellowCircle);
    break;
    case MANUAL:
    newPanel.add(orangeCircle);
    break;
    default:
    newPanel.add(redCircle);
    break;
    }

    newPanel.setToolTipText(status.toString());

} else {
    newPanel.add(redCircle);
}

return newPanel;

   }
项目:mzmine2    文件:ComponentCellRenderer.java   
/**
    * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
    *      java.lang.Object, boolean, boolean, int, int)
    */
   public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {

JPanel newPanel = new JPanel();
newPanel.setLayout(new OverlayLayout(newPanel));

Color bgColor;

if (isSelected)
    bgColor = table.getSelectionBackground();
else
    bgColor = table.getBackground();

newPanel.setBackground(bgColor);

if (hasFocus) {
    Border border = null;
    if (isSelected)
    border = UIManager
        .getBorder("Table.focusSelectedCellHighlightBorder");
    if (border == null)
    border = UIManager.getBorder("Table.focusCellHighlightBorder");
    if (border != null)
    newPanel.setBorder(border);
}

if (value != null) {

    if (value instanceof JComponent) {

    newPanel.add((JComponent) value);

    } else {

    JLabel newLabel = new JLabel();
    if (value instanceof IIsotope) {
        IIsotope is = (IIsotope) value;
        newLabel.setText(is.getSymbol());
    } else {
        newLabel.setText(value.toString());
    }

    if (font != null)
        newLabel.setFont(font);
    else if (table.getFont() != null)
        newLabel.setFont(table.getFont());

    newPanel.add(newLabel);
    }

    if (createTooltips)
    newPanel.setToolTipText(value.toString());

}

return newPanel;

   }
项目:mzmine2    文件:ComponentCellRenderer.java   
/**
    * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList,
    *      java.lang.Object, int, boolean, boolean)
    */
   public Component getListCellRendererComponent(JList<?> list, Object value,
    int index, boolean isSelected, boolean hasFocus) {

JPanel newPanel = new JPanel();
newPanel.setLayout(new OverlayLayout(newPanel));

Color bgColor;

if (isSelected)
    bgColor = list.getSelectionBackground();
else
    bgColor = list.getBackground();

newPanel.setBackground(bgColor);

if (hasFocus) {
    Border border = null;
    if (isSelected)
    border = UIManager
        .getBorder("List.focusSelectedCellHighlightBorder");
    if (border == null)
    border = UIManager.getBorder("List.focusCellHighlightBorder");
    if (border != null)
    newPanel.setBorder(border);
}

if (value != null) {

    if (value instanceof JComponent) {

    newPanel.add((JComponent) value);

    } else {

    JLabel newLabel = new JLabel(value.toString());

    if (font != null)
        newLabel.setFont(font);
    else if (list.getFont() != null)
        newLabel.setFont(list.getFont());

    newPanel.add(newLabel);
    }
}

return newPanel;

   }
项目:infobip-open-jdk-8    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:infobip-open-jdk-8    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:jdk8u-dev-jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}
项目:jdk8u-dev-jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getAnotherObject() {
    return null; // TODO: could not update property
    // return new OverlayLayout(new JPanel());
}
项目:vassal    文件:BoardSlot.java   
public BoardSlot(BoardPicker bp, String prompt) {
  this.prompt = prompt;
  picker = bp;
  boards = new JComboBox();
  boards.addItem(prompt);

  final String lbn[] = picker.getAllowableLocalizedBoardNames();
  for (String s : lbn) {
    boards.addItem(s);
  }
  boards.setSelectedIndex(lbn.length == 1 ? 1 : 0);
  boards.addActionListener(this);

  reverseCheckBox =
    new JCheckBox(Resources.getString("BoardPicker.flip")); //$NON-NLS-1$
  reverseCheckBox.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      if (getBoard() != null) {
        getBoard().setReversed(reverseCheckBox.isSelected());
        picker.repaint();
      }
    }
  });

  reverseCheckBox.setVisible(false);

  setLayout(new OverlayLayout(this));

  final JPanel p = new JPanel();
  final Box b = Box.createHorizontalBox();
  b.add(boards);
  b.add(reverseCheckBox);
  p.add(b);
  p.setOpaque(false);
  p.setAlignmentX(0.5F);
  final JLabel l = new JLabel(this);
  l.setAlignmentX(0.5F);

  add(p);
  add(l);

  actionPerformed(null);
}
项目:jdk7-jdk    文件:javax_swing_OverlayLayout.java   
protected OverlayLayout getObject() {
    return new OverlayLayout(new JLabel("TEST"));
}