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


Java JPanel.setVisible方法代码示例

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


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

示例1: init

import javax.swing.JPanel; //导入方法依赖的package包/类
protected void init(){
	agentPanels = new ArrayList<AgentPanel>();
	configPanel = new ConfigPanel(controller, model);

	this.setSize(configPanel.levelButtons.size() * 300 + 300, screenHeight/2);
	LayoutHelper.putGrid(this.getContentPane(), configPanel, 0, 0, 1,1, 1.0, 1.0);

	agentConfigPanel = new JPanel();
	GridBagLayout gBL = new GridBagLayout();
	gBL.rowWeights = new double[] {};
	gBL.columnWeights = new double[] {};
	agentConfigPanel.setLayout(gBL);
	agentConfigPanel.setVisible(true);

	LayoutHelper.putGrid(this.getContentPane(), agentConfigPanel, 0, 1, 1,1, 1.0, 1.0);
}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:17,代码来源:StartGuiView.java

示例2: initialize

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Initialize the contents of the frame.
 */
public void initialize(){
	JPanel panel_7 = new JPanel();
	panel_7.setBounds(0, 0, 665, 415);
	frmPiattaformaGaming.getContentPane().add(panel_7);
	panel_7.setLayout(new MigLayout());
	panel_7.setVisible(true);
	
	JTextArea ta = new JTextArea();
	ta.setEditable(false);
	panel_7.add(ta);
	
	ArrayList<Recensione> al = new GiocoController(gioco).allReviews();
	for( Recensione r : al ){
		ta.setText(ta.getText() + "  - " +  r.getTesto() + "\n\n");
	}
	
	JButton btnBack = new JButton("Indietro");
	panel_7.add(btnBack, "pos 267px 345px, width 110, height 15");
	
	JScrollPane scroll = new JScrollPane(ta);
	scroll.setVerticalScrollBarPolicy ( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
	scroll.getVerticalScrollBar().setUnitIncrement(20);
	scroll.setSize(460,240);
	panel_7.add(scroll, "pos 0px 0px, width 660, height 340");
	
	btnBack.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			panel_7.setVisible(false);
			new GiocoView(frmPiattaformaGaming, utente, gioco);
	}});
}
 
开发者ID:StefanoMartella,项目名称:GamingPlatform,代码行数:35,代码来源:GiocoRecensioniView.java

示例3: hideOtherMenus

