Here you can find the source of getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl)
Parameter | Description |
---|---|
gui | the Component to place in the window |
windowName | the title of the frame |
cl | the listener to associate with the palette |
public static JFrame getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl)
//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; } }