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


Java JFrame.setLocationRelativeTo方法代码示例

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


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

示例1: drawAndSave

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void drawAndSave(JPanel graphDrawing, String fileName) {
    JFrame frame = new JFrame("Drawing");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(graphDrawing);
    frame.setSize(500, 500);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    exportToImage("jpg", graphDrawing, fileName);
    frame.dispose();
}
 
开发者ID:tslaats,项目名称:SE2017-Team1,代码行数:11,代码来源:TestUtil.java

示例2: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {

		JFrame frame = new JFrame("Displacement plot");
		frame.setSize(new Dimension(800, 300));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.getContentPane().add(new RegularBinningTest());
        frame.setVisible(true);
	        
	}
 
开发者ID:hamdikavak,项目名称:human-mobility-modeling-utilities,代码行数:11,代码来源:RegularBinningTest.java

示例3: showtext

import javax.swing.JFrame; //导入方法依赖的package包/类
/** Display a simple non-modal window showing some text. */
public static JFrame showtext(String title, String text) {
   JFrame window = new JFrame(title);
   JButton done = new JButton("Close");
   done.addActionListener(Runner.createDispose(window));
   JScrollPane scrollPane = OurUtil.scrollpane(OurUtil.textarea(text, 20, 60, false, false));
   window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   window.getContentPane().setLayout(new BorderLayout());
   window.getContentPane().add(scrollPane, BorderLayout.CENTER);
   window.getContentPane().add(done, BorderLayout.SOUTH);
   window.pack();
   window.setSize(500, 500);
   window.setLocationRelativeTo(null);
   window.setVisible(true);
   return window;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:17,代码来源:OurDialog.java

示例4: createAndShowGUI

import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
  JFrame frame = new JFrame("Extended Speech Services Example");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.add(new ExtendedExample());
  frame.pack();
  frame.setVisible(true);
  frame.setLocationRelativeTo(null);
}
 
开发者ID:Azure-Samples,项目名称:SpeechToText-REST,代码行数:9,代码来源:ExtendedExample.java

示例5: createFrame