import javax.swing.JPanel; //导入方法依赖的package包/类
void hideOtherMenus(JMenu menu) {
    for(JMenu m : containerMap.keySet()) {
        if(m != menu) {
            // hide if not an ancestor of this menu
            if(!isAncestor(m,menu)) {/* && 
                    (canvas.isTopLevelMenu(m) ||
                     canvas.hasSelectedDescendants(m))
                    ) {*/
                JPanel popup = containerMap.get(m);
                popup.setVisible(false);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:VisualDesignerPopupFactory.java

示例4: showMenuPopup

import javax.swing.JPanel; //导入方法依赖的package包/类
void showMenuPopup(final JMenu menu) {
    getPopupFactory();
    // if already created then just make it visible
    if(hackedPopupFactory.containerMap.containsKey(menu)) {
        JPanel view = hackedPopupFactory.containerMap.get(menu);
        view.setVisible(true);
    } else {
        if(!isConfigured(menu)) {
            configureMenu(null, menu);
        }
        final JPopupMenu popup = menu.getPopupMenu();
        
        if(!(popup.getUI() instanceof VisualDesignerPopupMenuUI)) {
            popup.setUI(new VisualDesignerPopupMenuUI(this, popup.getUI()));
        }
        if (menu.isShowing()) {
            //force popup view creation
            hackedPopupFactory.getPopup(menu, null, 0, 0);
            
            // do later so that the component will definitely be on screen by then
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    try {
                        popup.show(menu,0,menu.getHeight());
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        //ignore anyexceptions caused by showing the popups
                    }
                    
                }
            });
        }
    }
    this.validate();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:MenuEditLayer.java

示例5: unconfigureMenu

import javax.swing.JPanel; //导入方法依赖的package包/类
private void unconfigureMenu(final JMenu menu) {
    if (hackedPopupFactory == null) return; // Issue 145981

    // restore the UI
    menu.getPopupMenu().setUI(menuPopupUIMap.get(menu));
    
    // restore all children
    JPanel popup = hackedPopupFactory.containerMap.get(menu);
    if(popup != null) {
        for(Component c : popup.getComponents()) {
            if(c instanceof JMenu) {
                unconfigureMenu((JMenu)c);
            } else {
                unconfigureMenuItem((JComponent) c);
            }
        }
        
        //hide the popup(s) if it's still visible
        if(menu.getPopupMenu() != null) {
            menu.getPopupMenu().setVisible(false);
        }
        popup.setVisible(false);
        //layers.remove(popup);
    }
    VisualDesignerJPanelPopup pop = hackedPopupFactory.getPopup(menu);
    if(pop != null) {
        pop.hide();
    }
    if(popup != null) {
        popup.setVisible(false);
    }
    menu.setPopupMenuVisible(false);
    hackedPopupFactory.containerMap.remove(menu);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:MenuEditLayer.java

示例6: initComponents

import javax.swing.JPanel; //导入方法依赖的package包/类
private void initComponents() {
    setLayout(new BorderLayout());

    final JPanel staticFieldsBrowserPanel = classesController.getStaticFieldsBrowserController().getPanel();
    staticFieldsBrowserPanel.setPreferredSize(new Dimension(250, 500));
    staticFieldsBrowserPanel.setVisible(false);

    contentsSplit = new JExtendedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                           classesController.getClassesListController().getPanel(), staticFieldsBrowserPanel);
    contentsSplit.setResizeWeight(1d);

    final JPanel legendPanel = new LegendPanel(false);
    legendPanel.setVisible(false);

    tweakSplitPaneUI(contentsSplit);

    add(contentsSplit, BorderLayout.CENTER);
    add(legendPanel, BorderLayout.SOUTH);

    staticFieldsBrowserPanel.addHierarchyListener(new HierarchyListener() {
            public void hierarchyChanged(HierarchyEvent e) {
                if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                    legendPanel.setVisible(staticFieldsBrowserPanel.isShowing());
                }
            }
        });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ClassesControllerUI.java

示例7: CollapsablePanel

import javax.swing.JPanel; //导入方法依赖的package包/类
public CollapsablePanel(String title, JPanel contentPanel) {  
    super(new GridBagLayout());  
    this.title = title;
    
    GridBagConstraints gbc = new GridBagConstraints();  
    gbc.insets = new Insets(1, 3, 0, 3);  
    gbc.weightx = 1.0;  
    gbc.fill = GridBagConstraints.HORIZONTAL;  
    gbc.gridwidth = GridBagConstraints.REMAINDER;  
    
    selected = false;  
    headerPanel = new HeaderPanel();  
  
    setBackground(new Color(200, 200, 220));  
    this.contentPanel = contentPanel;  
  
    add(headerPanel, gbc);  

    
    add(contentPanel, gbc);  
    contentPanel.setVisible(false);  
  
    JLabel padding = new JLabel();  
    gbc.weighty = 1.0;  
    add(padding, gbc);  
  
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:CollapsablePanel.java

示例8: createPreview

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * 
 */
protected JComponent createPreview()
{
	JPanel preview = new JPanel();
	preview.setBorder(mxSwingConstants.PREVIEW_BORDER);
	preview.setOpaque(false);
	preview.setVisible(false);

	return preview;
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:13,代码来源:mxVertexHandler.java

示例9: createPreview

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * 
 */
protected JComponent createPreview() {
  JPanel preview = new JPanel();
  preview.setBorder(mxSwingConstants.PREVIEW_BORDER);
  preview.setOpaque(false);
  preview.setVisible(false);

  return preview;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:mxVertexHandler.java

示例10: addTo

import javax.swing.JPanel; //导入方法依赖的package包/类
public void addTo(Buildable b) {
  //Create the turn window
  turnWindow = new TurnWindow();
  turnWindow.pack();
  turnWindow.setVisible(false);

  launchWidget = new JPanel();
  launchWidget.setLayout(new BorderLayout());
  launchWidget.setBorder(BorderFactory.createEtchedBorder());
  GameModule.getGameModule().getToolBar().add(launchWidget);
  launchWidget.setAlignmentY(0.0F);
  launchWidget.setVisible(false);

  GameModule.getGameModule().getToolBar().add(launch);
  launch.setAlignmentY(0.0F);
  launch.setEnabled(false);

  setDocked(isDocked());

  GameModule.getGameModule().addCommandEncoder(this);
  GameModule.getGameModule().getGameState().addGameComponent(this);
  idMgr.add(this);

  //Global Property support
  lastCommand.addTo((MutablePropertiesContainer) b);
  lastTurn.addTo((MutablePropertiesContainer) b);

}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:29,代码来源:TurnTracker.java

示例11: add

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Adds a panel to show information
 *
 * @param panel The panel to add.
 * @param internalTop The top position.
 * @param internalHeight The enclosing height.
 */
private void add(JPanel panel, int internalTop, int internalHeight) {
    panel.setVisible(false);
    panel.setLocation((getWidth() - panel.getWidth()) / 2, internalTop
            + (internalHeight - panel.getHeight()) / 2);
    add(panel);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:14,代码来源:InfoPanel.java

示例12: MainWindow

import javax.swing.JPanel; //导入方法依赖的package包/类
public MainWindow() {
	workspace = new Workspace();
	barMenu = new MenuBar(workspace);
	queryList = new QueryList();
	console = new Console();
	databaseViewerPanel = new DatabaseViewer();

	setLocale(new Locale(DEFAULT_LANG));
	setResourceBundle(ResourceBundle.getBundle(BUNDLES_LOCATION, getLocale()));

	mainContainer = new JPanel(new BorderLayout());
	JPanel rightPanel = new JPanel(new BorderLayout());
	JPanel rightInnerPanel = new JPanel(new BorderLayout());
	
	rightInnerPanel.add(queryList, BorderLayout.WEST);
	rightInnerPanel.add(workspace, BorderLayout.CENTER);
	
	// HORIZONTAL SPLITPANE
	horSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
			rightInnerPanel, console);
	horSplitPane.setOneTouchExpandable(true);
	setUpHorSplitPaneHeight();
	
	// VERTICAL SPLITPANE
	//JSplitPane verSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, 
		//	databaseViewerPanel, rightPanel);
	//verSplitPane.setResizeWeight(VERTICAL_SPLITPANE_DEFAULT_WEIGHT);
	//verSplitPane.setOneTouchExpandable(true);
	
	rightPanel.add(horSplitPane, BorderLayout.CENTER);
	mainContainer.setBorder(new EmptyBorder(BORDER_GAP, BORDER_GAP, BORDER_GAP, BORDER_GAP));
	
	setLayout(new BorderLayout());
	mainContainer.add(databaseViewerPanel, BorderLayout.WEST);
	mainContainer.add(horSplitPane);
	add(mainContainer, BorderLayout.CENTER);
	
	mainContainer.setVisible(false);
	setJMenuBar(barMenu);
	setListeners();
	buildWindow();
	
	// Make relational algebra code editor focused
	addWindowFocusListener(new WindowAdapter() {
	    public void windowGainedFocus(WindowEvent e) {
	        getWorkspace().getRelationalAlgebraCodeEditor().requestFocusInWindow();
	    }
	});
	
	/**
	 * Redirect System.out to the console in the GUI.
	 */
	redirectOutputToConsole();

	translate();
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:57,代码来源:MainWindow.java

示例13: showProgress

import javax.swing.JPanel; //导入方法依赖的package包/类
protected void showProgress() {
    JPanel p = getProgressPanel();
    p.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:VCSCommitPanel.java

示例14: createContainer

import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createContainer(ProfilerFeature feature) {
    JPanel container = new JPanel(new BorderLayout(0, 0));
    container.putClientProperty(ProfilerFeature.class, feature);
    
    JPanel results = feature.getResultsUI();
    JPanel xresults = new JPanel(new BorderLayout()) {
        public void paint(Graphics g) {
            super.paint(g);
            if (hintLabel != null) {
                Dimension dim = hintLabel.getSize();
                int x = (getWidth() - dim.width) / 2;
                int y = (getHeight() - dim.height) / 2;
                
                g.setColor(hintColor);
                g.fillRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
                g.setColor(Color.LIGHT_GRAY);
                g.drawRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
                
                g.translate(x, y);
                hintLabel.paint(g);
                g.translate(-x, -y);
            }
        }
    };
    xresults.add(results, BorderLayout.CENTER);
    container.add(xresults, BorderLayout.CENTER);
    
    JPanel settings = feature.getSettingsUI();
    if (settings != null) {
        JPanel pan = new JPanel(new BorderLayout(0, 0)) {
            public void setVisible(boolean visible) {
                super.setVisible(visible);
                for (Component c : getComponents()) c.setVisible(visible);
            }
        };
        pan.setOpaque(true);
        pan.setBackground(UIUtils.getProfilerResultsBackground());
        pan.add(settings, BorderLayout.CENTER);
        JSeparator sep = UIUtils.createHorizontalLine(pan.getBackground());
        pan.add(sep, BorderLayout.SOUTH);
        pan.setVisible(settings.isVisible());
        container.add(pan, BorderLayout.NORTH);
    }
    
    return container;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:FeaturesView.java

示例15: hideSection

import javax.swing.JPanel; //导入方法依赖的package包/类
private void hideSection(JPanel sectionPanel) {
    sectionPanel.setVisible(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:CommitPanel.java


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