当前位置: 首页>>代码示例>>Java>>正文


Java JFrame.setMinimumSize方法代码示例

本文整理汇总了Java中javax.swing.JFrame.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.setMinimumSize方法的具体用法?Java JFrame.setMinimumSize怎么用?Java JFrame.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.setMinimumSize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showWarning

import javax.swing.JFrame; //导入方法依赖的package包/类
/**
 * Warning with instructions for failed library loading
 */
public static void showWarning() {
	// try to set LaF
	try {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	} catch (Exception e2) {
		// do nothing
	} //end System
	JFrame x = new JFrame();
	x.setLayout(new BorderLayout());
	x.setTitle("Libraries missing");
	x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	x.add(new JLabel(
			String.join("",
					new String[] {
							"<html>",
							"<div style=\"padding: 13px; font-size: 10px;\">",
							"Your /lib directory not contain all necessary libraries to run JInput.",
							"<br /><br />",
							"To remedy this, download the latest release of MenuSimulator from",
							"<br />",
							"https://github.com/fatmanspanda/ALTTPMenuPractice/releases",
							"<br /><br />",
							"The application will halt when you close this window.",
							"</div>",
							"</html>"
			})),
			BorderLayout.NORTH);
	x.setMinimumSize(new Dimension(500,300));
	x.setLocation(200, 200);
	x.setVisible(true);
}
 
开发者ID:fatmanspanda,项目名称:ALTTPMenuPractice,代码行数:35,代码来源:MenuPractice.java

示例2: displayCalibrationStatus

