javax.swing.JDialog#setSize ( )源码实例Demo

下面列出了javax.swing.JDialog#setSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ThingML-Tradfri   文件: BulbPanel.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    
    try {
        //JOptionPane pane = new JOptionPane();
        //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
        JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false);
        JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n");
        msg.setFont(new Font("monospaced", Font.PLAIN, 10));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        
        dialog.getContentPane().add(scrollPane);
        dialog.setSize(350, 350);
        //dialog.pack();
        dialog.setVisible(true);
        
        
    } catch (JSONException ex) {
        Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
public WeaponManualDataImportService(
		File file,
		WeaponTableModel model,
		ArrayList<Double> dprList) {
	this.importExcelFile = file;
	this.weaponModel = model;
	this.levelDprList = dprList;
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
 
源代码3 项目: nextreports-designer   文件: RepWizard.java
public RepWizard() {
    dialog = new JDialog(Globals.getMainFrame(), I18NSupport.getString("wizard.action.name"), true);
    //dialog.setIconImage(ImageUtil.getImage("wizard.png"));
    Wizard wizard = new Wizard(new StartWizardPanel());
    wizard.getContext().setAttribute(WizardConstants.MAIN_FRAME, dialog);
    wizard.addWizardListener(this);
    dialog.setContentPane(wizard);
    dialog.setSize(600, 450);
    dialog.setLocationRelativeTo(null);
    dialog.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            super.windowClosing(e);
            WizardUtil.disconnect();
        }
    });
    dialog.setVisible(true);
}
 
源代码4 项目: gameserver   文件: StrengthTestService.java
public StrengthTestService( 
		StrengthTestConfig config, MyTablePanel tablePanel) {
	this.model = model;
	this.config = config;
	this.count = config.getMaxTry();
	this.tablePanel = tablePanel;
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
			
	model = new StrengthTestResultModel();
	tablePanel.setTableModel(model);
}
 
源代码5 项目: sldeditor   文件: DBConnectorDetailsPanel.java
/**
 * Show dialog.
 *
 * @param parentPanel the parent panel
 * @param connectionDetails the connection details
 * @return the connector details panel
 */
public static DatabaseConnection showDialog(
        JDialog parentPanel, DatabaseConnection connectionDetails) {
    JDialog dialog =
            new JDialog(
                    parentPanel,
                    (connectionDetails == null)
                            ? "DB"
                            : connectionDetails.getDatabaseTypeLabel(),
                    true);
    dialog.setResizable(false);

    DBConnectorDetailsPanel panel = new DBConnectorDetailsPanel(dialog);

    dialog.getContentPane().add(panel);

    panel.populate(connectionDetails);
    dialog.setSize(500, 300);

    Controller.getInstance().centreDialog(dialog);

    if (!inTestModeFlag) {
        dialog.setVisible(true);
    }

    if (panel.okButtonPressed() || inTestModeFlag) {
        return panel.getConnectionDetails();
    }
    return null;
}
 
源代码6 项目: sldeditor   文件: ConnectorDetailsPanel.java
/**
 * Show dialog.
 *
 * @param parentPanel the parent panel
 * @param connectionDetails the connection details
 * @return the connector details panel
 */
public static GeoServerConnection showDialog(
        JDialog parentPanel, GeoServerConnection connectionDetails) {
    JDialog dialog =
            new JDialog(
                    parentPanel,
                    Localisation.getString(
                            ConnectorDetailsPanel.class, "ConnectorDetailsPanel.title"),
                    true);
    dialog.setResizable(false);

    ConnectorDetailsPanel panel = new ConnectorDetailsPanel(dialog);

    dialog.getContentPane().add(panel);

    panel.populate(connectionDetails);
    dialog.pack();
    dialog.setSize(BasePanel.FIELD_PANEL_WIDTH, 175);

    Controller.getInstance().centreDialog(dialog);

    if (!isInTestMode()) {
        dialog.setVisible(true);
    }

    if (panel.okButtonPressed() || isInTestMode()) {
        return panel.getConnectionDetails();
    }
    return null;
}
 
源代码7 项目: OpERP   文件: ProductPane.java
public JDialog getDialog() {
	JDialog dialog = new JDialog();
	dialog.getContentPane().add(getPane());
	dialog.setSize(600, 400);
	dialog.setVisible(true);
	return dialog;
}
 
