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


Java JFrame.setContentPane方法代码示例

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


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

示例1: 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.
    PopupMenuDemoX demo = new PopupMenuDemoX();
    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,代码来源:PopupMenuDemoX.java

示例2: actionPerformed

import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox) e.getSource();
    JFrame frame = getFrame(cb);
    Procedure proc = MarkovViewer.this.args.catalog_db.getProcedures()
            .get((String) cb.getSelectedItem());
    MarkovGraph g = procedureGraphs.get(
            proc);
    assert (g != null);
    GraphVisualizationPanel<MarkovVertex, MarkovEdge> graph_panel = MarkovViewer.getPanel(g);
    graph_panel.add(cb);
    frame.setContentPane(graph_panel);
    frame.setBounds(50, 50, 500, 500);
    frame.setVisible(true);
    // The BasicVisualizationServer<V,E> is parameterized by the edge
    // types
}
 
开发者ID:s-store,项目名称:s-store,代码行数:18,代码来源:MarkovViewer.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.
 */
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

示例4: 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("TreeIconDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

    // Display the window.
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:TreeIconDemo2.java

示例5: 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.
    * @param createWindow Determines if a JFrame containing the GameArena should be created (true) or not (false).
 */
public GameArena(int width, int height, boolean createWindow)
{   
       this.arenaWidth = width;
       this.arenaHeight = height;
       this.objectCount = 0;

       // Create a lock to reduce flicker on rendering
       renderLock = new ReentrantLock();

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

       // Create a window, if necessary.
       if (createWindow)
       {
           window = new JFrame();
           window.setTitle("Let's Play!");
           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);

       renderLock.lock();

       Platform.runLater(new Runnable() {
           @Override
           public void run() {
               initFX();
           }
       });
}
 
开发者ID:finneyj,项目名称:GameArena,代码行数:46,代码来源:GameArena.java

示例6: switchCurrentEditor

import javax.swing.JFrame; //导入方法依赖的package包/类
private boolean switchCurrentEditor() {
    final TopComponent tc = TopComponent.getRegistry().getActivated();
    if( null == tc || !TopComponentTracker.getDefault().isEditorTopComponent( tc ) )
        return false;

    final WindowManagerImpl wmi = WindowManagerImpl.getInstance();
    final JFrame mainWnd = ( JFrame ) wmi.getMainWindow();
    if( SwingUtilities.isDescendingFrom( tc, mainWnd.getContentPane() ) )
        return true;
    JPanel panel = new JPanel( new BorderLayout() );
    panel.add( tc, BorderLayout.CENTER  );
    try {
        mainWnd.setContentPane( panel );
    } catch( IndexOutOfBoundsException e ) {
        Logger.getLogger(EditorOnlyDisplayer.class.getName()).log(Level.INFO, "Error while switching current editor.", e);
        //#245541 - something is broken in the component hierarchy, let's try restoring to the default mode
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                cancel(false);
            }
        });
    }
    mainWnd.invalidate();
    mainWnd.revalidate();
    mainWnd.repaint();
    SwingUtilities.invokeLater( new Runnable() {
        @Override
        public void run() {
            tc.requestFocusInWindow();
        }
    });
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:EditorOnlyDisplayer.java

示例7: tourOfflinePins

import javax.swing.JFrame; //导入方法依赖的package包/类
private static void tourOfflinePins() {
    tour = new JFrame("Pinterest");
    showSplash(tour.getContentPane());
    tour.setSize(315, 235);
    tour.setResizable(false);
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    tour.setLocation(dim.width / 2 - tour.getSize().width / 2, dim.height / 2 - tour.getSize().height / 2);
    tour.setVisible(true);
    Random rnd = new Random();
    int bg = rnd.nextInt(5 - 1 + 1) + 1;
    tour.setContentPane(new JLabel(new ImageIcon("big-background/0" + bg + ".jpg")));
    tour.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
开发者ID:oniemaniego23,项目名称:offline-pins,代码行数:14,代码来源:OfflinePinterestPins.java

示例8: 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("DynamicTreeDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

    // Display the window.
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:DynamicTreeDemo.java

示例9: FullFrame

import javax.swing.JFrame; //导入方法依赖的package包/类
public FullFrame(ThornsecModel model) {
	JTabbedPane jtp = new JTabbedPane();
	for (String network : model.getNetworkLabels()) {
		jtp.add(network, getNetworkPane(model.getNetworkModel(network)));
	}

	JFrame frame = new JFrame("Thornsec");
	frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setContentPane(jtp);
	frame.pack();
	frame.setVisible(true);
}
 
开发者ID:privacyint,项目名称:thornsec-core,代码行数:14,代码来源:FullFrame.java

示例10: Frame

import javax.swing.JFrame; //导入方法依赖的package包/类
public Frame() {
	ch = new ControlHandler(this);
	size = 25;
	mode = "Map Creation";
	showSteps = true;
	btnHover = false;
	setLayout(null);
	addMouseListener(this);
	addMouseMotionListener(this);
	addMouseWheelListener(this);
	addKeyListener(this);
	setFocusable(true);
	setFocusTraversalKeysEnabled(false);

	// Set up pathfinding
	pathfinding = new APathfinding(this, size);
	pathfinding.setDiagonal(true);
	
	// Calculating value of a in speed function 1
	a1 = (5000.0000 / (Math.pow(25.0000/5000, 1/49)));
	a2 = 625.0000;
	
	// Set up window
	window = new JFrame();
	window.setContentPane(this);
	window.setTitle("A* Pathfinding Visualization");
	window.getContentPane().setPreferredSize(new Dimension(700, 600));
	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	window.pack();
	window.setLocationRelativeTo(null);
	window.setVisible(true);
	
	// Add all controls
	ch.addAll();
	
	this.revalidate();
	this.repaint();
}
 
开发者ID:DevonCrawford,项目名称:A-Pathfinding-Visualization,代码行数:39,代码来源:Frame.java

示例11: launch

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void launch(
        Map<Pair<Procedure, Integer>, MarkovGraph> partitionGraphs,
        Pair<Procedure,Integer> selection) {
    JFrame frame = new JFrame("Simple Graph View");
    JComboBox partcombo = MarkovViewer.makePartitionComboBox(partitionGraphs);
    MarkovGraph test_graph = partitionGraphs.get(selection);
    frame.setContentPane(MarkovViewer.getPanel(test_graph));
    frame.add(partcombo);
    partcombo.setSelectedItem(selection);
    frame.setBounds(50, 50, 2000, 500);
    frame.setVisible(true);
    
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:14,代码来源:MarkovViewer.java

示例12: 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);
    
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:SourceSynchronizer.java

示例13: actionPerformed

import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox) e.getSource();
    JFrame frame = (JFrame) cb.getParent().getParent().getParent().getParent();
    Pair<Procedure, Integer> proc = (Pair<Procedure, Integer>) cb.getSelectedItem();
    MarkovGraph g = partitionGraphs.get(proc);
    assert (g != null);
    GraphVisualizationPanel<MarkovVertex, MarkovEdge> graph_panel = MarkovViewer.getPanel(g);
    graph_panel.add(cb);
    frame.setContentPane(graph_panel);
    frame.setBounds(50, 50, 500, 500);
    frame.setVisible(true);

}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:MarkovViewer.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: 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("TableToolTipsDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

    // Display the window.
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:TableToolTipsDemo.java


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