import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
protected void displayCalibrationStatus(JFrame frame) throws Exception {
      	CalibrationStatusDisplay calibDisplay = 
      			new CalibrationStatusDisplay(frame, calibrationPoints,new java.awt.geom.Point2D.Double[9]);
      	frame.setMinimumSize(new Dimension(600,300));
      	
      	frame.add(calibDisplay);
      	
      	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      	frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
      	frame.setVisible(true);
      	frame.setTitle("Calibration: "+new Date());
      	Insets insets = frame.getInsets();
      	int width = frame.getSize().width-(insets.left+insets.right);
      	int height = frame.getSize().height-(insets.top+insets.bottom);
      	calibDisplay.windowDimension = new Dimension(width,height);
      	frame.toFront();
      	calibDisplay.repaint();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:20,代码来源:SystemMouseTracker.java

示例3: 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;
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:17,代码来源:Console.java

示例4: createGUI

import javax.swing.JFrame; //导入方法依赖的package包/类
private static JFrame createGUI() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Some menu");
    menuBar.add(menu);

    for (int i = 0; i < 10; i++) {
        menu.add(new JMenuItem("Some menu #" + i));
    }

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setMinimumSize(new Dimension(200, 200));
    frame.setJMenuBar(menuBar);
    return frame;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:bug8071705.java

示例5: initialize

import javax.swing.JFrame; //导入方法依赖的package包/类
/**
 * Initialize the contents of the frame.
 */
private void initialize(String title, Rectangle bounds) {
	frame = new JFrame();
	frame.setBounds(bounds);
	frame.setMinimumSize(frame.getBounds().getSize());
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.getContentPane().setLayout(null);
	frame.setTitle(title);
	this.title = title;
	this.originalBounds = frame.getBounds();
}
 
开发者ID:Cyphereion,项目名称:Java-Swing-Helper,代码行数:14,代码来源:SwingWindow.java

示例6: createFrame

import javax.swing.JFrame; //导入方法依赖的package包/类
private JFrame createFrame(String name){
	JFrame ret = new JFrame(name);
	
	ret.getContentPane().setPreferredSize(new Dimension(0,0));
	ret.setMinimumSize(new Dimension(815, 500));
	ret.setMaximumSize(new Dimension(1920,1080));
	ret.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	return ret;		
}
 
开发者ID:KayDeeTee,项目名称:Hollow-Knight-SaveManager,代码行数:11,代码来源:GUI.java

示例7: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String... args) throws Throwable
{
	JFrame window = new JFrame();
	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	window.setTitle("What Happened to Station 7");
	window.setMinimumSize(new Dimension(400, 225));
	window.setLayout(new GridBagLayout());
	window.setExtendedState(JFrame.MAXIMIZED_BOTH);

	JFrame opening_text = new JFrame();
	opening_text.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	opening_text.setTitle("This Is What Happened to Station 7");
	JTextArea textField = new JTextArea(
			"The date is 123.5432.1241511    Station 7 is in full operation when suddenly one of the arachnids spot a rather large blue and yellow battle-cruiser barreling towards the aft section of the outer wheel. It suddenly plunges it self deep within the station. The flag suddenly comes within view… Its the swedes on their eternal quest to increase their GDP. They start to scatter but they are not quick enough to survive the army of Carl XVI Gustaf. The Dramatic entrance of the battle-cruiser had created a hull breach and the amount of air in the station was starting to drop; those blast doors can only hold so long….																																																		You Play as the aliens represented by the Purple hexes your objective is to get to the next floor of Staition 7 via the cyan ecape doors the sweds represented by the blue tiles are out to get you it would be in your best intrests to avoid them as they will kill you very quickly, if you notics your color shifting it indicats a change in helth and you will be best adviced to seek out the red health boxes but be carful as they will only heal you so much");
	textField.setLineWrap(true);
	textField.setWrapStyleWord(true);
	opening_text.setMinimumSize(new Dimension(400, 225));
	opening_text.add(textField, BorderLayout.PAGE_START);
	opening_text.setExtendedState(JFrame.MAXIMIZED_BOTH);
	opening_text.setAlwaysOnTop(true);

	JFrame closing_text = new JFrame();
	closing_text.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	closing_text.setTitle("You Have Fell to the Swedes");
	JTextArea text = new JTextArea("You have failed to save your self…. The swedes trudge on obliterating the remaining inhabitants of the station. ");
	text.setLineWrap(true);
	text.setWrapStyleWord(true);
	closing_text.setMinimumSize(new Dimension(400, 225));
	closing_text.add(text, BorderLayout.PAGE_START);
	closing_text.setExtendedState(JFrame.MAXIMIZED_BOTH);

	SoundStuff soundStuff = new SoundStuff();
	soundStuff.dbol();

	Game game = new Game();

	GameRenderer render = new GameRenderer(game);
	render.addListeners(window);
	GridBagConstraints layoutGame = new GridBagConstraints();
	layoutGame.weightx = .9;
	layoutGame.weighty = .9;
	layoutGame.fill = GridBagConstraints.BOTH;
	layoutGame.anchor = GridBagConstraints.NORTH;
	window.add(render, layoutGame);

	GameInfo info = new GameInfo(game);
	info.addListeners();
	GridBagConstraints layoutInfo = new GridBagConstraints();
	layoutInfo.weightx = .1;
	layoutInfo.weighty = .1;
	layoutInfo.fill = GridBagConstraints.BOTH;
	layoutInfo.anchor = GridBagConstraints.NORTH;
	layoutInfo.gridy = 1;
	window.add(info, layoutInfo);

	game.init(render.new UIInterface(), info.new UIInterface());

	closing_text.setVisible(true);
	window.setVisible(true);
	opening_text.setVisible(true);
	Scanner reader = new Scanner(System.in);
	int n = reader.nextInt();
	if (n == 42)
	{
		System.out.print("adadfafd");
		SoundStuff cam = null;
		cam = new SoundStuff();
		cam.CCCP();
		reader.close();
	}
}
 
开发者ID:Chroniaro,项目名称:What-Happened-to-Station-7,代码行数:72,代码来源:Station7.java

