List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:stainingestimation.StainingEstimation.java
@Override public void updateOptionsToTMAspot(TMAspot visible_TMAspot, List<TMAspot> selected_TMAspots) { if (isShowing()) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); updateOptionsToTMAspot(visible_TMAspot); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }//w w w .j ava2s. c o m }
From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java
/** * This method initializes jButton /* w ww .j av a 2 s . c om*/ * * @return javax.swing.JButton */ private JButton getJButton() { if (jButton == null) { jButton = new JButton("Save"); if (specimen.isStateDone()) { jButton.setEnabled(false); jButton.setText("Migrated " + specimen.getLoadFlags()); } jButton.setMnemonic(KeyEvent.VK_S); jButton.setToolTipText( "Save changes to this record to the database. No fields should have red backgrounds before you save."); jButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { thisPane.getParent().getParent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } catch (Exception ex) { log.error(ex); } save(); ((CollectorTableModel) jTableCollectors.getModel()).fireTableDataChanged(); ((NumberTableModel) jTableNumbers.getModel()).fireTableDataChanged(); try { thisPane.getParent().getParent() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Exception ex) { log.error(ex); } } }); } return jButton; }
From source file:com.projity.pm.graphic.frames.GraphicManager.java
public void showWaitCursor(boolean show) { Frame frame = getFrame();/* w ww . j ava 2 s . com*/ if (frame == null) return; if (show) frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); else frame.setCursor(Cursor.getDefaultCursor()); }
From source file:org.jab.docsearch.DocSearch.java
/** * creates a new docSearcher index/*from w w w .jav a 2 s . c o m*/ * * @param di * DocSearcherIndex * @param isCdRomIndx * is CDROM index * @throws IOException * IO problem */ private void createNewIndex(DocSearcherIndex di, boolean isCdRomIndx) throws IOException { setStatus(I18n.getString("indexing") + " (" + di.getIndexPath() + ") "); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); checkDefaults(); StringBuffer failedBuf = new StringBuffer(); String indexDirNew = di.getIndexPath(); File indexFolder = new File(indexDirNew); long curFileSizeBytes = 0; int addedSuccessfully = 0; StringBuilder noRobotsBuf = new StringBuilder(); noRobotsBuf.append('\n').append(I18n.getString("files_not_indexed_robot")); int numNoIndex = 0; boolean newIndex = false; if (!indexFolder.exists()) { setStatus(indexDirNew + " " + I18n.getString("lower_not_exist")); indexFolder.mkdir(); newIndex = true; } // BUILD THE INDEX File contentFolder = new File(di.getPath()); int totalFolders = 1; int totalFiles = 0; int numErrors = 0; // String urlStr = ""; // String dateStr = ""; // File tempDFile; int curSize = 1; if (contentFolder.exists()) { ArrayList<String> folderList = new ArrayList<String>(); folderList.add(di.getPath()); // add in our contentDir String curFolderString = di.getPath(); String[] filesString; String[] foldersString; File curFolderFile; int curItemNo = 0; int lastItemNo = 0; int numFiles = 0; int numFolders = 0; int curSubNum = 0; int startSubNum = Utils.countSlash(di.getPath()); int maxSubNum = startSubNum + di.getDepth(); // creating the index IndexWriter writer = new IndexWriter(indexDirNew, new StandardAnalyzer(), newIndex); // writer.setUseCompoundFile(true); do { // create our folder file curFolderString = folderList.get(curItemNo); curFolderFile = new File(curFolderString); curSubNum = Utils.countSlash(curFolderString); try { // handle any subfolders --> add them to our folderlist foldersString = curFolderFile.list(ff); numFolders = foldersString.length; for (int i = 0; i < numFolders; i++) { // add them to our folderlist String curFold = curFolderString + pathSep + foldersString[i] + pathSep; curFold = Utils.replaceAll(pathSep + pathSep, curFold, pathSep); folderList.add(curFold); lastItemNo++; totalFolders++; // debug output setStatus(dsFndFldr + " " + curFold); } // end for having more than 0 folder } catch (Exception e) { logger.fatal("createNewIndex() failed", e); setStatus(curFolderString + " : " + e.toString()); } // add our files try { filesString = curFolderFile.list(wf); numFiles = filesString.length; logger.info("createNewIndex() Indexing " + numFiles + " files..."); for (int i = 0; i < numFiles; i++) { // add them to our folderlist String curFi = curFolderString + pathSep + filesString[i]; curFi = Utils.replaceAll(pathSep + pathSep, curFi, pathSep); curFileSizeBytes = FileUtils.getFileSize(curFi); if (curFileSizeBytes > getMaxFileSize()) { setStatus(I18n.getString("skipping_file_too_big") + " (" + curFileSizeBytes + ") " + filesString[i]); } else { // file size is not too big setStatus(I18n.getString("please_wait...") + " " + curFi + " # " + curSize); curSize++; addedSuccessfully = idx.addDocToIndex(curFi, writer, di, isCdRomIndx, null); switch (addedSuccessfully) { case 1: // error numErrors++; if (numErrors < 8) { failedBuf.append('\n').append(curFi); } break; case 2: // meta robots = noindex numNoIndex++; if (numNoIndex < 8) { noRobotsBuf.append('\n').append(curFi); } break; default: // OK totalFiles++; break; } // end of switch } // end for not skipping, file size is not too big } // end for files } // end of trying to get files catch (Exception e) { logger.error("createNewIndex() failed", e); setStatus(I18n.getString("error") + " " + e.toString()); } // increment our curItem folderList.set(curItemNo, null); // remove memory overhead as // you go! curItemNo++; if (curSubNum >= maxSubNum) { break; } } while (curItemNo <= lastItemNo); writer.close(); // close the writer indexes.add(di); } else { hasErr = true; errString = fEnv.getContentDirectory() + " " + I18n.getString("lower_not_exist"); } // end for content dir Missing if (hasErr) { showMessage(I18n.getString("error_creating_index"), errString); } else { StringBuilder resultsBuf = new StringBuilder(); resultsBuf.append(I18n.getString("added_to_index")); resultsBuf.append(" \""); resultsBuf.append(di.getName()); resultsBuf.append("\" "); resultsBuf.append(totalFiles); resultsBuf.append(' '); resultsBuf.append(I18n.getString("files_from")); resultsBuf.append(' '); resultsBuf.append(totalFolders); resultsBuf.append(' '); resultsBuf.append(I18n.getString("folders")); resultsBuf.append("\n\n"); resultsBuf.append(I18n.getString("starting_in_folder")); resultsBuf.append("\n\n\t"); resultsBuf.append(' '); resultsBuf.append(di.getPath()); resultsBuf.append("\n\n"); resultsBuf.append(I18n.getString("for_a_depth_of")); resultsBuf.append(' '); resultsBuf.append(di.getDepth()); resultsBuf.append('.'); if (numErrors > 0) { resultsBuf.append('\n'); resultsBuf.append(numErrors); resultsBuf.append(' '); resultsBuf.append(I18n.getString("files_not_indexed")).append('.'); resultsBuf.append(failedBuf); } if (numNoIndex > 0) { resultsBuf.append("\n\n" + numNoIndex); resultsBuf.append('\n'); resultsBuf.append(I18n.getString("files_not_indexed_robot")); resultsBuf.append(noRobotsBuf); } showMessage(dsIdxCrtd, resultsBuf.toString()); } setStatus(dsIdxCrtd); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:com.projity.pm.graphic.frames.GraphicManager.java
public void setToolBarAndMenus(final Container contentPane) { JToolBar toolBar;//from w ww.j a va 2 s . c o m if (Environment.isRibbonUI()) { if (Environment.isNeedToRestart()) { contentPane.add(new JLabel(Messages.getString("Error.restart")), BorderLayout.CENTER); return; } setRibbon((JRibbonFrame) container, getMenuManager()); // JToolBar viewToolBar = getMenuManager().getToolBar(MenuManager.VIEW_TOOL_BAR_WITH_NO_SUB_VIEW_OPTION); // topTabs = new TabbedNavigation(); // JComponent tabs = topTabs.createContentPanel(getMenuManager(),viewToolBar,0,JTabbedPane.TOP,true); // tabs.setAlignmentX(0.0f); // so it is left justified // // // Box top = new Box(BoxLayout.Y_AXIS); // JComponent bottom; // top.add(tabs); // bottom = new TabbedNavigation().createContentPanel(getMenuManager(),viewToolBar,1,JTabbedPane.BOTTOM,false); // contentPane.add(top, BorderLayout.BEFORE_FIRST_LINE); // contentPane.add(bottom,BorderLayout.AFTER_LAST_LINE); // if (Environment.isNewLaf()) // contentPane.setBackground(Color.WHITE); // if (Environment.isMac()){ // //System.setProperty("apple.laf.useScreenMenuBar","true"); // //System.setProperty("com.apple.mrj.application.apple.menu.about.name", Messages.getMetaString("Text.ShortTitle")); // JMenuBar menu = getMenuManager().getMenu(Environment.getStandAlone()?MenuManager.MAC_STANDARD_MENU:MenuManager.SERVER_STANDARD_MENU); // //((JComponent)menu).setBorder(BorderFactory.createEmptyBorder()); // // ((JFrame)container).setJMenuBar(menu); // projectListMenu = (JMenu) menu.getComponent(5); // } } else if (Environment.isNewLook()) { if (Environment.isNeedToRestart()) { contentPane.add(new JLabel(Messages.getString("Error.restart")), BorderLayout.CENTER); return; } toolBar = getMenuManager().getToolBar(MenuManager.BIG_TOOL_BAR); if (!getLafManager().isToolbarOpaque()) toolBar.setOpaque(false); if (!isApplet()) getMenuManager().setActionVisible(ACTION_FULL_SCREEN, false); if (Environment.isExternal()) // external users only see project team getMenuManager().setActionVisible(ACTION_TEAM_FILTER, false); toolBar.addSeparator(new Dimension(20, 20)); toolBar.add(new Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE))); toolBar.add(((DefaultFrameManager) getFrameManager()).getProjectComboPanel()); toolBar.add(Box.createRigidArea(new Dimension(20, 20))); if (Environment.isNewLaf()) toolBar.setBackground(Color.WHITE); toolBar.setFloatable(false); toolBar.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); Box top; JComponent bottom; top = new Box(BoxLayout.Y_AXIS); toolBar.setAlignmentX(0.0f); // so it is left justified top.add(toolBar); JToolBar viewToolBar = getMenuManager().getToolBar(MenuManager.VIEW_TOOL_BAR_WITH_NO_SUB_VIEW_OPTION); topTabs = new TabbedNavigation(); JComponent tabs = topTabs.createContentPanel(getMenuManager(), viewToolBar, 0, JTabbedPane.TOP, true); tabs.setAlignmentX(0.0f); // so it is left justified top.add(tabs); bottom = new TabbedNavigation().createContentPanel(getMenuManager(), viewToolBar, 1, JTabbedPane.BOTTOM, false); contentPane.add(top, BorderLayout.BEFORE_FIRST_LINE); contentPane.add(bottom, BorderLayout.AFTER_LAST_LINE); if (Environment.isNewLaf()) contentPane.setBackground(Color.WHITE); if (Environment.isMac()) { //System.setProperty("apple.laf.useScreenMenuBar","true"); //System.setProperty("com.apple.mrj.application.apple.menu.about.name", Messages.getMetaString("Text.ShortTitle")); JMenuBar menu = getMenuManager().getMenu(Environment.getStandAlone() ? MenuManager.MAC_STANDARD_MENU : MenuManager.SERVER_STANDARD_MENU); //((JComponent)menu).setBorder(BorderFactory.createEmptyBorder()); ((JFrame) container).setJMenuBar(menu); projectListMenu = (JMenu) menu.getComponent(5); } } else { toolBar = getMenuManager().getToolBar( Environment.isMac() ? MenuManager.MAC_STANDARD_TOOL_BAR : MenuManager.STANDARD_TOOL_BAR); filterToolBarManager = FilterToolBarManager.create(getMenuManager()); filterToolBarManager.addButtons(toolBar); contentPane.add(toolBar, BorderLayout.BEFORE_FIRST_LINE); JToolBar viewToolBar = getMenuManager().getToolBar(MenuManager.VIEW_TOOL_BAR); viewToolBar.setOrientation(JToolBar.VERTICAL); viewToolBar.setRollover(true); contentPane.add(viewToolBar, BorderLayout.WEST); JMenuBar menu = getMenuManager().getMenu(Environment.getStandAlone() ? (Environment.isMac() ? MenuManager.MAC_STANDARD_MENU : MenuManager.STANDARD_MENU) : MenuManager.SERVER_STANDARD_MENU); if (!Environment.isMac()) { ((JComponent) menu).setBorder(BorderFactory.createEmptyBorder()); JMenuItem logo = (JMenuItem) menu.getComponent(0); logo.setBorder(BorderFactory.createEmptyBorder()); logo.setMaximumSize(new Dimension(124, 52)); logo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } ((JFrame) container).setJMenuBar(menu); projectListMenu = (JMenu) menu.getComponent(Environment.isMac() ? 5 : 6); } //accelerators addCtrlAccel(KeyEvent.VK_G, ACTION_GOTO, null); addCtrlAccel(KeyEvent.VK_L, ACTION_GOTO, null); addCtrlAccel(KeyEvent.VK_F, ACTION_FIND, null); addCtrlAccel(KeyEvent.VK_Z, ACTION_UNDO, null); //- Sanhita addCtrlAccel(KeyEvent.VK_Y, ACTION_REDO, null); addCtrlAccel(KeyEvent.VK_N, ACTION_NEW_PROJECT, null); addCtrlAccel(KeyEvent.VK_O, ACTION_OPEN_PROJECT, null); addCtrlAccel(KeyEvent.VK_S, ACTION_SAVE_PROJECT, null); addCtrlAccel(KeyEvent.VK_P, ACTION_PRINT, null); //-Sanhita addCtrlAccel(KeyEvent.VK_I, ACTION_INSERT_TASK, null); addCtrlAccel(KeyEvent.VK_PERIOD, ACTION_INDENT, null); addCtrlAccel(KeyEvent.VK_COMMA, ACTION_OUTDENT, null); addCtrlAccel(KeyEvent.VK_PLUS, ACTION_EXPAND, new ExpandAction()); addCtrlAccel(KeyEvent.VK_ADD, ACTION_EXPAND, new ExpandAction()); addCtrlAccel(KeyEvent.VK_EQUALS, ACTION_EXPAND, new ExpandAction()); addCtrlAccel(KeyEvent.VK_MINUS, ACTION_COLLAPSE, new CollapseAction()); addCtrlAccel(KeyEvent.VK_SUBTRACT, ACTION_COLLAPSE, new CollapseAction()); // To force a recalculation. This normally shouldn't be needed. addCtrlAccel(KeyEvent.VK_R, ACTION_RECALCULATE, new RecalculateAction()); }
From source file:Form.Principal.java
public void PanelClientes() { int i = 0;//from ww w. j a v a 2s . c om int Altura = 0; Color gris = new Color(44, 44, 44); Color rojo = new Color(221, 76, 76); Color azul = new Color(0, 153, 255); try { //Consultamos todos los clientes ResultSet Comandos = Funcion.Select(st, "SELECT * FROM cliente;"); //Ciclo para crear un panel para cada uno while (Comandos.next()) { //Creamos un panel con alineacion a la izquierda JPanel Panel = new JPanel(); Panel.setLayout(null); jPanel8.add(Panel); //Tamao del panel Panel.setSize(700, 195); // La posicion y del panel ira incrementando para que no se encimen Altura = 30 + (i * 205); Panel.setLocation(50, Altura); Panel.setBackground(Color.white); Panel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); //Creamos label para mostrar los datos del cliente, el codigo html es para que al llegar al final del panel //se pase a la siguiente linea y para el margen izquierdo JLabel RFC = new JLabel(); RFC.setText("RFC: " + Comandos.getString("RFC")); JLabel Nombre = new JLabel(); Nombre.setText("Nombre: " + Comandos.getString("NombreCliente")); JTextArea Direccion = new JTextArea(); Direccion.setLineWrap(true); Direccion.setBorder(null); Direccion.setText("Direccin: " + Comandos.getString("Direccion")); JLabel Correo = new JLabel(); Correo.setText("Correo: " + Comandos.getString("correo")); JButton VerMas = new JButton(); VerMas.setText("Ver ms"); VerMas.setName(Comandos.getString("idCliente")); VerMas.setBackground(azul); JButton Eliminar = new JButton(); Eliminar.setText("Eliminar"); Eliminar.setName(Comandos.getString("idCliente")); Eliminar.setBackground(rojo); MouseListener mlVerMas = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { //System.out.println("Released!"); } @Override public void mousePressed(MouseEvent e) { //System.out.println("Pressed!"); } @Override public void mouseExited(MouseEvent e) { //System.out.println("Exited!"); } @Override public void mouseEntered(MouseEvent e) { //System.out.println("Entered!"); e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } @Override public void mouseClicked(MouseEvent e) { JButton source = (JButton) e.getSource(); id = Integer.parseInt(source.getName()); jTabbedPane2.setSelectedIndex(4); jButton16.setVisible(true); jButton17.setVisible(true); jButtonEditar.setVisible(true); jPanel9.setVisible(true); jPanel10.setVisible(true); jPanel14.setVisible(false); LlenarPanel(); } }; VerMas.addMouseListener(mlVerMas); MouseListener mlEliminar = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { //System.out.println("Released!"); } @Override public void mousePressed(MouseEvent e) { //System.out.println("Pressed!"); } @Override public void mouseExited(MouseEvent e) { //System.out.println("Exited!"); } @Override public void mouseEntered(MouseEvent e) { //System.out.println("Entered!"); e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } @Override public void mouseClicked(MouseEvent e) { JButton source = (JButton) e.getSource(); Funcion.Update(st, "DELETE FROM cliente WHERE idCliente = " + source.getName() + ";"); Autocompletar.removeAllItems(); Autocompletar = new TextAutoCompleter(jTextField2); ResultSet Comandos = Funcion.Select(st, "SELECT * FROM cliente;"); try { while (Comandos.next()) { Autocompletar.addItem(Comandos.getString("RFC")); } } catch (SQLException ex) { //Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } jPanel8.removeAll(); PanelClientes(); jPanel8.repaint(); } }; Eliminar.addMouseListener(mlEliminar); //Fuente del texto RFC.setFont(new Font("Verdana", Font.PLAIN, 14)); RFC.setForeground(gris); Nombre.setFont(new Font("Verdana", Font.PLAIN, 14)); Nombre.setForeground(gris); Direccion.setFont(new Font("Verdana", Font.PLAIN, 14)); Direccion.setForeground(gris); Correo.setFont(new Font("Verdana", Font.PLAIN, 14)); Correo.setForeground(gris); VerMas.setFont(new Font("Verdana", Font.PLAIN, 14)); VerMas.setForeground(Color.white); Eliminar.setFont(new Font("Verdana", Font.PLAIN, 14)); Eliminar.setForeground(Color.white); /*VERMAS.setFont(new Font("Verdana", Font.PLAIN, 13)); VERMAS.setForeground(azul);*/ //Aadimos los label al panel correspondiente del cliente Panel.add(RFC); Panel.add(Nombre); Panel.add(Direccion); Panel.add(Correo); Panel.add(VerMas); Panel.add(Eliminar); RFC.setLocation(30, 10); RFC.setSize(610, 30); Nombre.setLocation(30, 40); Nombre.setSize(610, 30); Direccion.setLocation(30, 75); Direccion.setSize(610, 40); Correo.setLocation(30, 115); Correo.setSize(610, 30); VerMas.setLocation(210, 150); VerMas.setSize(120, 35); Eliminar.setLocation(390, 150); Eliminar.setSize(120, 35); //Panel.add(VERMAS); i++; } } catch (SQLException ex) { Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } //Dependiendo de cuantos clientes se agregaron, se ajusta el tamao del panel principal para que el scroll llegue hasta ahi jPanel8.setPreferredSize(new Dimension(jPanel8.getWidth(), Altura + 205)); }
From source file:org.jab.docsearch.DocSearch.java
private void deleteRecursive(String folderToDelete) { int curFoldNum = 0; File curFolderFile;//from w ww . j av a 2 s .c o m String curFold = ""; String[] subFolds; int numSubFolds = 0; int totalFolds = 0; int numFiles = 0; String curFolderString = ""; String curFileString = ""; File testFile; try { // first obtain a list of all folders setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); ArrayList<String> allFold = new ArrayList<String>(); allFold.add(folderToDelete); setStatus(dsRmvgIdxFis); do { // get list of sub folders curFolderString = allFold.get(curFoldNum); curFolderFile = new File(curFolderString); subFolds = curFolderFile.list(ff); numSubFolds = subFolds.length; for (int y = 0; y < numSubFolds; y++) { curFold = curFolderString + pathSep + subFolds[y] + pathSep; curFold = Utils.replaceAll(pathSep + pathSep, curFold, pathSep); allFold.add(curFold); totalFolds++; } curFoldNum++; } while (curFoldNum < totalFolds); // next get a list of all files ArrayList<String> allFiles = new ArrayList<String>(); Iterator<String> foldIt = allFold.iterator(); String[] filesString; while (foldIt.hasNext()) { curFolderString = foldIt.next(); curFolderFile = new File(curFolderString); // get the files filesString = curFolderFile.list(); numFiles = filesString.length; for (int y = 0; y < numFiles; y++) { // add the files curFileString = curFolderString + pathSep + filesString[y]; curFileString = Utils.replaceAll(pathSep + pathSep, curFileString, pathSep); testFile = new File(curFileString); if (!testFile.isDirectory()) { allFiles.add(curFileString); } } } // end for iterating // delete all files Iterator<String> fileIt = allFiles.iterator(); while (fileIt.hasNext()) { curFileString = fileIt.next(); testFile = new File(curFileString); testFile.delete(); } // end while deleteing // delete all folders int numFoldTotal = allFiles.size(); for (int y = numFoldTotal - 1; y >= 0; y--) { curFolderString = allFiles.get(y); curFolderFile = new File(curFolderString); logger.info("deleteRecursive() " + I18n.getString("deleting") + " " + curFolderString); curFolderFile.delete(); } // delete last folder curFolderFile = new File(folderToDelete); curFolderFile.delete(); } // end for trrying recursive delete catch (Exception e) { showMessage(I18n.getString("error"), e.toString()); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); setStatus(I18n.getString("index_removed")); } }
From source file:de.main.sessioncreator.DesktopApplication1View.java
private void btnWizardNext(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWizardNext int selTab = wizardtabp.getSelectedIndex(); int maxTab = wizardtabp.getTabCount(); try {/* w w w . jav a2 s . com*/ wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardtabp.setSelectedIndex(selTab + 1); if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Charter")) { wizardChckBxNewCharter.addActionListener(new chckBxNewCharterListener()); swingHelper.setTab1EnableAt(wizardtabp, 1); progressBar.setVisible(true); progressBar.setIndeterminate(true); wizardbtnBack.setEnabled(false); wizardbtntopBack.setEnabled(false); wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); wizardCmbxCharter.removeAllItems(); fileHelper.charterList.clear(); final File directory = new File(wizardTfPathTodo.getText()); worker = new SwingWorker<String, Void>() { @Override protected String doInBackground() { return getCharterBackgroundW(directory); } @Override protected void done() { try { if (!worker.get().contains("no")) { progressBar.setIndeterminate(false); progressBar.setVisible(false); wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardbtnNext.setEnabled(true); wizardbtntopNext.setEnabled(true); int no = wizardCmbxCharter.getItemCount(); wizardLblChooseCharter.setText("Please select one of " + no + " Charter"); mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { progressBar.setIndeterminate(false); progressBar.setVisible(false); wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } catch (InterruptedException ex) { Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex); } } }; worker.execute(); } if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Areas")) { swingHelper.setTab1EnableAt(wizardtabp, 2); progressBar.setVisible(true); progressBar.setIndeterminate(true); wizardbtnBack.setEnabled(false); wizardbtntopBack.setEnabled(false); wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); wizardbtnAddAreas.setEnabled(false); if (wizardtaChoosenAreas.getDocument().getLength() == 0) { wizardbtnRemoveArea.setEnabled(false); } else { wizardbtnRemoveArea.setEnabled(true); } wizardtaChoosenAreas.getDocument().addDocumentListener(new choosenAreaListener()); wizardtabpAreas.removeAll(); final File coverageini = new File(wizardtfCoverageini.getText()); getAreasBacgroundW(coverageini); wizardbtnBack.setEnabled(true); wizardbtntopBack.setEnabled(true); wizardbtnNext.setEnabled(true); wizardbtntopNext.setEnabled(true); if (wizardChckBxNewCharter.isSelected()) { wizardbtnSaveTodo.setEnabled(true); } wizardbtnNext.setText("Create Testsession"); progressBar.setIndeterminate(false); progressBar.setVisible(false); if (!wizardChckBxNewCharter.isSelected()) { String todo = ChoosenCharter.substring(ChoosenCharter.indexOf("(" + wizardTfPathTodo.getText())) .replace("(", "").replace(")", ""); final File todocheckliste = new File(todo); String msg = "Import all Areas from the Todo-Session?"; fileHelper.getAreasChecklist(todocheckliste); fileHelper.areaChecklist.remove(0); if (!fileHelper.areaChecklist.get(0).isEmpty()) { if (JOptionPane.showConfirmDialog(wizardtabpAreas, msg, "Import?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 0) { wizardtaChoosenAreas.setText(""); for (String s : fileHelper.areaChecklist) { wizardtaChoosenAreas.append(s + "\n"); } wizardtaChoosenAreas.setCaretPosition(0); } } } } if (wizardtabp.getTitleAt(wizardtabp.getSelectedIndex()).contains("Testsession")) { swingHelper.setTab1EnableAt(wizardtabp, 3); wizardbtnNext.setVisible(false); wizardbtntopNext.setEnabled(false); wizardbtnStart.addActionListener(new ButtonListenerStart()); wizardbtntopStart.addActionListener(new ButtonListenerStart()); wizardbtnStop.addActionListener(new ButtonListenerStop()); wizardbtntopStop.addActionListener(new ButtonListenerStop()); if (wizardChckBxNewCharter.isSelected()) { wizardtaCharterdynamic.setText(wizardtaNewCharter.getText().trim()); } else { wizardtaCharterdynamic.setText( ChoosenCharter.substring(0, ChoosenCharter.indexOf("(" + wizardTfPathTodo.getText()))); } statusMessageLabel.setText(""); wizardbtnStart.setVisible(true); wizardbtnStart.setEnabled(true); wizardbtntopStart.setEnabled(true); wizardbtnStop.setVisible(true); wizardbtnStop.setEnabled(false); wizardbtntopStop.setEnabled(false); final JPopupMenu popupMenu = new JPopupMenu(); final File coverageini = new File(wizardtfCoverageini.getText()); swingHelper.getAreastoPopupMenu(popupMenu, coverageini, new alBugsIssue()); popupListener2 = new PopupListener(popupMenu); wizardtaTestsessionAreas.addMouseListener(popupListener2); wizardtaTestsessionAreas.setText(wizardtaChoosenAreas.getText()); wizardtaTestsessionAreas.setCaretPosition(0); wizardtaCharterdynamic.setCaretPosition(0); if (wizardChckBxSecondTester.isSelected()) { TesterRealname = wizardCmbxTester.getSelectedItem().toString(); wizardtfNameOfTester.setText(TesterRealname.substring(4) + " " + wizardCmbxMoreTester.getSelectedItem().toString().substring(4)); } else { TesterRealname = wizardCmbxTester.getSelectedItem().toString(); wizardtfNameOfTester.setText(TesterRealname.substring(4)); } } if (wizardtabp.getSelectedIndex() == maxTab) { wizardbtnNext.setEnabled(false); wizardbtntopNext.setEnabled(false); } } catch (IndexOutOfBoundsException ex) { statusMessageLabel.setText(ex.getMessage()); } }
From source file:stainingestimation.StainingEstimation.java
/** * Opens a dialog to let the user choose a file in which the table of the staining estimation parameters is saved. *//* w w w. j a v a 2 s. c om*/ private void saveTable() { if (previewOriginal != null && jXTable1.getRowCount() > 0) { String sep = manager.getColumnSeparator(); String currentDir = manager.getCurrentDir(); File file; List<String> exts = new ArrayList<>(1); exts.add("csv"); List<String> descrs = new ArrayList<>(1); descrs.add("Semicolon separated file"); String filename = null; if (manager.getVisibleTMAspot() != null) { filename = Misc.FilePathStringtoFilenameWOExtension(manager.getVisibleTMAspot().getName()) + ".csv"; } file = FileChooser.chooseSavingFile(this, currentDir, filename, exts, descrs); if (file != null) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Save csv try { BufferedWriter bfw = new BufferedWriter(new FileWriter(file)); for (int i = 0; i < jXTable1.getModel().getColumnCount(); i++) { bfw.write("\"" + jXTable1.getModel().getColumnName(i) + "\""); if (i < jXTable1.getModel().getColumnCount() - 1) bfw.write(sep); } for (int i = 0; i < jXTable1.getRowCount(); i++) { bfw.newLine(); for (int j = 0; j < jXTable1.getModel().getColumnCount(); j++) { Object o = jXTable1.getModel().getValueAt(i, j); if (((DefaultTableModel) jXTable1.getModel()).getColumnClass(j) == Double.class) { bfw.write((Double.toString((Double) jXTable1.getModel().getValueAt(i, j)))); } else if (((DefaultTableModel) jXTable1.getModel()) .getColumnClass(j) == Integer.class) { bfw.write((Integer.toString((Integer) jXTable1.getModel().getValueAt(i, j)))); } else if (((DefaultTableModel) jXTable1.getModel()) .getColumnClass(j) == String.class) { bfw.write("\"" + (String) (jXTable1.getModel().getValueAt(i, j)) + "\""); } else { bfw.write(jXTable1.getModel().getValueAt(i, j).toString()); } if (j < jXTable1.getModel().getColumnCount() - 1) bfw.write(sep); } } bfw.close(); } catch (Exception e) { Logger.getLogger(StainingEstimation.class.getName()).log(Level.SEVERE, null, e); JOptionPane.showMessageDialog(this, "Could not save file " + file.getName() + "\n(Maybe it is in use?)", "Error writing file", JOptionPane.ERROR_MESSAGE); } manager.setCurrentDir(file.getAbsolutePath()); setCursor(Cursor.getDefaultCursor()); } } }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Sets the mouse pointer. If the supplied parameter is true then the wait * cursor (usually an hourglass) is displayed. otherwise the system default * cursor is displayed./* w ww . j a va2s. com*/ * * @param wait * Whether to display the system default wait cursor */ private void setWaitCursor(boolean wait) { final JRootPane rootPane = getRootPane(); final Component glassPane = rootPane.getGlassPane(); if (wait) { final Cursor cursorWait = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); rootPane.setCursor(cursorWait); glassPane.setCursor(cursorWait); glassPane.setVisible(true); } else { final Cursor cursorDefault = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); glassPane.setVisible(false); glassPane.setCursor(cursorDefault); rootPane.setCursor(cursorDefault); } glassPane.invalidate(); rootPane.validate(); }