本文整理汇总了Java中javax.swing.JFrame.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.setPreferredSize方法的具体用法?Java JFrame.setPreferredSize怎么用?Java JFrame.setPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setPreferredSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
displayAPSEnable=true;
resetBuffer = new float[sx * sy][NUM_CAMERAS];
signalBuffer = new float[sx * sy][NUM_CAMERAS];
displayFrame = new float[sx * sy][NUM_CAMERAS];
displayBuffer = new float[sx * sy][NUM_CAMERAS];
apsDisplayPixmapBuffer = new float[3 * sx * sy][NUM_CAMERAS];
for (int c=0; c< NUM_CAMERAS; c++){
apsDisplay[c] = ImageDisplay.createOpenGLCanvas();
apsFrame = new JFrame("APS Camera " + c);
apsFrame.setPreferredSize(new Dimension(400, 400));
apsFrame.getContentPane().add(apsDisplay[c], BorderLayout.CENTER);
apsFrame.setVisible(true);
apsFrame.pack();
apsDisplay[c].setImageSize(sx, sy);
}
}
示例2: demoMenu
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Start a menu that allows the user to launch a number of demos for the
* JSpikeStack package. To add a new demo to the menu:
* 1) Add the appropriate element to the "Demos" enumerator (above);
* 2) Add the button in demoMenu()
* 3) Connect the enumerator element to the appropriate function in DemoLauncher through the switch statement.
*/
public static void demoMenu()
{
JFrame frm=new JFrame();
frm.setTitle("JSpikeStack demos");
Container pane=frm.getContentPane();
JButton button;
pane.setLayout(new GridBagLayout());
addDemoButton("Network Generation Demo","Read a network From XML and let it generate",Demos.GENERATE,pane);
addDemoButton("Learning Demo","Read an AER file, initialize a random net, and run STDP learning",Demos.LEARN,pane);
addDemoButton("Convolution Demo", "Here we read data from the Silicon retina. Two output layers respond to vertically and horizontally oriented features.",Demos.CONV,pane);
addDemoButton("RC Network", "Takes retina inputs and fires them to a smoothing network.",Demos.RCNET,pane);
addDemoButton("Retina", "In this demo we mimic the behaviour of a variety of types of retinal ganglion cell.",Demos.RETINA,pane);
frm.setPreferredSize(new Dimension(500,500));
frm.pack();
frm.setVisible(true);
frm.toFront();
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例3: ApsFrameExtractor
import javax.swing.JFrame; //导入方法依赖的package包/类
public ApsFrameExtractor(final AEChip chip) {
super(chip);
apsDisplay = ImageDisplay.createOpenGLCanvas();
apsDisplay.addMouseMotionListener(new MouseInfo(apsDisplay));
apsFrame = new JFrame("APS Frame");
apsFrame.setPreferredSize(new Dimension(400, 400));
apsFrame.getContentPane().add(apsDisplay, BorderLayout.CENTER);
apsFrame.pack();
apsFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
setShowAPSFrameDisplay(false);
}
});
apsDisplayLegend = apsDisplay.addLegend("", 0, 0);
final float[] displayColor = new float[3];
displayColor[0] = 1.0f;
displayColor[1] = 1.0f;
displayColor[2] = 1.0f;
apsDisplayLegend.color = displayColor;
initFilter();
setPropertyTooltip("invertIntensity", "Inverts grey scale, e.g. for raw samples of signal level");
setPropertyTooltip("preBufferFrame", "Only display and use complete frames; otherwise display APS samples as they arrive");
setPropertyTooltip("logCompress", "Should the displayBuffer be log compressed");
setPropertyTooltip("logDecompress", "Should the logComressed displayBuffer be rendered in log scale (true) or linearly (false)");
setPropertyTooltip("displayContrast", "Gain for the rendering of the APS display");
setPropertyTooltip("displayBrightness", "Offset for the rendering of the APS display");
setPropertyTooltip("extractionMethod",
"Method to extract a frame; CDSframe is the final result after subtracting signal from reset frame. Signal and reset frames are the raw sensor output before correlated double sampling.");
setPropertyTooltip("showAPSFrameDisplay", "Shows the JFrame frame display if true");
chip.addObserver(this);
}
示例4: KernelImplementor
import javax.swing.JFrame; //导入方法依赖的package包/类
public KernelImplementor (AEChip chip) {
super(chip);
this.chip = chip;
pixelbuffer = new PixelBuffer(chip);
filterchain = new FilterChain(chip);
sizex = chip.getSizeX();
sizey = chip.getSizeY();
display = ImageDisplay.createOpenGLCanvas(); // makde a new ImageDisplay GLCanvas with default OpenGL capabilities
featureFrame = new JFrame("ImageFrameth"); // make a JFrame to hold it
featureFrame.setPreferredSize(new Dimension(sizex, sizey)); // set the window size
featureFrame.getContentPane().add(display, BorderLayout.CENTER); // add the GLCanvas to the center of the window
featureFrame.pack(); // otherwise it wont fill up the display
initFilter();
filterchain.add(new BackgroundActivityFilter(chip));
filterchain.add( pixelbuffer );
pixelbuffer.setKernelImplementor(this);
setEnclosedFilterChain(filterchain); //creates a filter chain instance and passes this object to the kernel
//method for all processing
pixelbuffer.setEnclosed(true, this);
}
示例5: PixelBuffer
import javax.swing.JFrame; //导入方法依赖的package包/类
public PixelBuffer (AEChip chip){
super(chip);
this.chip = chip;
final String sz = "Size";
setPropertyTooltip(sz, "RingBufferSize", "sets size of ring buffer");
sizex = chip.getSizeX();
sizey = chip.getSizeY();
disp = ImageDisplay.createOpenGLCanvas(); // makde a new ImageDisplay GLCanvas with default OpenGL capabilities
frame = new JFrame("ImageFrame"); // make a JFrame to hold it
frame.setPreferredSize(new Dimension(sizex, sizey)); // set the window size
frame.getContentPane().add(disp, BorderLayout.CENTER); // add the GLCanvas to the center of the window
frame.pack(); // otherwise it wont fill up the display
initFilter();
resetFilter();
}
示例6: createJavaFrame
import javax.swing.JFrame; //导入方法依赖的package包/类
private static JFrame createJavaFrame(String name, int height)
{
final Dimension min = new Dimension(20 + 400, 20 + 100);
final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
JFrame frame = new JFrame();
frame.setTitle(name);
frame.setSize(min.width, height);
frame.setMaximumSize(new Dimension(min.width, screen.height));
frame.setPreferredSize(new Dimension(min.width, height));
frame.setMinimumSize(min);
frame.setLocation(screen.width / 2 - min.width / 2, screen.height / 2 - height / 2);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
return frame;
}
示例7: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
frame = new JFrame();
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
text = new JTextArea();
try {
InputStream is =
bug4697612.class.getResourceAsStream("bug4697612.txt");
text.read(new InputStreamReader(is), null);
} catch (IOException e) {
throw new Error(e);
}
scroller = new JScrollPane(text);
frame.getContentPane().add(scroller);
frame.pack();
frame.setVisible(true);
}
示例8: test
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void test() {
JFrame frame = new JFrame();
frame.setPreferredSize(new Dimension(400, 400));
frame.setLayout(new BorderLayout());
JExpandableTextArea eta = new JExpandableTextArea(10, 20);
JScrollPane sp = new JScrollPane(eta);
JPanel panel = new JPanel();
panel.add(sp);
frame.add(panel, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
示例9: SoundDeviceSelectionUI
import javax.swing.JFrame; //导入方法依赖的package包/类
public SoundDeviceSelectionUI(List<String> _InputSoundDevices, SoundInputDeviceControl sDeviceControl) {
soundDevices = _InputSoundDevices;
this.sDeviceControl = sDeviceControl;
frame = new JFrame("Select Recording Device");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setPreferredSize(new Dimension(500, 300));
setupUI();
}
示例10: ConvolutionFeatureScheme
import javax.swing.JFrame; //导入方法依赖的package包/类
public ConvolutionFeatureScheme (AEChip chip) {
super(chip);
this.chip = chip;
pixelbuffer = new PixelBuffer(chip);
filterchain = new FilterChain(chip);
sizex = chip.getSizeX();
sizey = chip.getSizeY();
display = ImageDisplay.createOpenGLCanvas(); // makde a new ImageDisplay GLCanvas with default OpenGL capabilities
featureFrame = new JFrame("ImageFrameth"); // make a JFrame to hold it
featureFrame.setPreferredSize(new Dimension(sizex, sizey)); // set the window size
featureFrame.getContentPane().add(display, BorderLayout.CENTER); // add the GLCanvas to the center of the window
featureFrame.pack(); // otherwise it wont fill up the display
initFilter();
filterchain.add(new BackgroundActivityFilter(chip));
filterchain.add( pixelbuffer );
pixelbuffer.setConvolutionFeatureScheme(this);
setEnclosedFilterChain(filterchain); //creates a filter chain instance and passes this object to the kernel
//method for all processing
pixelbuffer.setEnclosed(true, this);
strFilePath = "C:/Users/Varad/Downloads/descriptors.txt";
}
示例11: BinaryFeatureDetector
import javax.swing.JFrame; //导入方法依赖的package包/类
public BinaryFeatureDetector (AEChip chip) {
super(chip);
this.chip = chip;
pixelbuffer = new PixelBuffer(chip);
filterchain = new FilterChain(chip);
sizex = chip.getSizeX();
sizey = chip.getSizeY();
display = ImageDisplay.createOpenGLCanvas(); // makde a new ImageDisplay GLCanvas with default OpenGL capabilities
featureFrame = new JFrame("ImageFrameth"); // make a JFrame to hold it
featureFrame.setPreferredSize(new Dimension(sizex, sizey)); // set the window size
featureFrame.getContentPane().add(display, BorderLayout.CENTER); // add the GLCanvas to the center of the window
featureFrame.pack(); // otherwise it wont fill up the display
filterchain.add(new BackgroundActivityFilter(chip));
filterchain.add( pixelbuffer );
pixelbuffer.setBinaryFeatureDetector(this);
initFilter();
setEnclosedFilterChain(filterchain); //creates a filter chain instance and passes this object to the kernel
//method for all processing
// initFilter();
pixelbuffer.setEnclosed(true, this);
// initFilter();
}
示例12: createHistogramFrame
import javax.swing.JFrame; //导入方法依赖的package包/类
public void createHistogramFrame() {
histogramFrame = new JFrame(histogramName);
histogramFrame.setPreferredSize(new Dimension(820, 620));
histogramFrame.getContentPane().setBackground(Color.white);
histogramCanvas = new HistGCanvas(histogram);
histogramFrame.getContentPane().add(histogramCanvas);
histoMouselistener = new HistogramMouselistener(histogramCanvas);
histogramFrame.addMouseListener(histoMouselistener);
histogramCanvas.addMouseListener(histoMouselistener);
histogramFrame.setVisible(true);
}
示例13: SourceSynchronizer
import javax.swing.JFrame; //导入方法依赖的package包/类
public SourceSynchronizer(ArrayList<AEViewer.Ambassador> viewerlist)
{
this(viewerlist,null);
JFrame fr=new JFrame();
fr.setContentPane(panel);
fr.setTitle("Synchronization");
fr.setPreferredSize(new Dimension(500,300));
fr.pack();
fr.setVisible(true);
}
示例14: run
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void run() {
frame = new JFrame("Laskin");
frame.setPreferredSize(new Dimension(300, 150));
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
luoKomponentit(frame.getContentPane());
frame.pack();
frame.setVisible(true);
}
示例15: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
logger.info("main start");
Init.initTheme();
Init.initGlobalFont(); //统一设置字体
frame = new JFrame(ConstantsUI.APP_NAME);
frame.setIconImage(ConstantsUI.IMAGE_ICON);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //得到屏幕的尺寸
frame.setBounds((int) (screenSize.width * 0.1), (int) (screenSize.height * 0.08), (int) (screenSize.width * 0.8),
(int) (screenSize.height * 0.8));
Dimension preferSize = new Dimension((int) (screenSize.width * 0.8),
(int) (screenSize.height * 0.8));
frame.setPreferredSize(preferSize);
mainWindow = new MainWindow();
frame.setContentPane(mainWindow.mainPanel);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.pack();
frame.setVisible(true);
Init.initOthers();
Init.initAllTab();
// 添加事件监听
AboutListener.addListeners();
SettingListener.addListeners();
MsgListener.addListeners();
MemberListener.addListeners();
PushListener.addListeners();
ScheduleListener.addListeners();
TabListener.addListeners();
FramListener.addListeners();
}