Java Code Examples for javax.swing.JLayeredPane#setBounds()

The following examples show how to use javax.swing.JLayeredPane#setBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Game.java    From Open-Realms-of-Stars with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
  }
}
 
Example 2
Source File: DemoTheatreApp.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: DemoTheatreAppImproved.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: MapsAndLayersApp.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: GeoJsonApp.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: TimeResolvedAnalysisDataView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
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);

}