List of usage examples for java.awt Frame Frame
public Frame() throws HeadlessException
From source file:org.gcaldaemon.core.notifier.GmailNotifierWindow.java
GmailNotifierWindow(String style, String sound) throws Exception { super(new Frame()); // Load background int w = 300;//w ww . ja va2s . co m int h = 110; Toolkit toolkit = Toolkit.getDefaultToolkit(); InputStream in; try { if (style.indexOf('.') == -1) { in = GmailNotifierWindow.class.getResourceAsStream(style + ".gif"); } else { in = new FileInputStream(style); } } catch (Exception loadError) { log.error(loadError.getMessage(), loadError); in = GmailNotifierWindow.class.getResourceAsStream("default.gif"); } ImageIO.setUseCache(false); background = ImageIO.read(in); in.close(); Dimension size = toolkit.getScreenSize(); setBounds((size.width - w) / 2, (size.height - h) / 2, w, h); metrics = getFontMetrics(PLAIN); // Set colors for (;;) { if (style.equals("metal")) { fromColor = Color.WHITE; break; } if (style.equals("green")) { titleColor = Color.GREEN; dateColor = new Color(0, 145, 0); break; } if (style.equals("blue")) { fromColor = Color.WHITE; titleColor = new Color(212, 235, 255); dateColor = titleColor; break; } if (style.equals("mail")) { titleColor = new Color(139, 128, 118); dateColor = titleColor; break; } break; } // Create offscreen buffer buffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); offscreen = buffer.getGraphics(); // Set notification sound if (sound == null || sound.equals("beep")) { clip = null; } else { try { URL url; if (sound.indexOf('.') == -1) { url = GmailNotifierWindow.class.getResource(sound + ".wav"); } else { sound = sound.replace(File.separatorChar, '/'); url = new URL("file", "", sound); } clip = Applet.newAudioClip(url); } catch (Exception soundError) { log.warn("Unable to load sound: " + sound, soundError); clip = null; } } // Init window setAlwaysOnTop(true); addMouseListener(this); addMouseMotionListener(this); validate(); }
From source file:ec.display.chart.StatisticsChartPaneTab.java
/** * This method initializes jButton //from ww w . ja v a2 s . co m * * @return javax.swing.JButton */ private JButton getPrintButton() { if (printButton == null) { printButton = new JButton(); printButton.setText("Export to PDF..."); final JFreeChart chart = chartPane.getChart(); printButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { int width = chartPane.getWidth(); int height = chartPane.getHeight(); FileDialog fileDialog = new FileDialog(new Frame(), "Export...", FileDialog.SAVE); fileDialog.setDirectory(System.getProperty("user.dir")); fileDialog.setFile("*.pdf"); fileDialog.setVisible(true); String fileName = fileDialog.getFile(); if (fileName != null) { if (!fileName.endsWith(".pdf")) { fileName = fileName + ".pdf"; } File f = new File(fileDialog.getDirectory(), fileName); Document document = new Document(new com.lowagie.text.Rectangle(width, height)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(f)); document.addAuthor("ECJ Console"); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(width, height); Graphics2D g2 = tp.createGraphics(width, height, new DefaultFontMapper()); Rectangle2D rectangle2D = new Rectangle2D.Double(0, 0, width, height); chart.draw(g2, rectangle2D); g2.dispose(); cb.addTemplate(tp, 0, 0); document.close(); } } catch (Exception ex) { ex.printStackTrace(); } } }); } return printButton; }
From source file:it.imtech.configuration.StartWizard.java
/** * Creates a new wizard with active card (Select Language/Server) *///from w w w.ja v a2 s .c o m public StartWizard() { Globals.setGlobalVariables(); ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); if (!checkAppDataFiles()) { JOptionPane.showMessageDialog(null, Utility.getBundleString("copy_appdata", bundle), Utility.getBundleString("copy_appdata_title", bundle), JOptionPane.ERROR_MESSAGE); System.exit(1); } DOMConfigurator.configure(Globals.LOG4J); logger = Logger.getLogger(StartWizard.class); logger.info("Starting Application Phaidra Importer"); mainFrame = new JFrame(); if (Utility.internetConnectionAvailable()) { Globals.ONLINE = true; } it.imtech.utility.Utility.cleanUndoDir(); XMLConfiguration internalConf = setConfiguration(); logger.info("Configuration path estabilished"); XMLConfiguration config = setConfigurationPaths(internalConf, bundle); headerPanel = new HeaderPanel(); footerPanel = new FooterPanel(); JButton nextButton = (JButton) footerPanel.getComponentByName("next_button"); JButton prevButton = (JButton) footerPanel.getComponentByName("prev_button"); nextButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (getCurrentCard() instanceof ChooseServer) { ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); try { mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Server selected = chooseServer.getSelectedServer(); logger.info("Selected Server = " + selected.getServername()); SelectedServer.getInstance(null).makeEmpty(); SelectedServer.getInstance(selected); if (Globals.ONLINE) { logger.info("Testing server connection..."); ChooseServer.testServerConnection(SelectedServer.getInstance(null).getBaseUrl()); } chooseFolder.updateLanguage(); MetaUtility.getInstance().preInitializeData(); logger.info("Preinitialization done (Vocabulary and Languages"); c1.next(cardsPanel); mainFrame.setCursor(null); } catch (Exception ex) { logger.error(ex.getMessage()); JOptionPane.showMessageDialog(new Frame(), Utility.getBundleString("preinitializemetadataex", bundle)); } } else if (getCurrentCard() instanceof ChooseFolder) { mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean error = chooseFolder.checkFolderSelectionValidity(); if (error == false) { BookImporter x = BookImporter.getInstance(); mainFrame.setCursor(null); mainFrame.setVisible(false); } } } }); prevButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (getCurrentCard() instanceof ChooseServer) { ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); String title = Utility.getBundleString("dialog_1_title", bundle); String text = Utility.getBundleString("dialog_1", bundle); ConfirmDialog confirm = new ConfirmDialog(mainFrame, true, title, text, Utility.getBundleString("confirm", bundle), Utility.getBundleString("back", bundle)); confirm.setVisible(true); boolean close = confirm.getChoice(); confirm.dispose(); if (close == true) { mainFrame.dispose(); } } else { c1.previous(cardsPanel); } } }); cardsPanel = new JPanel(new CardLayout()); cardsPanel.setBackground(Color.WHITE); chooseServer = new ChooseServer(config); chooseFolder = new ChooseFolder(); cardsPanel.add(chooseServer, "1"); cardsPanel.add(chooseFolder, "2"); cardsPanel.setLayout(c1); c1.show(cardsPanel, "1"); //Main Panel style mainPanel = new JPanel(new BorderLayout()); mainPanel.add(BorderLayout.NORTH, headerPanel); mainPanel.add(BorderLayout.CENTER, cardsPanel); mainPanel.add(BorderLayout.PAGE_END, footerPanel); mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); String title = Utility.getBundleString("dialog_1_title", bundle); String text = Utility.getBundleString("dialog_1", bundle); ConfirmDialog confirm = new ConfirmDialog(mainFrame, true, title, text, Utility.getBundleString("confirm", bundle), Utility.getBundleString("back", bundle)); confirm.setVisible(true); boolean close = confirm.getChoice(); confirm.dispose(); if (close == true) { mainFrame.dispose(); } } }); //Add Style mainFrame.getContentPane().setBackground(Color.white); mainFrame.getContentPane().setLayout(new BorderLayout()); mainFrame.getContentPane().setPreferredSize(new Dimension(640, 400)); mainFrame.getContentPane().add(BorderLayout.CENTER, mainPanel); mainFrame.pack(); //Center frame in the screen Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int x = (dim.width - mainFrame.getSize().width) / 2; int y = (dim.height - mainFrame.getSize().height) / 2; mainFrame.setLocation(x, y); mainFrame.setVisible(true); }
From source file:io.gameover.utilities.pixeleditor.Pixelizer.java
/** * Constructor./*from w w w . j a va2 s . c o m*/ */ public Pixelizer() { setFocusable(true); Image icon = new ImageIcon("icon.png").getImage(); if (icon != null) { setIconImage(icon); } requestFocus(); frames = new ArrayList<>(); frames.add(new Frame()); currentFrameIndex = 0; selectionMask = new boolean[Frame.NB_PIXELS][Frame.NB_PIXELS]; enlightmentMask = new boolean[Frame.NB_PIXELS][Frame.NB_PIXELS]; reset(); applyLookAndFeel(); setTitle(PIXELIZER); savedStates = new ArrayList<>(); currentStateIndex = 0; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setJMenuBar(getAppMenuBar()); initPanels(); addKeyListener(new InternalKeyListener(this)); setSize(new Dimension(800, 700)); centerFrame(); setVisible(true); refreshCurrentColors(); refresh(); }
From source file:org.pentaho.reporting.engine.classic.core.function.PaintComponentFunction.java
/** * Return a completly separated copy of this function. The copy does no longer share any changeable objects with the * original function.// www .j a v a 2s . c o m * * @return a copy of this function. */ public Expression getInstance() { final PaintComponentFunction pc = (PaintComponentFunction) super.getInstance(); if (PaintComponentFunction.isHeadless() == false) { pc.peerSupply = new Frame(); pc.peerSupply.setLayout(new BorderLayout()); } return pc; }
From source file:org.pentaho.reporting.engine.classic.core.function.PaintComponentFunction.java
/** * Helper method for serialization.// w w w . j a v a 2s . c om * * @param in * the input stream from where to read the serialized object. * @throws IOException * when reading the stream fails. * @throws ClassNotFoundException * if a class definition for a serialized object could not be found. */ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (PaintComponentFunction.isHeadless() == false) { peerSupply = new Frame(); peerSupply.setLayout(new BorderLayout()); } }
From source file:JDAC.JDAC.java
public static void main(String[] args) { try {// ww w . ja v a 2 s.com UIManager.setLookAndFeel( //UIManager.getSystemLookAndFeelClassName()); UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { JOptionPane.showMessageDialog(new Frame(), "" + "Something strange happened\n" + "If the error persists please contact the system administrator\n" + "ERR: theme error"); } JDAC demo = new JDAC(); RefineryUtilities.centerFrameOnScreen(demo); Runnable tmp = new Runnable() { public void run() { System.out.println("JDAC"); System.out.println("Credits: Michele Lizzit - https://lizzit.it/jdac"); searchForPorts(); } }; tmp.run(); }
From source file:pipeline.GUI_utils.JXTablePerColumnFiltering.java
/** * * @param columnsFormulasToPrint/*from w w w. j a v a2 s .c om*/ * If null, print all columns * @param stripNewLinesInCells * @param filePath * Full path to save file to; if null, user will be prompted. */ public void saveFilteredRowsToFile(List<Integer> columnsFormulasToPrint, boolean stripNewLinesInCells, String filePath) { String saveTo; if (filePath == null) { FileDialog dialog = new FileDialog(new Frame(), "Save filtered rows to", FileDialog.SAVE); dialog.setVisible(true); saveTo = dialog.getDirectory(); if (saveTo == null) return; saveTo += "/" + dialog.getFile(); } else { saveTo = filePath; } PrintWriter out = null; try { out = new PrintWriter(saveTo); StringBuffer b = new StringBuffer(); if (columnsFormulasToPrint == null) { for (int i = 0; i < this.getColumnCount(); i++) { b.append(getColumnName(i)); if (i < getColumnCount() - 1) b.append("\t"); } } else { int index = 0; for (int i : columnsFormulasToPrint) { b.append(getColumnName(i)); if (index + 1 < columnsFormulasToPrint.size()) b.append("\t"); index++; } } out.println(b); for (int i = 0; i < model.getRowCount(); i++) { int rowIndex = convertRowIndexToView(i); if (rowIndex > -1) { if (columnsFormulasToPrint == null) if (stripNewLinesInCells) out.println(getRowAsString(rowIndex).replaceAll("\n", " ")); else out.println(getRowAsString(rowIndex)); else { boolean first = true; for (int column : columnsFormulasToPrint) { if (!first) { out.print("\t"); } first = false; SpreadsheetCell cell = (SpreadsheetCell) getValueAt(rowIndex, column); if (cell != null) { String formula = cell.getFormula(); if (formula != null) { if (stripNewLinesInCells) out.print(formula.replaceAll("\n", " ")); else out.print(formula); } } } out.println(""); } } } out.close(); } catch (FileNotFoundException e) { Utils.printStack(e); Utils.displayMessage("Could not save table", true, LogLevel.ERROR); } }
From source file:Widgets.Simulation.java
public Simulation(final JFrame aFrame, NetworkElement item) { super(aFrame); grn = ((DynamicalModelElement) item).getGeneNetwork(); plot = new Plot2DPanel(); //closing listener this.addWindowListener(new WindowAdapter() { @Override/*from w ww.j av a 2s.c o m*/ public void windowClosing(WindowEvent windowEvent) { if (simulation != null && simulation.myThread_.isAlive()) { simulation.stop(); System.out.print("Simulation is canceled.\n"); JOptionPane.showMessageDialog(new Frame(), "Simulation is canceled.", "Warning!", JOptionPane.INFORMATION_MESSAGE); } escapeAction(); } }); // Model model_.setModel(new DefaultComboBoxModel(new String[] { "Deterministic Model (ODEs)", "Stochastic Model (SDEs)", "Stochastic Simulation (Gillespie Algorithm)" })); model_.setSelectedIndex(0); setModelAction(); //set plot part //display result if (grn.getTimeScale().size() >= 1) { //update parameters numTimeSeries_.setValue(grn.getTraj_itsValue()); tmax_.setValue(grn.getTraj_maxTime()); sdeDiffusionCoeff_.setValue(grn.getTraj_noise()); if (grn.getTraj_model().equals("ode")) model_.setSelectedIndex(0); else if (grn.getTraj_model().equals("sde")) model_.setSelectedIndex(1); else model_.setSelectedIndex(2); //update plot trajPlot.removeAll(); trajPlot.add(trajectoryTabb()); trajPlot.updateUI(); trajPlot.setVisible(true); trajPlot.repaint(); analyzeResult.setVisible(true); } /** * ACTIONS */ model_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setModelAction(); } }); analyzeResult.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { final JDialog a = new JDialog(); a.setSize(new Dimension(500, 450)); a.setModal(true); a.setTitle("Gene List (seperated by ';')"); a.setLocationRelativeTo(null); final JTextArea focusGenesArea = new JTextArea(); focusGenesArea.setLineWrap(true); focusGenesArea.setEditable(false); focusGenesArea.setRows(3); String geneNames = ""; for (int i = 0; i < grn.getNodes().size(); i++) geneNames += grn.getNodes().get(i).getLabel() + ";"; focusGenesArea.setText(geneNames); JButton submitButton = new JButton("Submit"); JButton cancelButton = new JButton("Cancel"); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(submitButton); buttonPanel.add(cancelButton); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { a.dispose(); } }); submitButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { a.dispose(); final JDialog a = new JDialog(); a.setSize(new Dimension(500, 450)); a.setModal(true); a.setTitle("Statistics"); a.setLocationRelativeTo(null); if (grn.getTimeSeries().isEmpty()) { JOptionPane.showMessageDialog(new Frame(), "Please run the simulation first.", "Warning!", JOptionPane.INFORMATION_MESSAGE); } else { JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); //output String[] focusGenes = focusGenesArea.getText().split(";"); ; String content = ""; //discrete the final state int dimension = grn.getNodes().size(); //get gene index int[] focus_index = new int[focusGenes.length]; for (int j = 0; j < focusGenes.length; j++) for (int i = 0; i < dimension; i++) if (grn.getNode(i).getLabel().equals(focusGenes[j])) focus_index[j] = i; JScrollPane jsp = new JScrollPane(); //calculate steady states grn.setLand_itsValue((Integer) numTimeSeries_.getModel().getValue()); int[] isConverge = new int[grn.getTraj_itsValue()]; String out = calculateSteadyStates(focusGenes, focus_index, isConverge); //show the convergence final JDialog ifconvergent = new JDialog(); ifconvergent.setSize(new Dimension(500, 450)); ifconvergent.setModal(true); ifconvergent.setTitle("Convergence"); ifconvergent.setLocationRelativeTo(null); ConvergenceTable tablePanel = new ConvergenceTable(isConverge); JButton continueButton = new JButton("Click to check the attractors."); continueButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { ifconvergent.dispose(); } }); JPanel ifconvergentPanel = new JPanel(); ifconvergentPanel.setLayout(new BorderLayout()); ifconvergentPanel.add(tablePanel, BorderLayout.NORTH); ifconvergentPanel.add(continueButton, BorderLayout.SOUTH); ifconvergent.add(ifconvergentPanel); ifconvergent.setVisible(true); //show attractors if (out.equals("ok")) { AttractorTable panel = new AttractorTable(grn, focusGenes); jsp.setViewportView(panel); } else if (grn.getSumPara().size() == 0) content += "Cannot find a steady state!"; else content += "\nI dont know why!"; if (content != "") { JLabel warningLabel = new JLabel(); warningLabel.setText(content); jsp.setViewportView(warningLabel); } grn.setSumPara(null); grn.setCounts(null); //jsp.setPreferredSize(new Dimension(280,130)); jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); infoPanel.add(jsp, BorderLayout.CENTER); a.add(infoPanel); a.setVisible(true); } //end of else } }); JPanel options3 = new JPanel(); options3.setLayout(new BorderLayout()); options3.add(focusGenesArea, BorderLayout.NORTH); options3.add(buttonPanel); options3.setBorder(new EmptyBorder(5, 0, 5, 0)); a.add(options3); a.setVisible(true); } }); runButton_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { //System.out.print("Memory start: "+s_runtime.totalMemory()+"\n"); enterAction(); } }); cancelButton_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { if (simulation != null) simulation.stop(); System.out.print("Simulation is canceled!\n"); } }); fixButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { JDialog a = new JDialog(); a.setTitle("Fixed initial values"); a.setSize(new Dimension(400, 400)); a.setLocationRelativeTo(null); JPanel speciesPanel = new JPanel(); String[] columnName = { "Name", "InitialValue" }; boolean editable = false; //false; new SpeciesTable(speciesPanel, columnName, grn, editable); /** LAYOUT **/ JPanel wholePanel = new JPanel(); wholePanel.setLayout(new BoxLayout(wholePanel, BoxLayout.Y_AXIS)); wholePanel.add(speciesPanel); a.add(wholePanel); a.setModal(true); a.setVisible(true); } }); randomButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { final JDialog a = new JDialog(); a.setTitle("Set boundaries"); a.setSize(new Dimension(300, 200)); a.setModal(true); a.setLocationRelativeTo(null); JPanel upPanel = new JPanel(); JLabel upLabel = new JLabel("Input the upper boundary: "); final JTextField upValue = new JTextField("3"); upPanel.setLayout(new BoxLayout(upPanel, BoxLayout.X_AXIS)); upPanel.add(upLabel); upPanel.add(upValue); JPanel lowPanel = new JPanel(); JLabel lowLabel = new JLabel("Input the lower boundary: "); final JTextField lowValue = new JTextField("0"); lowPanel.setLayout(new BoxLayout(lowPanel, BoxLayout.X_AXIS)); lowPanel.add(lowLabel); lowPanel.add(lowValue); JPanel buttonPanel = new JPanel(); JButton submit = new JButton("Submit"); JButton cancel = new JButton("Cancel"); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(submit); buttonPanel.add(cancel); buttonPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (upValue.getText().equals("")) JOptionPane.showMessageDialog(null, "Please input upper boundary", "Error", JOptionPane.ERROR_MESSAGE); else { try { upbound = Double.parseDouble(upValue.getText()); if (lowValue.getText().equals("")) JOptionPane.showMessageDialog(null, "Please input lower boundary", "Error", JOptionPane.ERROR_MESSAGE); else { try { lowbound = Double.parseDouble(lowValue.getText()); if (upbound < lowbound) JOptionPane.showMessageDialog(null, "Upper boundary should be not less than lower boundary", "Error", JOptionPane.ERROR_MESSAGE); else a.dispose(); } catch (Exception er) { JOptionPane.showMessageDialog(null, "Invalid value", "Error", JOptionPane.INFORMATION_MESSAGE); MsgManager.Messages.errorMessage(er, "Error", ""); } } } catch (Exception er) { JOptionPane.showMessageDialog(null, "Invalid value", "Error", JOptionPane.INFORMATION_MESSAGE); MsgManager.Messages.errorMessage(er, "Error", ""); } } } }); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "The default values are used!", "", JOptionPane.INFORMATION_MESSAGE); a.dispose(); } }); JPanel wholePanel = new JPanel(); wholePanel.setLayout(new BoxLayout(wholePanel, BoxLayout.Y_AXIS)); wholePanel.add(upPanel); wholePanel.add(lowPanel); wholePanel.add(buttonPanel); wholePanel.setBorder(new EmptyBorder(5, 5, 5, 5)); a.add(wholePanel); a.setVisible(true); } }); }
From source file:it.imtech.configuration.ChooseServer.java
/** * Setta il percorso del file di configurazione se la prima volta che * viene avviata l'applicazione//w ww . j a va2 s . c o m * * @param change Definisce se l'avvio dell'applicazione o se si vuole * modificare il percorso * @throws MalformedURLException * @throws ConfigurationException */ private XMLConfiguration setConfigurationPaths(boolean change, XMLConfiguration internalConf, ResourceBundle bundle) { URL urlConfig = null; XMLConfiguration configuration = null; try { String text = Utility.getBundleString("setconf", bundle); String title = Utility.getBundleString("setconf2", bundle); internalConf.setAutoSave(true); String n = internalConf.getString("configurl[@path]"); if (n.isEmpty()) { String s = (String) JOptionPane.showInputDialog(new Frame(), text, title, JOptionPane.PLAIN_MESSAGE, null, null, "http://phaidrastatic.cab.unipd.it/xml/config.xml"); //If a string was returned, say so. if ((s != null) && (s.length() > 0)) { internalConf.setProperty("configurl[@path]", s); urlConfig = new URL(s); } else { logger.info("File di configurazione non settato"); } } else { urlConfig = new URL(n); } if (urlConfig != null) { if (Globals.DEBUG) configuration = new XMLConfiguration(new File(Globals.JRPATH + Globals.DEBUG_XML)); else configuration = new XMLConfiguration(urlConfig); } } catch (final MalformedURLException ex) { logger.error(ex.getMessage()); JOptionPane.showMessageDialog(new Frame(), Utility.getBundleString("exc_conf_1", bundle)); } catch (final ConfigurationException ex) { logger.error(ex.getMessage()); JOptionPane.showMessageDialog(new Frame(), Utility.getBundleString("exc_conf_2", bundle)); } return configuration; }