Java Code Examples for javax.swing.JDialog#setSize()
The following examples show how to use
javax.swing.JDialog#setSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StrengthTestService.java From gameserver with Apache License 2.0 | 6 votes |
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); }
Example 2
Source File: BulbPanel.java From ThingML-Tradfri with Apache License 2.0 | 6 votes |
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); } }
Example 3
Source File: WeaponManualDataImportService.java From gameserver with Apache License 2.0 | 6 votes |
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); }
Example 4
Source File: RepWizard.java From nextreports-designer with Apache License 2.0 | 6 votes |
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); }
Example 5
Source File: ProgressPanel.java From swift-explorer with Apache License 2.0 | 5 votes |
@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); }
Example 6
Source File: DBConnectorDetailsPanel.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example 7
Source File: DiagnosticsForSystem.java From osp with GNU General Public License v3.0 | 5 votes |
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); }
Example 8
Source File: OpenIndexDialogFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@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; }
Example 9
Source File: EditRosterService.java From Shuffle-Move with GNU General Public License v3.0 | 5 votes |
@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); }
Example 10
Source File: MicrosoftTranslateConfiguration.java From wandora with GNU General Public License v3.0 | 5 votes |
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); }
Example 11
Source File: WeaponDataGeneratorService.java From gameserver with Apache License 2.0 | 5 votes |
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); }
Example 12
Source File: ControlFrame.java From osp with GNU General Public License v3.0 | 5 votes |
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); }
Example 13
Source File: DialogUtils.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
/** * 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()); }
Example 14
Source File: JAbsrtactDialogPanel.java From jmeter-plugins with Apache License 2.0 | 5 votes |
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(); } }
Example 15
Source File: AbegoTreeLayoutForNetbeansDemo.java From treelayout with BSD 3-Clause "New" or "Revised" License | 5 votes |
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(); }
Example 16
Source File: CompareChangesDialog.java From BART with MIT License | 5 votes |
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); }
Example 17
Source File: ProductPane.java From OpERP with MIT License | 5 votes |
public JDialog getDialog() { JDialog dialog = new JDialog(); dialog.getContentPane().add(getPane()); dialog.setSize(600, 400); dialog.setVisible(true); return dialog; }
Example 18
Source File: ConnectorDetailsPanel.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example 19
Source File: AnnotationViewerDialog.java From uima-uimaj with Apache License 2.0 | 4 votes |
/** * 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); } }
Example 20
Source File: Launcher.java From Openfire with Apache License 2.0 | 4 votes |
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); }