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

The following examples show how to use javax.swing.JLayeredPane#setPreferredSize() . 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: CursorOverlappedPanelsTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 2
Source File: CursorOverlappedPanelsTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 3
Source File: CursorOverlappedPanelsTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 4
Source File: CursorOverlappedPanelsTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 5
Source File: CursorOverlappedPanelsTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 6
Source File: CursorOverlappedPanelsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 7
Source File: CursorOverlappedPanelsTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 8
Source File: CursorOverlappedPanelsTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 9
Source File: CursorOverlappedPanelsTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 10
Source File: CursorOverlappedPanelsTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 11
Source File: CursorOverlappedPanelsTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 12
Source File: PeriodicTablePanel.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor of the PeriodicTablePanel object
 */
public PeriodicTablePanel() {
  super();
  setLayout(new BorderLayout());
  layeredPane = new JLayeredPane();
  layeredPane.setPreferredSize(new Dimension(581, 435));
  JPanel tp = PTPanel();
  tp.setBounds(8, 85, 570, 340);

  panel = CreateLabelProperties(null);

  layeredPane.add(tp, new Integer(0));
  layeredPane.add(panel, new Integer(1));
  add(layeredPane);
}
 
Example 13
Source File: CursorOverlappedPanelsTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 14
Source File: CursorOverlappedPanelsTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    final JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(400, 400));
    JPanel enabledPanel = createPanel(new Point(10, 10), true);
    JPanel disabledPanel = createPanel(new Point(100, 100), false);
    layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
    layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);

    frame.getContentPane().add(layeredPane);
    frame.pack();
    frame.setVisible(true);
}
 
Example 15
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);

}