源代码8 项目: BART   文件: CompareChangesDialog.java
public void showResults(String results) {
    JDialog dialog = new JDialog(this, true);
    dialog.setSize(500, 300);
    dialog.setLocationRelativeTo(this);
    JTextArea textArea = new JTextArea(results);
    textArea.setEditable(false);
    textArea.setFont(new Font("monospaced", Font.PLAIN, 14));
    dialog.setContentPane(new JScrollPane(textArea));
    dialog.setVisible(true);
}
 
private static void showScene(TreeScene scene, String title) {
	JScrollPane panel = new JScrollPane(scene.createView());
	JDialog dialog = new JDialog();
	dialog.setModal(true);
	dialog.setTitle(title);
	dialog.add(panel, BorderLayout.CENTER);
	dialog.setSize(800, 600);
	dialog.setVisible(true);
	dialog.dispose();
}
 
源代码10 项目: jmeter-plugins   文件: JAbsrtactDialogPanel.java
protected void repack() {
    JDialog dlgParent = getAssociatedDialog();
    if(dlgParent != null) {
        Dimension newSize = dlgParent.getPreferredSize();
        if(newSize.width < minWidth) {
            newSize.width = minWidth;
        }
        dlgParent.setSize(newSize);
        dlgParent.validate();
    }
}
 
源代码11 项目: WorldGrower   文件: DialogUtils.java
/**
 * Centers the dialog over the given parent component. Also, creates a
 * semi-transparent panel behind the dialog to mask the parent content.
 * The title of the dialog is displayed in a custom fashion over the dialog
 * panel, and a rectangular shadow is placed behind the dialog.
 */
public static void createDialogBackPanel(JDialog dialog, Component parent) {
	dialog.setBackground(new Color(255, 255, 255, 64));
	
	DialogBackPanel newContentPane = new DialogBackPanel(dialog.getContentPane(), dialog.getTitle());
	dialog.setContentPane(newContentPane);
	dialog.setSize(parent.getSize());
	dialog.setLocation(parent.getLocationOnScreen());
}
 
源代码12 项目: osp   文件: ControlFrame.java
public void inspectXML() {
  // display a TreePanel in a modal dialog
  XMLControl xml = new XMLControlElement(getOSPApp());
  XMLTreePanel treePanel = new XMLTreePanel(xml);
  JDialog dialog = new JDialog((java.awt.Frame) null, true);
  dialog.setContentPane(treePanel);
  dialog.setSize(new Dimension(600, 300));
  dialog.setVisible(true);
}
 
源代码13 项目: gameserver   文件: WeaponDataGeneratorService.java
public WeaponDataGeneratorService(List<String> namePrefixes, List<Integer> dprList, double[] params) {
	this.origWeaponList = new ArrayList<WeaponPojo>();
	List<DBObject> list = MongoUtil.queryAllFromMongo(null, database, namespace, "equipments", null);
	for ( DBObject obj : list ) {
		WeaponPojo weapon = (WeaponPojo)MongoUtil.constructObject(obj);
		this.origWeaponList.add(weapon);
	}
	Collections.sort(this.origWeaponList);
	
	if ( namePrefixes != null ) {
		this.namePrefixes.addAll(namePrefixes);
	}
	if ( dprList != null ) {
		this.dprList.addAll(dprList);
	}
	
	attackUnit = params[0];
	defendUnit = params[1];
	luckUnit = params[2];
	agilityUnit = params[3];
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	
	this.progressBar.setIndeterminate(true);
}
 
源代码14 项目: wandora   文件: MicrosoftTranslateConfiguration.java
public void open(Wandora w) {
    myDialog = new JDialog(w, true);
    myDialog.add(this);
    myDialog.setSize(350, 220);
    myDialog.setTitle("Configure Microsoft Translator");
    UIBox.centerWindow(myDialog, w);
    myDialog.setVisible(true);
}
 
