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

The following examples show how to use javax.swing.JLayeredPane#setLayout() . 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: DesktopImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates a new instance of DesktopImpl */
public DesktopImpl () {
    // layered pane with absolute positioning, to enable overlapping
    layeredPane = new JLayeredPane();
    layeredPane.setLayout(new LayeredLayout());
    // desktop represents regular layer of layeredPane
    desktop = new JPanel() {
        @Override
        public boolean isOpaque() {
            if( UIManager.getBoolean( "NbMainWindow.showCustomBackground" ) ) //NOI18N
                return false;
            return super.isOpaque();
        }

        @Override
        public void updateUI() {
            Mutex.EVENT.readAccess( new Runnable() {
                @Override
                public void run() {
                    superUpdateUI();
                }
            });
        }

        private void superUpdateUI() {
            super.updateUI();
        }
    };
    desktop.setLayout(new GridBagLayout());
    Color bkColor = UIManager.getColor("NbSplitPane.background"); //NOI18N
    if( null != bkColor ) {
        desktop.setBackground(bkColor);
        desktop.setOpaque(true);
    }
    layeredPane.add(desktop);
}
 
Example 2
Source File: LayeredScrollPane.java    From Carcassonne with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a layered scroll pane and centers it for a certain grid size.
 */
public LayeredScrollPane() {
    layeredPane = new JLayeredPane();
    layeredPane.setLayout(new OverlayLayout(layeredPane));
    setViewportView(layeredPane);
    getVerticalScrollBar().setUnitIncrement(SCROLL_SPEED);
    getHorizontalScrollBar().setUnitIncrement(SCROLL_SPEED);
}
 
Example 3
Source File: CSVFormatSpecificationPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 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 ExtendedJScrollPane(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;
}
 
Example 4
Source File: ApplicationFrame.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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());
}
 
Example 5
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 6
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 7
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 8
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 9
Source File: ClusterApp.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.setLayout(new BorderLayout(0, 0));
  contentPane.setVisible(true);
  return contentPane;
}
 
Example 10
Source File: SwingClientGUI.java    From stendhal with GNU General Public License v2.0 4 votes vote down vote up
public SwingClientGUI(StendhalClient client, UserContext context,
		NotificationChannelManager channelManager, JFrame splash) {
	this.userContext = context;
	setupInternalWindowProperties();
	/*
	 * Add a layered pane for the game area, so that we can have
	 * windows on top of it
	 */
	pane = new JLayeredPane();
	pane.setLayout(new FreePlacementLayout());

	// Create the main game screen
	screen = new GameScreen(client);
	GameScreen.setDefaultScreen(screen);
	screenController = new ScreenController(screen);
	pane.addComponentListener(new GameScreenResizer(screen));

	// ... and put it on the ground layer of the pane
	pane.add(screen, Component.LEFT_ALIGNMENT, JLayeredPane.DEFAULT_LAYER);

	quitDialog = new QuitDialog();
	pane.add(quitDialog.getQuitDialog(), JLayeredPane.MODAL_LAYER);

	setupChatEntry();
	chatLogArea = createChatLog(channelManager);
	containerPanel = createContainerPanel();
	leftColumn = createLeftPanel(client);
	frame = prepareMainWindow(splash);

	setupChatText();

	setupZoneChangeListeners(client);
	setupOverallLayout();

	int divWidth = verticalSplit.getDividerSize();
	WtWindowManager.getInstance().registerSettingChangeListener(SCALE_PREFERENCE_PROPERTY,
			new ScalingSettingChangeListener(divWidth));

	setInitialWindowStates();
	frame.setVisible(true);

	/*
	 * Used by settings dialog to restore the client's dimensions back to
	 * the original width and height. Needs to be called after
	 * frame.setSize().
	 */
	frameDefaultSize = frame.getSize();
	frame.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(final WindowEvent e) {
			requestQuit(client);
		}
	});

	setupKeyHandling(client);

	locationHacksAndBugWorkaround();
	WindowUtils.restoreSize(frame);
}