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


Java Dialog.setLocationRelativeTo方法代码示例

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


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

示例1: showDocumentsDialog

import java.awt.Dialog; //导入方法依赖的package包/类
public static void showDocumentsDialog() {
    DocumentsDlg documentsPanel = getDefault();
    DialogDescriptor dlgDesc = new DialogDescriptor(
        documentsPanel,
        NbBundle.getMessage(DocumentsDlg.class, "CTL_DocumentsTitle"),
        true, // is modal!!
        new Object[0],
        // make "switcch to document" button default
        getDefault().jButtonActivate,
        DialogDescriptor.DEFAULT_ALIGN,
        null,
        null
    );
    dlgDesc.setHelpCtx( null ); //hide the default Help button
    final Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
    dlg.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DocumentsDlg.class, "ACSD_DocumentsDialog"));
    if( dlg instanceof JDialog ) {
        HelpCtx.setHelpIDString(((JDialog)dlg).getRootPane(), documentsPanel.getHelpCtx().getHelpID());
    }
    getDefault().updateNodes();
    
    if (getDefault().previousDialogSize != null) {
        dlg.setSize(getDefault().previousDialogSize);
        dlg.setLocationRelativeTo(null);
    }

    dlg.setVisible(true);
    getDefault().clearNodes();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:DocumentsDlg.java

示例2: implement

import java.awt.Dialog; //导入方法依赖的package包/类
public ChangeInfo implement(){
    PickOrCreateFieldPanel pnlPickOrCreateField = new PickOrCreateFieldPanel();
    pnlPickOrCreateField.setAvailableFields(getAvailableFields());
    pnlPickOrCreateField.setFileObject(fileObject);
    
    DialogDescriptor ddesc = new DialogDescriptor(pnlPickOrCreateField,
            NbBundle.getMessage(CreateId.class, "LBL_AddIDAnnotationDlgTitle"));
    ddesc.createNotificationLineSupport();
    
    Dialog dlg = DialogDisplayer.getDefault().createDialog(ddesc);
    
    pnlPickOrCreateField.setDlgDescriptor(ddesc);
    dlg.setLocationRelativeTo(null);
    dlg.setVisible(true);
    
    if (ddesc.getValue() == DialogDescriptor.OK_OPTION){
        if (pnlPickOrCreateField.wasCreateNewFieldSelected()){
            createIDField(pnlPickOrCreateField.getNewIdName(),
                    pnlPickOrCreateField.getSelectedIdType());
        } else{
            // pick existing
            String fieldName = (String) pnlPickOrCreateField.getSelectedField();
            createIDField(fieldName, null);
        }
    }
    
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:CreateId.java

示例3: implement

import java.awt.Dialog; //导入方法依赖的package包/类
public ChangeInfo implement(){
    examineTargetClass();
    boolean owningSide = isOwningSideByDefault();
    String mappedBy = getExistingFieldInRelation();
    
    if (mappedBy == null){
        // couldn't get the corresponding field automatically, display dialog
        
        CreateRelationshipPanel pnlPickOrCreateField = new CreateRelationshipPanel();
        
        pnlPickOrCreateField.setEntityClassNames(
                Utilities.getShortClassName(classHandle.getQualifiedName()),
                Utilities.getShortClassName(targetEntityClassName));
        
        pnlPickOrCreateField.setAvailableSelection(getAvailableRelationTypeSelection());
        pnlPickOrCreateField.setAvailableFields(compatibleFieldsExistingAtTargetClass);
        pnlPickOrCreateField.setDefaultFieldName(genDefaultFieldName());
        pnlPickOrCreateField.setExistingFieldNames(fieldsExistingAtTargetClass);
        
        DialogDescriptor ddesc = new DialogDescriptor(pnlPickOrCreateField,
                NbBundle.getMessage(AbstractCreateRelationshipHint.class, "LBL_CreateRelationDlgTitle",
                relationName, targetEntityClassName));
        
        pnlPickOrCreateField.setDlgDescriptor(ddesc);
        Dialog dlg = DialogDisplayer.getDefault().createDialog(ddesc);
        dlg.setLocationRelativeTo(null);
        dlg.setVisible(true);
        
        if (ddesc.getValue() == DialogDescriptor.OK_OPTION){
            String fieldName = null;
            
            if (pnlPickOrCreateField.wasCreateNewFieldSelected()){
                // create new
                fieldName = pnlPickOrCreateField.getNewIdName();
            }else{
                // pick existing
                fieldName = pnlPickOrCreateField.getSelectedField().toString();
            }
            
            owningSide = pnlPickOrCreateField.owningSide();
            mappedBy = fieldName;
        } else {
            mappedBy = null;
        }
    } else {
        owningSide = false;
    }
    
    if (mappedBy != null){
        modifyFiles(owningSide, mappedBy);
    }
    
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:55,代码来源:AbstractCreateRelationshipHint.java

示例4: optionsButtonActionPerformed

import java.awt.Dialog; //导入方法依赖的package包/类
private void optionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_optionsButtonActionPerformed
    Dialog window = new ImportOptionsDialog(this);
    window.setLocationRelativeTo(this);
    window.setVisible(true);
    updateCarelinkData();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:7,代码来源:MainFrame.java


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