Java JScrollPane getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl)

Here you can find the source of getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl)

Description

Get a layer's associated palette as a top-level window

License

Open Source License

Parameter

Parameter Description
gui the Component to place in the window
windowName the title of the frame
cl the listener to associate with the palette

Return

the frame that the palette is in

Declaration

public static JFrame getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl) 

Method Source Code


//package com.java2s;
import java.awt.Component;

import java.awt.event.ComponentListener;

import javax.swing.BoxLayout;

import javax.swing.JFrame;

import javax.swing.JPanel;

public class Main {
    /**//from   w  w w .j  av a  2 s  .  c  o  m
     * Get a layer's associated palette as a top-level window
     * 
     * @param gui the Component to place in the window
     * @param windowName the title of the frame
     * @param cl the listener to associate with the palette
     * @return the frame that the palette is in
     */
    public static JFrame getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl) {

        JPanel pane = new JPanel();
        pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
        pane.setAlignmentX(Component.CENTER_ALIGNMENT);
        pane.setAlignmentY(Component.BOTTOM_ALIGNMENT);
        pane.add(gui);
        JFrame paletteWindow = new JFrame(windowName);
        paletteWindow.addComponentListener(cl);
        paletteWindow.getContentPane().add(pane);
        paletteWindow.pack();

        return paletteWindow;
    }
}

Related

  1. defaultGetAutoscrollInsets(JComponent comp)
  2. findScrollPane(Component c)
  3. findScrollPane(Component component)
  4. getContainingScroll(Component comp)
  5. getMessageScrollPane(String message)
  6. getScrollableMessage(String msg)
  7. getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane)
  8. getScrollPaneViewportSize(JScrollPane panel)
  9. hasParentScrollPane(JComponent component)