當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。