源代码15 项目: Shuffle-Move   文件: EditRosterService.java
@Override
public void onSetupGUI() {
   d = new JDialog(getOwner(), getString(KEY_TITLE));
   d.setTitle(getString(KEY_TITLE));
   d.setLayout(new GridBagLayout());
   GridBagConstraints c = new GridBagConstraints();
   c.fill = GridBagConstraints.HORIZONTAL;
   c.weightx = 1.0;
   c.weighty = 0.0;
   c.gridx = 1;
   c.gridy = 1;
   c.gridwidth = 1;
   c.gridheight = 1;
   d.add(makeUpperPanel(), c);
   
   c.gridy += 1;
   c.fill = GridBagConstraints.BOTH;
   c.weighty = 1.0;
   d.add(makeCenterPanel(), c);
   
   c.gridy += 1;
   c.fill = GridBagConstraints.HORIZONTAL;
   c.weighty = 0.0;
   d.add(makeBottomPanel(), c);
   
   ConfigManager preferencesManager = getUser().getPreferencesManager();
   int defaultWidth = preferencesManager.getIntegerValue(KEY_POPUP_WIDTH, DEFAULT_POPUP_WIDTH);
   int defaultHeight = preferencesManager.getIntegerValue(KEY_POPUP_HEIGHT, DEFAULT_POPUP_HEIGHT);
   int width = preferencesManager.getIntegerValue(KEY_EDIT_ROSTER_WIDTH, defaultWidth);
   int height = preferencesManager.getIntegerValue(KEY_EDIT_ROSTER_HEIGHT, defaultHeight);
   d.repaint();
   d.pack();
   d.setMinimumSize(new Dimension(getMinimumWidth(), DEFAULT_POPUP_HEIGHT));
   d.setSize(new Dimension(width, height));
   d.setLocationRelativeTo(null);
   d.setResizable(true);
   addActionListeners();
   setDialog(d);
   getUser().addObserver(this);
}
 
源代码16 项目: lucene-solr   文件: OpenIndexDialogFactory.java
@Override
public JDialog create(Window owner, String title, int width, int height) {
  dialog = new JDialog(owner, title, Dialog.ModalityType.APPLICATION_MODAL);
  dialog.add(content());
  dialog.setSize(new Dimension(width, height));
  dialog.setLocationRelativeTo(owner);
  dialog.getContentPane().setBackground(prefs.getColorTheme().getBackgroundColor());
  return dialog;
}
 
源代码17 项目: osp   文件: DiagnosticsForSystem.java
public static void aboutSystem(Frame owner) {
    JDialog dialog = new JDialog(owner,"System Properties");  //$NON-NLS-1$
    DiagnosticsForSystem viewer = new DiagnosticsForSystem();
    dialog.setContentPane(viewer);
    dialog.setSize(500, 300);
    dialog.setVisible(true);	  
}
 
源代码18 项目: swift-explorer   文件: ProgressPanel.java
@Override
public void componentResized(ComponentEvent e) {
	if (height > 0 && e.getComponent() instanceof JPanel) {
		JDialog parent = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, e.getComponent());
		if (parent != null) {
			parent.setSize(new Dimension(parent.getWidth(), height));
		}
	}
	super.componentResized(e);
}
 
