當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。