List of usage examples for java.awt Cursor WAIT_CURSOR
int WAIT_CURSOR
To view the source code for java.awt Cursor WAIT_CURSOR.
Click Source Link
From source file:com.vgi.mafscaling.OpenLoop.java
protected void clearRunTables() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); try {// w w w . ja va2 s . co m for (int i = 0; i < runTables.length; ++i) { while (RunRowsCount < runTables[i].getRowCount()) Utils.removeRow(RunRowsCount, runTables[i]); Utils.clearTable(runTables[i]); } } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:org.omegat.gui.main.ProjectUICommands.java
public static void projectTeamCreate() { UIThreadsUtil.mustBeSwingThread();// w ww . j a va 2 s .c o m if (Core.getProject().isProjectLoaded()) { return; } new SwingWorker<Object, Void>() { File projectRoot; protected Object doInBackground() throws Exception { Core.getMainWindow().showStatusMessageRB(null); final NewTeamProject dialog = new NewTeamProject(Core.getMainWindow().getApplicationFrame()); dialog.setVisible(true); if (!dialog.ok) { Core.getMainWindow().showStatusMessageRB("TEAM_CANCELLED"); return null; } IMainWindow mainWindow = Core.getMainWindow(); Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); Cursor oldCursor = mainWindow.getCursor(); mainWindow.setCursor(hourglassCursor); Core.getMainWindow().showStatusMessageRB("CT_DOWNLOADING_PROJECT"); // retrieve omegat.project projectRoot = new File(dialog.getSaveLocation()); List<RepositoryDefinition> repos = new ArrayList<RepositoryDefinition>(); RepositoryDefinition repo = new RepositoryDefinition(); repos.add(repo); repo.setType(dialog.getRepoType()); repo.setUrl(dialog.getRepoUrl()); RepositoryMapping mapping = new RepositoryMapping(); mapping.setLocal(""); mapping.setRepository(""); repo.getMapping().add(mapping); RemoteRepositoryProvider remoteRepositoryProvider = new RemoteRepositoryProvider(projectRoot, repos); remoteRepositoryProvider.switchAllToLatest(); for (String file : new String[] { OConsts.FILE_PROJECT, OConsts.DEFAULT_INTERNAL + '/' + FilterMaster.FILE_FILTERS, OConsts.DEFAULT_INTERNAL + '/' + SRX.CONF_SENTSEG }) { remoteRepositoryProvider.copyFilesFromRepoToProject(file); } // update repo into ProjectProperties props = ProjectFileStorage.loadProjectProperties(projectRoot); props.setRepositories(repos); ProjectFileStorage.writeProjectFile(props); //String projectFileURL = dialog.txtRepositoryOrProjectFileURL.getText(); //File localDirectory = new File(dialog.txtDirectory.getText()); // try { // localDirectory.mkdirs(); // byte[] projectFile = WikiGet.getURLasByteArray(projectFileURL); // FileUtils.writeByteArrayToFile(new File(localDirectory, OConsts.FILE_PROJECT), projectFile); // } catch (Exception ex) { // ex.printStackTrace(); // Core.getMainWindow().displayErrorRB(ex, "TEAM_CHECKOUT_ERROR"); // mainWindow.setCursor(oldCursor); // return null; // } // projectOpen(localDirectory); mainWindow.setCursor(oldCursor); return null; } @Override protected void done() { Core.getMainWindow().showProgressMessage(" "); try { get(); if (projectRoot != null) { // don't ask open if user cancelled previous dialog SwingUtilities.invokeLater(() -> { Core.getEditor().requestFocus(); projectOpen(projectRoot); }); } } catch (Exception ex) { Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_DOWNLOAD_TEAM_PROJECT"); Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_DOWNLOAD_TEAM_PROJECT"); } } }.execute(); }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void calculateMafScaling() { setCursor(new Cursor(Cursor.WAIT_CURSOR)); try {/*w w w . java 2 s.c o m*/ clearData(); clearChartData(); clearChartCheckBoxes(); TreeMap<Integer, ArrayList<Double>> result = new TreeMap<Integer, ArrayList<Double>>(); if (!getMafTableData(voltArray, gsArray)) return; if (!sortRunData(result) || result.isEmpty()) return; calculateCorrectedGS(result); setCorrectedMafData(); smoothGsArray.addAll(gsCorrected); checkBoxCorrectedMaf.setSelected(true); setXYTable(mafSmoothingTable, voltArray, smoothGsArray); setRanges(); setSelectedIndex(1); } catch (Exception e) { e.printStackTrace(); logger.error(e); JOptionPane.showMessageDialog(null, "Error: " + e, "Error", JOptionPane.ERROR_MESSAGE); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:org.docx4all.ui.menu.FileMenu.java
@Action public void exportAsSharedDoc(ActionEvent actionEvent) { WordMLEditor editor = WordMLEditor.getInstance(WordMLEditor.class); JEditorPane view = editor.getCurrentEditor(); if (view instanceof WordMLTextPane) { WordMLTextPane wmlTextPane = (WordMLTextPane) view; WordMLDocument doc = (WordMLDocument) wmlTextPane.getDocument(); if (DocUtil.getChunkingStrategy(doc) == null) { displaySetupFirstMessage();// w w w . j a v a 2 s . co m return; } NewShareDialog d = new NewShareDialog(editor.getWindowFrame()); d.pack(); d.setLocationRelativeTo(editor.getWindowFrame()); d.setVisible(true); if (d.getValue() == NewShareDialog.NEXT_BUTTON_TEXT) { DocumentElement root = (DocumentElement) doc.getDefaultRootElement(); DocumentML docML = (DocumentML) root.getElementML(); WordprocessingMLPackage wmlPackage = docML.getWordprocessingMLPackage(); XmlUtil.setPlutextCheckinMessageEnabledProperty(wmlPackage, d.isCommentOnEveryChange()); RETURN_TYPE val = saveAsFile(EXPORT_AS_SHARED_DOC_ACTION_NAME, actionEvent, Constants.DOCX_STRING); Cursor origCursor = wmlTextPane.getCursor(); wmlTextPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (val != RETURN_TYPE.APPROVE) { //Cancelled or Error XmlUtil.removePlutextProperty(wmlPackage, Constants.PLUTEXT_CHECKIN_MESSAGE_ENABLED_PROPERTY_NAME); } else if (!DocUtil.isSharedDocument(doc)) { //Because user has saved to places other than predefined server. XmlUtil.removeSharedDocumentProperties(wmlPackage); //TODO: Display a message saying a shared document can only //be created in predefined server and ask user to try again. } else { String filepath = (String) doc.getProperty(WordMLDocument.FILE_PATH_PROPERTY); try { FileObject fo = VFSUtils.getFileSystemManager().resolveFile(filepath); doc = wmlTextPane.getWordMLEditorKit().read(fo); doc.putProperty(WordMLDocument.FILE_PATH_PROPERTY, filepath); doc.addDocumentListener(editor.getToolbarStates()); doc.setDocumentFilter(new WordMLDocumentFilter()); wmlTextPane.setDocument(doc); wmlTextPane.putClientProperty(Constants.LOCAL_VIEWS_SYNCHRONIZED_FLAG, Boolean.TRUE); if (DocUtil.isSharedDocument(doc)) { wmlTextPane.getWordMLEditorKit().initPlutextClient(wmlTextPane); } } catch (IOException exc) { exc.printStackTrace(); //TODO:Display an IO error message and ask user to close the document //and try to reopen it. } } wmlTextPane.setCursor(origCursor); } d.dispose(); } }
From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java
private void addSparkClustersLineItem() { JLabel sparkClusterLabel = new JLabel("Spark clusters(Linux only)"); sparkClusterLabel.setToolTipText(//from w w w . j a v a 2s. c om "The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported."); GridBagConstraints c11 = new GridBagConstraints(); c11.gridx = 0; c11.gridy = 0; c11.insets = new Insets(margin, margin, 0, margin); add(sparkClusterLabel, new GridBagConstraints(0, displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0)); clustersListComboBox = new ComboboxWithBrowseButton(); clustersListComboBox.setButtonIcon(StreamUtil.getImageResourceFile(REFRESH_BUTTON_PATH)); clustersListComboBox.getButton().setToolTipText("Refresh"); clustersListComboBox.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Cursor cursor = getCursor(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); List<IClusterDetail> clusterDetails = ClusterManagerEx.getInstance() .getClusterDetails(submitModel.getProject()); setCursor(cursor); submitModel.setClusterComboBoxModel(clusterDetails); } }); clustersListComboBox.getComboBox().setToolTipText( "The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported."); clustersListComboBox.getComboBox().addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName() == "model" && evt.getNewValue() instanceof DefaultComboBoxModel) { int size = ((DefaultComboBoxModel) evt.getNewValue()).getSize(); setVisibleForFixedErrorMessageLabel(ErrorMessageLabelTag.ClusterName.ordinal(), size <= 0); } } }); add(clustersListComboBox, new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0)); errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()] = new JLabel( "Cluster Name Should not be null"); errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()] .setForeground(DarkThemeManager.getInstance().getErrorMessageColor()); clustersListComboBox.getComboBox().addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { setVisibleForFixedErrorMessageLabel(0, clustersListComboBox.getComboBox().getItemCount() == 0); } }); add(errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()], new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0)); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java
private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) { Ferramenta_Imagens.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.setTipoHTML();/*w w w .j a v a 2 s . c o m*/ new OnChange(textAreaSourceCode, this); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaDescricao(this, erros); arTextPainelCorrecao = new ArTextPainelCorrecao(this); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); analiseSistematica = new JButton(); salvar = new JButton(); abrir = new JButton(); cancelar = new JButton(); strConteudoalt = new String(); // panelLegenda = new JPanel(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); spTextoDescricao = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(this); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); /** * Mostra pro usurio a imagem que est sem descrio */ imagemSemDesc = new XHTMLPanel(); pnBotoes = new JPanel(); salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar, new JMenuItem(), parentFrame); adicionar = new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); analiseSistematica.setEnabled(false); // setJMenuBar(this.criaMenuBar()); // ======== this ======== // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos // controles:"); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Imagens.REGRAP1); lbRegras2.setText(Ferramenta_Imagens.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); JScrollPane sp = new JScrollPane(); sp.setViewportView(imagemSemDesc); sp.setPreferredSize(new Dimension(500, 300)); // ======== pnDescricao ======== // ---- Salvar ---- salvar.setText(Ferramenta_Imagens.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarActionPerformed(e); } }); salvar.setToolTipText(Ferramenta_Imagens.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(Ferramenta_Imagens.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.setBounds(165, 0, 150, 25); cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); analiseSistematica.setText(GERAL.ANALISE_SISTEMATICA); analiseSistematica.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buttonAction = e; Thread t = new Thread(new Runnable() { public void run() { PainelStatusBar.showProgTarReq(); parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); analiseSistematicaActionPerformed(buttonAction); parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); PainelStatusBar.hideProgTarReq(); } }); t.setPriority(9); t.start(); } }); analiseSistematica.setToolTipText(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.getAccessibleContext().setAccessibleName(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.setBounds(480, 0, 150, 25); // ======== pnParticRotulo ======== pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT)); GridBagConstraints cons = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; cons.weightx = 0.80; pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); conteudoDoAlt.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } public void keyReleased(KeyEvent arg0) { if (conteudoDoAlt.getText().length() == 0) { System.out.println("conteudo vazio"); aplicar.setEnabled(false); } else if (tableLinCod.getSelectedRow() != -1) { System.out.println("com conteudo"); aplicar.setEnabled(true); } } }); // ======== spParticRotulo ======== { spTextoDescricao.setViewportView(conteudoDoAlt); } // lbRegras1.setText(Reparo_Imagens.REGRAP2); // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); // pnRegra.add(lbRegras1); pnSetaDescricao.add(spTextoDescricao, cons); cons.weightx = 0.20; pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.setBounds(10, 5, 150, 25); // pnBotoes.add(adicionar); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Imagens.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR); aplicar.setBounds(10, 5, 150, 25); pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, cons); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); if (!original) { reverter = new JButton("Reverter"); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaImgPArq(TxtBuffer.getContentOriginal(), enderecoPagina); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); if (EstadoSilvinha.conteudoEmPainelResumo) { reverter.setBounds(640, 0, 150, 25); } else { reverter.setBounds(480, 0, 150, 25); } pnSalvarCancelar.add(reverter); } if (EstadoSilvinha.conteudoEmPainelResumo) { pnSalvarCancelar.add(analiseSistematica); } pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:com.qumasoft.guitools.compare.CompareFrame.java
/** * Compare two files.//from w w w . j ava 2s . c o m */ public void compare() { fitToScreen(); currentDifferenceIndex = -1; // Compare the files // <editor-fole> String[] compareArgs = new String[3]; compareArgs[0] = getFirstFileActualName(); compareArgs[1] = getSecondFileActualName(); compareArgs[2] = "junk"; // </editor-fold> compareFilesForGUI = new CompareFilesForGUI(compareArgs); compareFilesForGUI.setIgnoreAllWhiteSpace(ignoreAllWhiteSpaceFlag); compareFilesForGUI.setIgnoreLeadingWhiteSpace(ignoreLeadingWhiteSpaceFlag); compareFilesForGUI.setIgnoreCaseFlag(ignoreCaseFlag); compareFilesForGUI.setIgnoreEOLChangesFlag(ignoreEOLChangesFlag); try { Cursor currentCursor = getCursor(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); compareFilesForGUI.execute(); // Enable/disable the forward/backward actions. setNextPreviousActionStates(compareFilesForGUI.getNumberOfChanges()); if (file1ContentsList != null) { leftPanel.remove(file1ContentsList); } if (file2ContentsList != null) { rightPanel.remove(file2ContentsList); } // Set up the model object for the list JList objects. file1ContentsListModel = new FileContentsListModel(getFirstFileActualName(), compareFilesForGUI, true, null); file2ContentsListModel = new FileContentsListModel(getSecondFileActualName(), compareFilesForGUI, false, file1ContentsListModel); addBlanksToShorterModel(); file1ContentsList = new FileContentsList(file1ContentsListModel, this); leftPanel.add(file1ContentsList); rowHeight = file1ContentsList.getRowHeight(); file1ChangeMarkerPanel = new ChangeMarkerPanel(file1ContentsListModel, rowHeight); file2ContentsList = new FileContentsList(file2ContentsListModel, this); rightPanel.add(file2ContentsList); file2ChangeMarkerPanel = new ChangeMarkerPanel(file2ContentsListModel, rowHeight); firstFileDisplayName.setForeground(blackColor); firstFileDisplayName.setFont(new java.awt.Font("Arial", 0, DEFAULT_FONT_SIZE)); firstFileDisplayName.setBorder(bevelBorder); leftParentPanel.add(firstFileDisplayName, BorderLayout.NORTH); leftParentPanel.add(leftScrollPane, BorderLayout.CENTER); leftParentPanel.add(file1ChangeMarkerPanel, BorderLayout.EAST); secondFileDisplayName.setForeground(blackColor); secondFileDisplayName.setBorder(bevelBorder); secondFileDisplayName.setFont(new java.awt.Font("Arial", 0, DEFAULT_FONT_SIZE)); rightParentPanel.add(secondFileDisplayName, BorderLayout.NORTH); rightParentPanel.add(rightScrollPane, BorderLayout.CENTER); rightParentPanel.add(file2ChangeMarkerPanel, BorderLayout.EAST); // Center the splitter bar centerSplitterDivider(); // Hook the scroll panes up... hookScrollPanes(); setCursor(currentCursor); if (!isVisible()) { setVisible(true); } } catch (QVCSOperationException e) { LOGGER.log(Level.WARNING, "Caught QVCSOperationException: " + e.getMessage()); } }
From source file:AST.DesignPatternDetection.java
private void btRunSgisoActionPerformed(ActionEvent e) throws IOException, InterruptedException { // TODO add your code here try {/*from www.j a v a2 s . co m*/ Cursor hourglassCursor = new Cursor(Cursor.WAIT_CURSOR); setCursor(hourglassCursor); String myCommand = programPath + "/Projects/script_" + cbSelectionDP.getSelectedItem().toString() + ".sh"; ProcessBuilder pb = new ProcessBuilder(myCommand); long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); Process p = pb.start(); // Start the process. p.waitFor(); // Wait for the process to finish. long endTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long duration = (endTime - startTime); String duration_ = Long.toString(duration); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); PrintWriter writer_time = new PrintWriter(programPath + "/Projects/" + tfProjectName.getText() + "/outputs/" + cbSelectionDP.getSelectedItem().toString() + "_outputs/time_" + cbSelectionDP.getSelectedItem().toString() + ".txt"); writer_time.println( "Script lasts " + duration_ + " seconds. --" + dateFormat.format(date).toString() + "--"); writer_time.close(); taInfo.append("5. Subdue-Sgiso isomorphic search algorithm runned in " + duration_ + " seconds.(/Projects/" + tfProjectName.getText() + "/outputs/" + cbSelectionDP.getSelectedItem().toString() + "_outputs)" + "\n"); Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR); setCursor(normalCursor); //remove the executable file. String myShellScript = ""; myShellScript = "rm " + programPath + "/Projects/script_" + cbSelectionDP.getSelectedItem().toString() + ".sh "; Runtime.getRuntime().exec(myShellScript); JOptionPane.showMessageDialog(null, "Sgiso script executed successfully"); } catch (Exception e2) { // TODO: handle exception System.out.println(e2.toString()); JOptionPane.showMessageDialog(null, e2.toString()); e2.printStackTrace(); } }
From source file:org.openscience.jmol.app.Jmol.java
Jmol(Splash splash, JFrame frame, Jmol parent, int startupWidth, int startupHeight, String commandOptions, Point loc) {/*from ww w . j a v a 2 s . c o m*/ super(true); this.frame = frame; this.startupWidth = startupWidth; this.startupHeight = startupHeight; numWindows++; try { say("history file is " + historyFile.getFile().getAbsolutePath()); } catch (Exception e) { } frame.setTitle("Jmol"); frame.getContentPane().setBackground(Color.lightGray); frame.getContentPane().setLayout(new BorderLayout()); this.splash = splash; setBorder(BorderFactory.createEtchedBorder()); setLayout(new BorderLayout()); language = GT.getLanguage(); status = (StatusBar) createStatusBar(); say(GT._("Initializing 3D display...")); // display = new DisplayPanel(status, guimap, haveDisplay.booleanValue(), startupWidth, startupHeight); String adapter = System.getProperty("model"); if (adapter == null || adapter.length() == 0) adapter = "smarter"; if (adapter.equals("smarter")) { report("using Smarter Model Adapter"); modelAdapter = new SmarterJmolAdapter(); } else if (adapter.equals("cdk")) { report("the CDK Model Adapter is currently no longer supported. Check out http://bioclipse.net/. -- using Smarter"); // modelAdapter = new CdkJmolAdapter(null); modelAdapter = new SmarterJmolAdapter(); } else { report("unrecognized model adapter:" + adapter + " -- using Smarter"); modelAdapter = new SmarterJmolAdapter(); } appletContext = commandOptions; viewer = JmolViewer.allocateViewer(display, modelAdapter); viewer.setAppletContext("", null, null, commandOptions); if (display != null) display.setViewer(viewer); say(GT._("Initializing Preferences...")); preferencesDialog = new PreferencesDialog(frame, guimap, viewer); say(GT._("Initializing Recent Files...")); recentFiles = new RecentFilesDialog(frame); if (haveDisplay.booleanValue()) { say(GT._("Initializing Script Window...")); scriptWindow = new ScriptWindow(viewer, frame); } MyStatusListener myStatusListener; myStatusListener = new MyStatusListener(); viewer.setJmolStatusListener(myStatusListener); say(GT._("Initializing Measurements...")); measurementTable = new MeasurementTable(viewer, frame); // Setup Plugin system // say(GT._("Loading plugins...")); // pluginManager = new CDKPluginManager( // System.getProperty("user.home") + System.getProperty("file.separator") // + ".jmol", new JmolEditBus(viewer) // ); // pluginManager.loadPlugin("org.openscience.cdkplugin.dirbrowser.DirBrowserPlugin"); // pluginManager.loadPlugin("org.openscience.cdkplugin.dirbrowser.DadmlBrowserPlugin"); // pluginManager.loadPlugins( // System.getProperty("user.home") + System.getProperty("file.separator") // + ".jmol/plugins" // ); // feature to allow for globally installed plugins // if (System.getProperty("plugin.dir") != null) { // pluginManager.loadPlugins(System.getProperty("plugin.dir")); // } if (haveDisplay.booleanValue()) { // install the command table say(GT._("Building Command Hooks...")); commands = new Hashtable(); if (display != null) { Action[] actions = getActions(); for (int i = 0; i < actions.length; i++) { Action a = actions[i]; commands.put(a.getValue(Action.NAME), a); } } menuItems = new Hashtable(); say(GT._("Building Menubar...")); executeScriptAction = new ExecuteScriptAction(); menubar = createMenubar(); add("North", menubar); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add("North", createToolbar()); JPanel ip = new JPanel(); ip.setLayout(new BorderLayout()); ip.add("Center", display); panel.add("Center", ip); add("Center", panel); add("South", status); say(GT._("Starting display...")); display.start(); //say(GT._("Setting up File Choosers...")); /* pcs.addPropertyChangeListener(chemFileProperty, exportAction); pcs.addPropertyChangeListener(chemFileProperty, povrayAction); pcs.addPropertyChangeListener(chemFileProperty, writeAction); pcs.addPropertyChangeListener(chemFileProperty, toWebAction); pcs.addPropertyChangeListener(chemFileProperty, printAction); pcs.addPropertyChangeListener(chemFileProperty, viewMeasurementTableAction); */ if (menuFile != null) { menuStructure = viewer.getFileAsString(menuFile); } jmolpopup = JmolPopup.newJmolPopup(viewer, true, menuStructure, true); } // prevent new Jmol from covering old Jmol if (loc != null) { frame.setLocation(loc); } else if (parent != null) { Point location = parent.frame.getLocationOnScreen(); int maxX = screenSize.width - 50; int maxY = screenSize.height - 50; location.x += 40; location.y += 40; if ((location.x > maxX) || (location.y > maxY)) { location.setLocation(0, 0); } frame.setLocation(location); } frame.getContentPane().add("Center", this); frame.addWindowListener(new Jmol.AppCloser()); frame.pack(); frame.setSize(startupWidth, startupHeight); ImageIcon jmolIcon = JmolResourceHandler.getIconX("icon"); Image iconImage = jmolIcon.getImage(); frame.setIconImage(iconImage); // Repositionning windows if (scriptWindow != null) historyFile.repositionWindow(SCRIPT_WINDOW_NAME, scriptWindow, 200, 100); say(GT._("Setting up Drag-and-Drop...")); FileDropper dropper = new FileDropper(); final JFrame f = frame; dropper.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { //System.out.println("Drop triggered..."); f.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (evt.getPropertyName().equals(FileDropper.FD_PROPERTY_FILENAME)) { final String filename = evt.getNewValue().toString(); viewer.openFile(filename); } else if (evt.getPropertyName().equals(FileDropper.FD_PROPERTY_INLINE)) { final String inline = evt.getNewValue().toString(); viewer.openStringInline(inline); } f.setCursor(Cursor.getDefaultCursor()); } }); this.setDropTarget(new DropTarget(this, dropper)); this.setEnabled(true); say(GT._("Launching main frame...")); }
From source file:org.openscience.jmol.app.Jmol.java
public static Jmol getJmol(JFrame frame, int startupWidth, int startupHeight, String commandOptions) { Splash splash = null;/*from w w w . j a v a 2 s . co m*/ if (haveDisplay.booleanValue()) { ImageIcon splash_image = JmolResourceHandler.getIconX("splash"); report("splash_image=" + splash_image); splash = new Splash(frame, splash_image); splash.setCursor(new Cursor(Cursor.WAIT_CURSOR)); splash.showStatus(GT._("Creating main window...")); splash.showStatus(GT._("Initializing Swing...")); } try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception exc) { System.err.println("Error loading L&F: " + exc); } screenSize = Toolkit.getDefaultToolkit().getScreenSize(); if (splash != null) splash.showStatus(GT._("Initializing Jmol...")); Jmol window = new Jmol(splash, frame, null, startupWidth, startupHeight, commandOptions); if (haveDisplay.booleanValue()) frame.show(); return window; }