源代码19 项目: Openfire   文件: Launcher.java
private void installPlugin(final File plugin) {
    final JDialog dialog = new JDialog(frame, "Installing Plugin", true);
    dialog.getContentPane().setLayout(new BorderLayout());
    JProgressBar bar = new JProgressBar();
    bar.setIndeterminate(true);
    bar.setString("Installing Plugin.  Please wait...");
    bar.setStringPainted(true);
    dialog.getContentPane().add(bar, BorderLayout.CENTER);
    dialog.pack();
    dialog.setSize(225, 55);

    final SwingWorker<File, Void> installerThread = new SwingWorker<File, Void>() {
        @Override
        public File doInBackground() {
            File pluginsDir = new File(binDir.getParentFile(), "plugins");
            String tempName = plugin.getName() + ".part";
            File tempPluginsFile = new File(pluginsDir, tempName);

            File realPluginsFile = new File(pluginsDir, plugin.getName());

            // Copy Plugin into Dir.
            try {
                // Just for fun. Show no matter what for two seconds.
                Thread.sleep(2000);

                copy(plugin.toURI().toURL(), tempPluginsFile);

                // If successfull, rename to real plugin name.
                tempPluginsFile.renameTo(realPluginsFile);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
            return realPluginsFile;
        }

        @Override
        public void done() {
            dialog.setVisible(false);
        }
    };

    // Start installation
    installerThread.execute();

    dialog.setLocationRelativeTo(frame);
    dialog.setVisible(true);
}
 
源代码20 项目: uima-uimaj   文件: AnnotationViewerDialog.java
/**
 * Launch that viewer.
 *
 * @param inputDirPath the input dir path
 * @param fileName the file name
 * @param typeSystem the type system
 * @param aTypesToDisplay the a types to display
 * @param javaViewerRBisSelected the java viewer R bis selected
 * @param javaViewerUCRBisSelected the java viewer UCR bis selected
 * @param xmlRBisSelected the xml R bis selected
 * @param styleMapFile the style map file
 * @param viewerDirectory the viewer directory
 */
public void launchThatViewer(String inputDirPath, String fileName, TypeSystem typeSystem,
        final String[] aTypesToDisplay, boolean javaViewerRBisSelected,
        boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, File styleMapFile,
        File viewerDirectory) {
  try {

    File xcasFile = new File(inputDirPath, fileName);
    // create a new CAS
    CAS cas = CasCreationUtils.createCas(Collections.EMPTY_LIST, typeSystem, UIMAFramework
            .getDefaultPerformanceTuningProperties());
    // deserialize XCAS into CAS
    try (InputStream xcasInStream = new FileInputStream(xcasFile)) {
      XmlCasDeserializer.deserialize(xcasInStream, cas, true);
    }
    
    //get the specified view
    cas = cas.getView(this.defaultCasViewName);

    // launch appropriate viewer
    if (javaViewerRBisSelected || javaViewerUCRBisSelected) { // JMP
      // record preference for next time
      med1.setViewType(javaViewerRBisSelected ? "Java Viewer" : "JV User Colors");

      // create tree viewer component
      CasAnnotationViewer viewer = new CasAnnotationViewer();
      viewer.setDisplayedTypes(aTypesToDisplay);
      if (javaViewerUCRBisSelected)
        getColorsForTypesFromFile(viewer, styleMapFile);
      else
        viewer.setHiddenTypes(new String[] { "uima.cpm.FileLocation" });
      // launch viewer in a new dialog
      viewer.setCAS(cas);
      JDialog dialog = new JDialog(AnnotationViewerDialog.this, "Annotation Results for "
              + fileName + " in " + inputDirPath); // JMP
      dialog.getContentPane().add(viewer);
      dialog.setSize(850, 630);
      dialog.pack();
      dialog.show();
    } else {
      CAS defaultView = cas.getView(CAS.NAME_DEFAULT_SOFA);
      if (defaultView.getDocumentText() == null) {
        displayError("The HTML and XML Viewers can only view the default text document, which was not found in this CAS.");
        return;
      }
      // generate inline XML
      File inlineXmlFile = new File(viewerDirectory, "inline.xml");
      CasToInlineXml casToInlineXml = new CasToInlineXml();
      casToInlineXml.setFormattedOutput(false);
      String xmlAnnotations = casToInlineXml.generateXML(defaultView);
      FileOutputStream outStream = new FileOutputStream(inlineXmlFile);
      outStream.write(xmlAnnotations.getBytes(StandardCharsets.UTF_8));
      outStream.close();

      if (xmlRBisSelected) // JMP passed in
      {
        // record preference for next time
        med1.setViewType("XML");

        BrowserUtil.openUrlInDefaultBrowser(inlineXmlFile.getAbsolutePath());
      } else
      // HTML view
      {
        med1.setViewType("HTML");
        // generate HTML view
        // first process style map if not done already
        if (!processedStyleMap) {
          if (!styleMapFile.exists()) {
            annotationViewGenerator.autoGenerateStyleMapFile(
                    promptForAE().getAnalysisEngineMetaData(), styleMapFile);
          }
          annotationViewGenerator.processStyleMap(styleMapFile);
          processedStyleMap = true;
        }
        annotationViewGenerator.processDocument(inlineXmlFile);
        File genFile = new File(viewerDirectory, "index.html");
        // open in browser
        BrowserUtil.openUrlInDefaultBrowser(genFile.getAbsolutePath());
      }
    }

    // end LTV here

  } catch (Exception ex) {
    displayError(ex);
  }
}