javax.swing.JLayeredPane#setBounds ( )源码实例Demo

下面列出了javax.swing.JLayeredPane#setBounds ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Open-Realms-of-Stars   文件: Game.java
/**
 * Update View
 * @param view about BlackPanel
 */
private void updateDisplay(final BlackPanel view) {
  if (gameFrame != null) {
    gameFrame.getContentPane().removeAll();
    layeredPane = new JLayeredPane();
    view.setBounds(0, 0, getWidth(), getHeight());
    layeredPane.setLayer(view, JLayeredPane.DEFAULT_LAYER);
    layeredPane.add(view);
    layeredPane.setBounds(0, 0, getWidth(), getHeight());
    int y = MUSIC_TEXT_TOP;
    if (view instanceof MainMenu || view instanceof ResearchView
        || view instanceof ShipView
        || view instanceof PlayerSetupView
        || view instanceof DiplomacyView) {
      y = getHeight() - MUSIC_TEXT_BOTTOM;
    }
    songText = new JLabel("Test");
    songText.setBounds(getWidth() - 374, y, 350, 150);
    songText.setFont(GuiStatics.getFontCubellanBold());
    songText.setForeground(Color.white);
    MusicFileInfo info = MusicPlayer.getNowPlaying();
    String text = "<html>Now playing: " + info.getName() + " by "
        + info.getAuthor() + "</html>";
    songText.setText(text);
    layeredPane.setLayer(songText, JLayeredPane.POPUP_LAYER);
    layeredPane.add(songText);
    if (MusicPlayer.isTextDisplayedEnough()) {
      songText.setVisible(false);
    }
    gameFrame.add(layeredPane);
    gameFrame.validate();
  }
}
 
源代码2 项目: arcgis-runtime-demo-java   文件: DemoTheatreApp.java
/**
 * Creates a content pane.
 * 
 * @return a content pane.
 */
private static JLayeredPane createContentPane() {
  JLayeredPane contentPane = new JLayeredPane();
  contentPane.setBounds(100, 100, 1000, 700);
  contentPane.setLayout(new BorderLayout(0, 0));
  contentPane.setVisible(true);
  return contentPane;
}
 
/**
 * Creates a content pane.
 * 
 * @return a content pane.
 */
private static JLayeredPane createContentPane() {
  JLayeredPane contentPane = new JLayeredPane();
  contentPane.setBounds(100, 100, 1000, 700);
  contentPane.setLayout(new BorderLayout(0, 0));
  contentPane.setVisible(true);
  return contentPane;
}
 
/**
 * Creates a content pane.
 * 
 * @return a content pane.
 */
private static JLayeredPane createContentPane() {
  JLayeredPane contentPane = new JLayeredPane();
  contentPane.setBounds(100, 100, 1000, 700);
  contentPane.setLayout(new BorderLayout(0, 0));
  contentPane.setVisible(true);
  return contentPane;
}
 
源代码5 项目: arcgis-runtime-demo-java   文件: GeoJsonApp.java
/**
 * Creates a content pane.
 * 
 * @return a content pane.
 */
private static JLayeredPane createContentPane() {
  JLayeredPane contentPane = new JLayeredPane();
  contentPane.setBounds(100, 100, 1000, 700);
  contentPane.setLayout(new BorderLayout(0, 0));
  contentPane.setVisible(true);
  return contentPane;
}
 
源代码6 项目: ET_Redux   文件: TimeResolvedAnalysisDataView.java
private void initSession() {
    setSize(1200, 850);
    SESSION_VIEW_WIDTH = massSpec.getCountOfAcquisitions() * 2;

    rawDataSessionSerialContainer = new RawDataSessionSerialContainer(//
            new Rectangle(0, 0, SESSION_VIEW_WIDTH, rawDataSessionPlotScrollPane.getHeight() - 25), massSpec.getFractionNames());
    // this forces scroll bar
    rawDataSessionSerialContainer.setPreferredSize(rawDataSessionSerialContainer.getSize());
    rawDataSessionSerialContainer.setOpaque(true);
    rawDataSessionSerialContainer.setBackground(Color.white);

    rawDataSessionPlotScrollPane.setViewportView(rawDataSessionSerialContainer);
    rawDataSessionPlotScrollPane.getHorizontalScrollBar().setUnitIncrement(1000);
    rawDataSessionPlotScrollPane.revalidate();

    // overlay of plots
    // need a placeHolderPane
    placeHolderPane = new JLayeredPane();
    placeHolderPane.setBounds(0, 0, rawDataSessionOverlayPlotScrollPane.getWidth() - 5, rawDataSessionOverlayPlotScrollPane.getHeight() - 25);
    placeHolderPane.setPreferredSize(placeHolderPane.getSize());
    rawDataSessionOverlayPlotScrollPane.setViewportView(placeHolderPane);

    rawDataSessionOverlayContainer = new RawDataSessionOverlayContainer(//
            new Rectangle(0, 0, placeHolderPane.getWidth() - 25, placeHolderPane.getHeight() - 25),//
            rawDataSessionSerialContainer);
    rawDataSessionOverlayContainer.setOpaque(true);
    rawDataSessionOverlayContainer.setBackground(Color.white);
    placeHolderPane.add(rawDataSessionOverlayContainer);

    Map<IsotopesEnum, DataModelInterface> isotopeToRawIntensitiesMap = massSpec.getIsotopeMappingModel().getIsotopeToRawIntensitiesMap();
    rawDataSessionPlots = new AbstractRawDataView[isotopeToRawIntensitiesMap.size()];
    rawDataSessionOverlayPlots = new AbstractRawDataView[isotopeToRawIntensitiesMap.size()];
    isotopeToRawIntensitiesMap.forEach((isotope, dataModel) -> {
        int index = massSpec.getVirtualCollectorModelMapToFieldIndexes().get(dataModel);
        rawDataSessionPlots[index] = new RawDataSessionPlot(dataModel, new Rectangle(0, index * 110 + 25, SESSION_VIEW_WIDTH, 100), false);
        rawDataSessionSerialContainer.add(rawDataSessionPlots[index], JLayeredPane.DEFAULT_LAYER);
        rawDataSessionPlots[index].preparePanel(true, false);
        rawDataSessionPlots[index].repaint();

        //overlays
        rawDataSessionOverlayPlots[index] = new RawDataSessionPlot(dataModel, new Rectangle(0, index * 110 + 25, placeHolderPane.getWidth() - 25, 100), true);
        rawDataSessionOverlayContainer.add(rawDataSessionOverlayPlots[index], JLayeredPane.DEFAULT_LAYER);
        rawDataSessionOverlayPlots[index].preparePanel(true, false);
        rawDataSessionOverlayPlots[index].repaint();
    });

    rawDataSessionSerialContainer.refreshPanel(true, false);
    rawDataSessionOverlayContainer.refreshPanel(true, false);

}