本文整理匯總了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);
}
示例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();
}
}
示例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);
}
}
}