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


Java Panel.setVisible方法代码示例

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


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

示例1: createContentPanel

import java.awt.Panel; //导入方法依赖的package包/类
private void createContentPanel() {
	content = new Panel();
	content.setLayout(contentLayout = new GridBagLayout());
	GridBagConstraints contentConstraints = new GridBagConstraints();
	contentConstraints.gridx = 0;
	contentConstraints.gridy = 1;
	contentConstraints.gridwidth = GridBagConstraints.REMAINDER;
	contentConstraints.gridheight = GridBagConstraints.REMAINDER;
	contentConstraints.weightx = 1;
	contentConstraints.weighty = 1;
	contentConstraints.fill = GridBagConstraints.BOTH;
	headerLayout.addLayoutComponent(content, contentConstraints);
	add(content);
	content.setVisible(expanded);
}
 
开发者ID:IPEldorado,项目名称:RemoteResources,代码行数:16,代码来源:HostPanel.java

示例2: main

import java.awt.Panel; //导入方法依赖的package包/类
public static void main(String[] args) {				
	try {
		HashMap configuration = new HashMap();
		configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, OPEN_OFFICE_ORG_PATH);
		configuration.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
		final IOfficeApplication officeAplication = OfficeApplicationRuntime.getApplication(configuration);	
		
		officeAplication.setConfiguration(configuration);
		officeAplication.activate();
		
		final Frame frame = new Frame();
     frame.setVisible(true);
     frame.setSize(400, 400);
     frame.validate();
     Panel panel = new Panel(new BorderLayout());
     frame.add(panel);  
     panel.setVisible(true);
     frame.addWindowListener(new WindowAdapter() {
       public void windowClosing(WindowEvent windowEvent) {
         frame.dispose();
         try {
           officeAplication.deactivate();
         }
         catch (OfficeApplicationException applicationException) {            
         }
       }        
     }); 
     
     IFrame officeFrame = officeAplication.getDesktopService().constructNewOfficeFrame(panel);
     officeAplication.getDocumentService().constructNewDocument(officeFrame, IDocument.WRITER, DocumentDescriptor.DEFAULT);
     frame.validate();
     
     //Now it is time to disable two commands in the frame
     officeFrame.disableDispatch(GlobalCommands.CLOSE_DOCUMENT);
     officeFrame.disableDispatch(GlobalCommands.QUIT_APPLICATION);
     officeFrame.updateDispatches();
	} 
	catch (Throwable throwable) {
		throwable.printStackTrace();
	} 
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:42,代码来源:Snippet14.java

示例3: addInputSourceToDialog

import java.awt.Panel; //导入方法依赖的package包/类
/**
 * Add a list of input sources to the generic dialog. The choice field will be named inputName. If the file input
 * option
 * is true then a field will be added name 'Input_file'.
 * 
 * @param gd
 * @param inputName
 * @param inputOption
 *            The option to select by default
 * @param source
 * @param fileInput
 */
@SuppressWarnings("unused")
public static void addInputSourceToDialog(final ExtendedGenericDialog gd, String inputName, String inputOption,
		ArrayList<String> source, boolean fileInput)
{
	String[] options = source.toArray(new String[source.size()]);
	// Find the option
	inputOption = removeFormatting(inputOption);

	int optionIndex = 0;
	for (int i = 0; i < options.length; i++)
	{
		String name = removeFormatting(options[i]);
		if (name.equals(inputOption))
		{
			optionIndex = i;
			break;
		}
	}
	final Choice c = gd.addAndGetChoice(inputName, options, options[optionIndex]);
	if (fileInput)
	{
		final TextField tf = gd.addFilenameField("Input_file", inputFilename);
		final JButton b = gd.getLastOptionButton();

		// Add a listener to the choice to enable the file input field.
		// Currently we hide the filename field and pack the dialog. 
		// We may wish to just disable the fields and leave them there.
		// This could be a user configured option in a global GDSC settings class.
		if (Utils.isShowGenericDialog())
		{
			final Label l = gd.getLastLabel();
			final Panel p = gd.getLastPanel();
			ItemListener listener = new ItemListener()
			{
				public void itemStateChanged(ItemEvent e)
				{
					boolean enable = INPUT_FILE.equals(c.getSelectedItem());
					if (enable != l.isVisible())
					{
						l.setVisible(enable);
						p.setVisible(enable);
						//tf.setVisible(enable);
						//b.setVisible(enable);
						gd.pack();
					}
				}
			};

			// Run once to set up
			listener.itemStateChanged(null);

			c.addItemListener(listener);
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:68,代码来源:ResultsManager.java


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