import javax.swing.JFrame; //导入方法依赖的package包/类
private JFrame createFrame() {
    JFrame frame = new JFrame(getClass().getName());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(new Dimension(600, 400));
    frame.setLocationRelativeTo(null);
    return frame;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:KeyboardPopupSwitcherTestHid.java

示例6: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
    JFrame frame = new JFrame("Poisson Distribution");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().add(new PoissonDistributionDemo());
    frame.setVisible(true);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:8,代码来源:PoissonDistributionDemo.java

示例7: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
    JFrame frame = new JFrame("D4 Wavelet");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.add(new D4WaveletDemo());
    frame.setVisible(true);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:8,代码来源:D4WaveletDemo.java

示例8: ExtractWindow

import javax.swing.JFrame; //导入方法依赖的package包/类
public ExtractWindow(String zipName, Logger log) {
	this.zipName = zipName;
	this.log = log;

	frame = new JFrame();
	frame.setTitle("Extracting Files");
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setSize(300, 80);
	frame.setLocationRelativeTo(null);
	frame.setResizable(false);
	frame.setLayout(null);
	
	panel = new JPanel();
	frame.add(panel);
	
	init();
}
 
开发者ID:JudgeGlass,项目名称:Install_Builder_Universal,代码行数:18,代码来源:ExtractWindow.java

示例9: constructTestUI

import javax.swing.JFrame; //导入方法依赖的package包/类
private static void constructTestUI() {
    testFrame = new JFrame();
    testFrame.setSize(600, 600);
    testFrame.setResizable(false);
    testFrame.getContentPane().add(new TransparentVImage());

    testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    testFrame.setLocationRelativeTo(null);
    testFrame.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TransparentVImage.java

示例10: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
    try {
        RESParser parser = new RESParser();
        AttributeDataset data = parser.parse("RES", smile.data.parser.IOUtils.getTestDataFile("microarray/all_aml_test.res"));
        
        double[][] x = data.toArray(new double[data.size()][]);
        String[] genes = data.toArray(new String[data.size()]);
        String[] arrays = new String[data.attributes().length];
        for (int i = 0; i < arrays.length; i++) {
            arrays[i] = data.attributes()[i].getName();
        }

        JFrame frame = new JFrame("Heatmap");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.getContentPane().add(Heatmap.plot(genes, arrays, x, Palette.jet(256)));
        frame.setVisible(true);
    } catch (Exception ex) {
        System.err.println(ex);
    }
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:22,代码来源:HeatmapDemo.java

示例11: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
    JFrame frame = new JFrame("Bernoulli Distribution");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().add(new BernoulliDistributionDemo());
    frame.setVisible(true);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:8,代码来源:BernoulliDistributionDemo.java

示例12: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args)
	{
//		System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
//		logger.info(Core.VERSION);
		final ArrayList<File> animalFiles = new ArrayList<File>();
		final JFrame frame = new JFrame();
		frame.setSize(200, 100);
		
		
		frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
		
		final JButton createModelButton = new JButton("create model");
		JButton compareButton = new JButton("compare");
		
		createModelButton.addActionListener(new ActionListener() {
			

			public void actionPerformed(ActionEvent e) {
				dir = FileUtils.selectDirectory(frame, "select folder with (old) .zoo-files to create model");
				ArrayList<File> animalFile = new ArrayList<File>();
				FileUtils.getImages(dir, animalFile, true);
				createModelButton.setText("CREATING!");
				try {
					generateCodeBook(animalFile, new File(osBaseDir + "_.json"));
				} catch (IOException e1) {
					e1.printStackTrace();
				}
				createModelButton.setText("DONE!");
				createModelButton.setEnabled(false);
			}
		});
		
		frame.add(createModelButton);
//		frame.add(compareButton);
		
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			
	}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:41,代码来源:VisualSortDemo.java

示例13: initLayerManager

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void initLayerManager() {

		JFrame d = new JFrame();
		d.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false);
			}
		});
		LayerManager lm;
		
		//use existing layer manager if it already exists
		if (layerManager != null) {
			lm = layerManager;
		} else {
			lm = new LayerManager();
		}
		
		lm.setLayerList( toLayerList(map.overlays) );
		lm.setMap(map);

		lm.setDialog(d);
		JScrollPane sp = new JScrollPane(lm);
		sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		d.setTitle("Layer Manager");
		d.setContentPane(sp);
//		d.getContentPane().add(sp);
		d.pack();
		d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55));
		d.setMaximumSize(new Dimension(400,300));

		d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
		d.setLocationRelativeTo(frame);
		d.setState(Frame.NORMAL);
		d.setAlwaysOnTop(true);
		this.layerManager = lm;
		this.layerManagerDialog = d;	
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:38,代码来源:MapApp.java

示例14: createUI

import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createUI() {
    frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(300, 300);
    frame.setLocationRelativeTo(null);
    final JDesktopPane pane = new JDesktopPane();
    final JPanel panel = new JPanel() {
        @Override
        protected void paintComponent(Graphics g) {
            g.setColor(color);
            g.fillRect(0, 0, getWidth(), getHeight());
        }
    };
    jif = new JInternalFrame();
    jif.add(panel);
    jif.setVisible(true);
    jif.setSize(300, 300);
    pane.add(jif);
    frame.add(pane);
    frame.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:DockIconRepaint.java

示例15: InstallBuilderWindow

import javax.swing.JFrame; //导入方法依赖的package包/类
/** Makes The Window */
public InstallBuilderWindow(final String title, final Logger log) {
	
	this.log = log;
	frame = new JFrame();
	frame.setTitle(title);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setSize(WIDTH, HEIGHT);
	frame.setLocationRelativeTo(null);
	frame.setLayout(null);
	frame.setResizable(false);
	
	panel = new JPanel();
	frame.add(panel);
	
	log.Info("Initializing Components...");
	initialize();
	log.Info("Initialized components successfully!");
}
 
开发者ID:JudgeGlass,项目名称:Install_Builder_Universal,代码行数:20,代码来源:InstallBuilderWindow.java


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