示例8: displayCalibrationStatus

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
	 double[] pointsNormalized = jniGetCalibration();
	 
	 if (pointsNormalized == null)
		 throw new IOException("Can't get calibration data!");
	 
	 int zeros = 0;
	 for( double ord: pointsNormalized){
		 if( ord <= 0 || ord > 1) zeros++;
	 }
	 ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
	 ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
	//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
	 
	 int itemCount = pointsNormalized.length/4;

	 for( int i=0; i < itemCount; i++ ){
		 
		points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
		points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
	 }
	 
	 Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
	 
	 for(Point2D.Double p: points){
		 if( !rect.contains(p) ) invalidpoints.add(p);
	 }
	 
	 for (int i = 0; i < pointsNormalized.length; i++) {
		 if (pointsNormalized[i] < 0.0001) {
			 pointsNormalized[i] = 0.0001;
		 } else if (pointsNormalized[i] > 0.9999) {
			 pointsNormalized[i] = 0.9999;
		 } else {
    		//do nothing
		 }
	 }
    
	 Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
	 for (int j = 0; j < itemCount; j+=2) {
		 calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
		 if(j != itemCount)
			 calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
	 }
	 JFrame calibFrame = frame;
	 CalibrationStatusDisplay calibDisplay = 
			 new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
	 
	 calibFrame.add(calibDisplay);
    calibFrame.setUndecorated(false);
    calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    calibFrame.setMinimumSize(new Dimension(600,300));
    calibFrame.setTitle("Calibration: "+new Date());
    Insets insets = calibFrame.getInsets();
   	int width = calibFrame.getSize().width-(insets.left+insets.right);
   	int height = calibFrame.getSize().height-(insets.top+insets.bottom);
   	calibDisplay.windowDimension = new Dimension(width,height);
    calibFrame.setVisible(true);
    calibFrame.toFront();
    calibDisplay.repaint();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:63,代码来源:EyeXTracker.java

示例9: displayCalibrationStatus

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
	 double[] pointsNormalized = jniGetCalibration();
	 
	 if (pointsNormalized == null)
		 throw new IOException("Can't get calibration data!");
	 
	 int zeros = 0;
	 for( double ord: pointsNormalized){
		 if( ord <= 0 || ord > 1) zeros++;
	 }
	 ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
	 ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
	//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
	 
	 int itemCount = pointsNormalized.length/4;

	 for( int i=0; i < itemCount; i++ ){
		 
		points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
		points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
	 }
	 
	 Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
	 
	 for(Point2D.Double p: points){
		 if( !rect.contains(p) ) invalidpoints.add(p);
	 }
	 
	 for (int i = 0; i < pointsNormalized.length; i++) {
		 if (pointsNormalized[i] < 0.0001) {
			 pointsNormalized[i] = 0.0001;
		 } else if (pointsNormalized[i] > 0.9999) {
			 pointsNormalized[i] = 0.9999;
		 } else {
    		//do nothing
		 }
	 }
    
	 Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
	 for (int j = 0; j < itemCount; j+=2) {
		 calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
		 if(j != itemCount)
			 calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
	 }
	 JFrame calibFrame = frame;
	 CalibrationStatusDisplay calibDisplay = 
			 new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
	 
	 calibFrame.add(calibDisplay);
    calibFrame.setUndecorated(false);
    calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    calibFrame.setMinimumSize(new Dimension(600,300));
    calibFrame.setTitle("Calibration: "+new Date());
    Insets insets = calibFrame.getInsets();
    int width = calibFrame.getSize().width-(insets.left+insets.right);
    int height = calibFrame.getSize().height-(insets.top+insets.bottom);
  		calibDisplay.windowDimension = new Dimension(width,height);
    calibFrame.setVisible(true);
    calibDisplay.repaint();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:62,代码来源:TobiiTracker.java

示例10: Window

import javax.swing.JFrame; //导入方法依赖的package包/类
public Window(int width, int height, String title, boolean resizable) {
	frame = new JFrame();
	game = new Game();
	
	
	frame.setMinimumSize(new Dimension(width, height));
	frame.setSize(width, height);
	
	frame.setTitle(title);
	frame.setResizable(resizable);
	
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	
	frame.add(game);
	
	frame.setLocationRelativeTo(null);
}
 
开发者ID:ProjectK47,项目名称:Mafia,代码行数:19,代码来源:Window.java


注:本文中的javax.swing.JFrame.setMinimumSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。