當前位置: 首頁>>代碼示例>>Java>>正文


Java JFrame.setDefaultCloseOperation方法代碼示例

本文整理匯總了Java中javax.swing.JFrame.setDefaultCloseOperation方法的典型用法代碼示例。如果您正苦於以下問題:Java JFrame.setDefaultCloseOperation方法的具體用法?Java JFrame.setDefaultCloseOperation怎麽用?Java JFrame.setDefaultCloseOperation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.setDefaultCloseOperation方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: createAndShowGUI

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */
public static JFrame createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("DropDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    JComponent newContentPane = new DropDemo();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
    return frame;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:DropDemo.java

示例4: createFrame

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * Convenience method for creating a JFrame that displays the graph
 * @param <V>
 * @param <E>
 * @param graph
 * @param observers
 * @return
 */
public static <V, E> JFrame createFrame(Graph<V, E> graph, EventObserver<V>...observers) {
    GraphVisualizationPanel<V, E> panel = factory(graph);
    for (EventObserver<V> eo : observers) panel.EVENT_SELECT_VERTEX.addObserver(eo);
    
    // Check for a graph name
    Class<?> clazz = graph.getClass();
    String title = clazz.getCanonicalName();
    try {
        Method handle = clazz.getMethod("getName");
        if (handle != null) {
            title = handle.invoke(graph).toString();
        }
    } catch (Exception ex) {
        // Ignore anything that gets thrown at us...
    }
    
    JFrame ret = new JFrame(title);
    ret.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ret.setLayout(new BorderLayout());
    ret.setContentPane(panel);
    ret.setSize(650, 650);
    return (ret);
}
 
開發者ID:s-store,項目名稱:s-store,代碼行數:32,代碼來源:GraphVisualizationPanel.java

示例5: createAndShowGUI

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 */
private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("PopupMenuDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create/set menu bar and content pane.
    PopupMenuDemo demo = new PopupMenuDemo();
    frame.setJMenuBar(demo.createMenuBar());
    frame.setContentPane(demo.createContentPane());

    // Create and set up the popup menu.
    demo.createPopupMenu();

    // Display the window.
    frame.setSize(450, 260);
    frame.setVisible(true);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:22,代碼來源:PopupMenuDemo.java

示例6: 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

示例7: main

import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(String[] args) {
    JFrame frame = new JFrame("Histogram 3D");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().add(new Histogram3Demo());
    frame.setVisible(true);
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:8,代碼來源:Histogram3Demo.java

示例8: drawAndSave

import javax.swing.JFrame; //導入方法依賴的package包/類
public static void drawAndSave(JPanel graphDrawing, String fileName, int canvasSize) {
	JFrame frame = new JFrame("Drawing");
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.add(graphDrawing);
	frame.setSize(canvasSize, canvasSize);
	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
	exportToImage("jpg", graphDrawing, fileName);
	frame.dispose();
}
 
開發者ID:tslaats,項目名稱:SE2017-Team1,代碼行數:11,代碼來源:TestUtil.java

示例9: main

import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(String[] args) {
    JFrame frame = new JFrame("Binomial Distribution");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().add(new BinomialDistributionDemo());
    frame.setVisible(true);
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:8,代碼來源:BinomialDistributionDemo.java

示例10: main

import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(String argv[]) {
    LaplacianEigenmapDemo demo = new LaplacianEigenmapDemo();
    JFrame f = new JFrame("Laplacian Eigenmap");
    f.setSize(new Dimension(1000, 1000));
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(demo);
    f.setVisible(true);
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:10,代碼來源:LaplacianEigenmapDemo.java

示例11: initialize

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	frame = new JFrame();
	frame.setIconImage(Toolkit.getDefaultToolkit().getImage("E:\\圖片\\u=1829416607,2140971604&fm=21&gp=0.jpg"));
	frame.setType(Type.UTILITY);
	frame.setTitle("網絡電影評論情感傾向性分類");
	frame.setBounds(100, 100, 639, 412);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	JMenuBar menuBar = new JMenuBar();
	frame.setJMenuBar(menuBar);
	
	JMenu mnNewMenu = new JMenu("數據集自動標注");
	menuBar.add(mnNewMenu);
	
	JMenuItem mntmNewMenuItem_2 = new JMenuItem("自動標注");
	mnNewMenu.add(mntmNewMenuItem_2);
	
	JMenu mnNewMenu_1 = new JMenu("情感分析");
	menuBar.add(mnNewMenu_1);
	
	JMenuItem mntmNewMenuItem_3 = new JMenuItem("樸素貝葉斯算法");
	mnNewMenu_1.add(mntmNewMenuItem_3);
	
	JMenuItem mntmNewMenuItem_4 = new JMenuItem("N-Gram算法");
	mnNewMenu_1.add(mntmNewMenuItem_4);
	
	JMenuItem mntmNewMenuItem_5 = new JMenuItem("支持向量機");
	mnNewMenu_1.add(mntmNewMenuItem_5);
	
	JMenu mnNewMenu_2 = new JMenu("關於");
	menuBar.add(mnNewMenu_2);
	
	JMenuItem mntmNewMenuItem = new JMenuItem("作者");
	mnNewMenu_2.add(mntmNewMenuItem);
	
	JMenuItem mntmNewMenuItem_1 = new JMenuItem("New menu item");
	mnNewMenu_2.add(mntmNewMenuItem_1);
}
 
開發者ID:Donkey-Tao,項目名稱:sentimental-analyzer,代碼行數:42,代碼來源:Analyzer.java

示例12: main

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * a driver for this demo
 */
public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(new MultiViewDemo());
    f.pack();
    f.setVisible(true);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:11,代碼來源:MultiViewDemo.java

示例13: main

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * a driver for this demo
 */
public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(new SubLayoutDemo());
    f.pack();
    f.setVisible(true);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:11,代碼來源:SubLayoutDemo.java

示例14: GameArena

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
    * Constructor. Creates an instance of the GameArena class, and displays a window on the
    * screen upon which shapes can be drawn.
    *
    * @param width The width of the window, in pixels.
    * @param height The height of the window, in pixels.
 */
public GameArena(int width, int height)
{   
       this.arenaWidth = width;
       this.arenaHeight = height;
       this.objectCount = 0;

       // Create a window
       window = new JFrame();
       window.setTitle("Let's Play!");

       // Create a JavaFX canvas as a Swing panel.
       jfxPanel = new JFXPanel();
       jfxPanel.setPreferredSize(new java.awt.Dimension(width, height));

       window.setContentPane(jfxPanel);
       window.setResizable(false);
       window.pack();
       window.setVisible(true);
       window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       root = new Group();
       scene = new Scene(root, arenaWidth, arenaHeight, Color.BLACK);

       Platform.runLater(new Runnable() {
           @Override
           public void run() {
               initFX();
           }
       });
}
 
開發者ID:finneyj,項目名稱:GameArena,代碼行數:38,代碼來源:GameArena.java

示例15: main

import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(String[] args) {
    JFrame frame = new JFrame("Geometric Distribution");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().add(new GeometricDistributionDemo());
    frame.setVisible(true);
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:8,代碼來源:GeometricDistributionDemo.java


注:本文中的javax.swing.JFrame.setDefaultCloseOperation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。