List of usage examples for java.awt Cursor Cursor
protected Cursor(String name)
Note: this constructor should only be used by AWT implementations as part of their support for custom cursors.
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
protected void showInfo() { JPanel panel = new JPanel(new BorderLayout()); panel.add(//from w w w. j a va2s.co m new JLabel( "<html>Kevin Krummenauer 2015<br><br>Icons by http://jonasraskdesign.com<br><br></html>"), BorderLayout.NORTH); JLabel link = new JLabel("Kontakt: " + EMAIL); link.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { openEMail(); } }); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.setForeground(Color.BLUE); panel.add(link, BorderLayout.CENTER); JPanel panel2 = new JPanel(new GridLayout(0, 1, 4, 4)); { panel2.add(new JLabel("<html><b>Libraries and its licenses</b> (click to open)</html>"), BorderLayout.NORTH); val list = Arrays.asList( new TwoObjectsX<String, String>("ILIAS Downloader 2", ServiceFunctions.ILIASDOWNLOADER_WEBSITE_LICENSE), new TwoObjectsX<String, String>("Java JDK 8", "http://www.oracle.com/technetwork/java/javase/terms/license/index.html"), new TwoObjectsX<String, String>("Apache Commons IO und Apache Commons Codec", "apache_license.txt"), new TwoObjectsX<String, String>("Project Lombok", "lombok_license.txt"), new TwoObjectsX<String, String>("KSOAP2", "ksoap2_android.txt"), new TwoObjectsX<String, String>("Simple XML Serialization", "apache_license.txt")); for (val lib : list) { link = new JLabel(lib.getObjectA()); if (lib.getObjectB() != null) { link.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String s = lib.getObjectB(); try { if (s.toLowerCase().startsWith("http")) { Desktop.getDesktop().browse(new URI(s)); } else { showLicense(s); } } catch (Exception e1) { showError("Lizenz nicht gefunden: " + s, e1); } } }); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.setForeground(Color.BLUE); } panel2.add(link); } } panel.add(panel2, BorderLayout.SOUTH); JOptionPane.showMessageDialog(mainFrame, panel, "Info " + APP_NAME, JOptionPane.INFORMATION_MESSAGE); }
From source file:org.bigwiv.blastgraph.gui.BlastGraphFrame.java
private void initComponents() { URL icon;//from w w w .ja va 2s .c o m icon = getClass().getResource("/org/bigwiv/blastgraph/icons/icon.png"); this.setIconImage(Toolkit.getDefaultToolkit().createImage(icon)); JComponent pane; pane = (JComponent) getContentPane(); // ====================Menu Setting======================= newItem = new JMenuItem("New From Blast"); newItem.setMnemonic('n'); newItem.addActionListener(commandActionListener); openItem = new JMenuItem("Open"); openItem.setMnemonic('o'); openItem.addActionListener(commandActionListener); appendGraphItem = new JMenuItem("Append Graph"); appendGraphItem.setMnemonic('a'); appendGraphItem.addActionListener(commandActionListener); saveItem = new JMenuItem("Save"); saveItem.setMnemonic('s'); saveItem.addActionListener(commandActionListener); saveAsGraphItem = new JMenuItem("Save As"); saveAsGraphItem.addActionListener(commandActionListener); exportGraphItem = new JMenuItem("Export"); exportGraphItem.addActionListener(commandActionListener); saveCurGraphItem = new JMenuItem("Save Current Graph"); saveCurGraphItem.addActionListener(commandActionListener); saveCurImgItem = new JMenuItem("Save Image"); saveCurImgItem.addActionListener(commandActionListener); saveAllVertexAttrItem = new JMenuItem("Save Vertex Attribute"); saveAllVertexAttrItem.addActionListener(commandActionListener); saveCurVertexAttrItem = new JMenuItem("Save Vertex Attribute"); saveCurVertexAttrItem.addActionListener(commandActionListener); saveAsMenu = new JMenu("Save As"); saveAsMenu.add(saveAsGraphItem); saveAsMenu.add(saveAllVertexAttrItem); saveCurGraphMenu = new JMenu("Save Current Graph"); saveCurGraphMenu.add(saveCurGraphItem); saveCurGraphMenu.add(saveCurImgItem); saveCurGraphMenu.add(saveCurVertexAttrItem); printItem = new JMenuItem("Print..."); printItem.setMnemonic('p'); printItem.addActionListener(commandActionListener); importVertexAttrItem = new JMenuItem("Import Vertex Attribute"); importVertexAttrItem.addActionListener(commandActionListener); closeItem = new JMenuItem("Close"); closeItem.setMnemonic('c'); closeItem.addActionListener(commandActionListener); exitItem = new JMenuItem("Exit"); exitItem.setMnemonic('x'); exitItem.addActionListener(commandActionListener); fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newItem); fileMenu.add(openItem); fileMenu.add(appendGraphItem); fileMenu.add(new JSeparator()); fileMenu.add(closeItem); fileMenu.add(new JSeparator()); fileMenu.add(saveItem); fileMenu.add(saveAsMenu); fileMenu.add(saveCurGraphMenu); fileMenu.add(new JSeparator()); fileMenu.add(printItem); fileMenu.add(new JSeparator()); fileMenu.add(importVertexAttrItem); fileMenu.add(exportGraphItem); fileMenu.add(new JSeparator()); fileMenu.add(exitItem); // edit menu undoItem = new JMenuItem("Undo"); redoItem = new JMenuItem("Redo"); Global.COMMAND_MANAGER.registerUndoRedoItem(undoItem, redoItem); removeSingleItem = new JMenuItem("Remove Single Vertices"); removeSingleItem.addActionListener(commandActionListener); filterItem = new JMenuItem("Filt Graph"); filterItem.addActionListener(commandActionListener); settingItem = new JMenuItem("Setting"); settingItem.addActionListener(commandActionListener); markovClusterItem = new JMenuItem("Markov Cluster"); markovClusterItem.addActionListener(commandActionListener); // genomeNumFiltItem = new JMenuItem("GenomeNum Filt"); // genomeNumFiltItem.addActionListener(commandActionListener); // removeSingleLinkageItem = new JMenuItem("Remove Single Linkage"); // removeSingleLinkageItem.addActionListener(commandActionListener); editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoItem); editMenu.add(redoItem); editMenu.add(filterItem); editMenu.add(markovClusterItem); editMenu.add(removeSingleItem); // editMenu.add(genomeNumFiltItem); // editMenu.add(removeSingleLinkageItem); editMenu.add(settingItem); // Tools Item geneContentItem = new JMenuItem("Gene Content Table"); geneContentItem.addActionListener(commandActionListener); batchSaveItem = new JMenuItem("Batch Save"); batchSaveItem.addActionListener(commandActionListener); mstItem = new JMenuItem("Minimum Spanning Tree"); mstItem.addActionListener(commandActionListener); viewNeighborItem = new JMenuItem("View Neighbor of..."); viewNeighborItem.addActionListener(commandActionListener); // // tempWorkItem = new JMenuItem("Temp Work"); // tempWorkItem.addActionListener(commandActionListener); toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(geneContentItem); toolsMenu.add(viewNeighborItem); toolsMenu.add(mstItem); toolsMenu.add(batchSaveItem); // toolsMenu.add(tempWorkItem); // graph Menu graphMenu = new JMenu("Graph"); previousItem = new JMenuItem("Previous"); previousItem.addActionListener(commandActionListener); nextItem = new JMenuItem("Next"); nextItem.addActionListener(commandActionListener); resortItem = new JMenuItem("Resort graphs"); resortItem.addActionListener(commandActionListener); graphMenu.add(nextItem); graphMenu.add(previousItem); graphMenu.add(resortItem); // help Menu helpContentItem = new JMenuItem("Online Manual"); helpContentItem.addActionListener(commandActionListener); aboutItem = new JMenuItem("About BlastGraph"); aboutItem.addActionListener(commandActionListener); helpMenu = new JMenu("Help"); helpMenu.add(helpContentItem); helpMenu.add(aboutItem); // menu bar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(graphMenu); menuBar.add(toolsMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); // ===================mainPanel Setting=================== GridBagManager.reset(); GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.GRID_BAG.anchor = GridBagConstraints.FIRST_LINE_START; GridBagManager.GRID_BAG.weightx = 0; GridBagManager.GRID_BAG.weighty = 0; GridBagManager.GRID_BAG.insets = new Insets(2, 2, 1, 1); mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); pane.add(mainPanel); hsplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); hsplitPane.setContinuousLayout(true); hsplitPane.setOneTouchExpandable(true); hsplitPane.setResizeWeight(0.9); // ===================toolBarPanel Setting=================== // graph file toolbar fileToolBar = new JToolBar(); fileToolBar.setRollover(true); newButton = new JButton(); newButton.setBorderPainted(false); newButton.setMnemonic('n'); newButton.setToolTipText("New From Blast"); newButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/filenew.png"); // System.out.println(icon); newButton.setIcon(new ImageIcon(icon)); openButton = new JButton(); openButton.setBorderPainted(false); openButton.setMnemonic('o'); openButton.setToolTipText("Open"); openButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/fileopen.png"); openButton.setIcon(new ImageIcon(icon)); saveButton = new JButton(); saveButton.setBorderPainted(false); saveButton.setMnemonic('s'); saveButton.setToolTipText("Save"); saveButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/filesave.png"); saveButton.setIcon(new ImageIcon(icon)); saveCurImgButton = new JButton(); saveCurImgButton.setBorderPainted(false); saveCurImgButton.setToolTipText("Save current image"); saveCurImgButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/saveimage.png"); saveCurImgButton.setIcon(new ImageIcon(icon)); printButton = new JButton(); printButton.setBorderPainted(false); printButton.setToolTipText("Print..."); printButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/fileprint.png"); printButton.setIcon(new ImageIcon(icon)); fileToolBar.add(newButton); fileToolBar.add(openButton); fileToolBar.add(saveButton); fileToolBar.add(saveCurImgButton); fileToolBar.add(printButton); // graph control toolbar graphToolBar = new JToolBar(); graphToolBar.setRollover(true); previousButton = new JButton(); previousButton.setBorderPainted(false); previousButton.setToolTipText("Previous graph"); previousButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/previous.png"); previousButton.setIcon(new ImageIcon(icon)); indexField = new JTextField(); indexField.setSize(new Dimension(25, 16)); indexField.setMinimumSize(new Dimension(25, 16)); indexField.setPreferredSize(new Dimension(25, 16)); indexField.addKeyListener(keyListener); nextButton = new JButton(); nextButton.setBorderPainted(false); nextButton.setToolTipText("Next graph"); nextButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/next.png"); nextButton.setIcon(new ImageIcon(icon)); filterButton = new JButton(); filterButton.setBorderPainted(false); filterButton.setToolTipText("Filt graph"); filterButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/filter.png"); filterButton.setIcon(new ImageIcon(icon)); resortButton = new JButton(); resortButton.setBorderPainted(false); resortButton.setToolTipText("Resort graph"); resortButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/resort.png"); resortButton.setIcon(new ImageIcon(icon)); searchField = new JTextField(); searchField.setSize(new Dimension(60, 16)); searchField.setMinimumSize(new Dimension(60, 16)); searchField.setPreferredSize(new Dimension(60, 16)); searchField.addKeyListener(keyListener); searchButton = new JButton(); searchButton.setBorderPainted(false); searchButton.setToolTipText("Search"); searchButton.addActionListener(commandActionListener); icon = getClass().getResource("/org/bigwiv/blastgraph/icons/search.png"); searchButton.setIcon(new ImageIcon(icon)); graphToolBar.add(filterButton); graphToolBar.add(resortButton); // graphToolBar.add(new JToolBar.Separator()); graphToolBar.add(previousButton); graphToolBar.add(indexField); graphToolBar.add(nextButton); graphToolBar.add(searchField); graphToolBar.add(searchButton); // view toolbar (modebox & layoutbox) viewToolBar = new JToolBar(); viewToolBar.setRollover(true); modeBox = graphMouse.getModeComboBox(); modeBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { int index = modeBox.getSelectedIndex(); if (index == 2) { int annotCount = annotationToolBar.getComponentCount(); for (int i = 0; i < annotCount; i++) { annotationToolBar.getComponent(i).setEnabled(true); } } else { int annotCount = annotationToolBar.getComponentCount(); for (int i = 0; i < annotCount; i++) { annotationToolBar.getComponent(i).setEnabled(false); } } } }); layoutBox = this.getLayoutComboBox(); viewToolBar.add(modeBox); viewToolBar.add(layoutBox); colorComboBox = new JComboBox(new String[] { "vertex color", "index", "strand", "genomeAcc", "organism" }); viewToolBar.add(colorComboBox); // add additional menu to graphMenu modeMenu = graphMouse.getModeMenu(); modeMenu.setText("Mode"); layoutMenu = getLayoutMenu(); layoutMenu.setText("Layout"); graphMenu.add(modeMenu); graphMenu.add(layoutMenu); // annotation toolbar AnnotationControls<HitVertex, ValueEdge> annotationControls = new AnnotationControls<HitVertex, ValueEdge>( annotatingPlugin); annotationToolBar = annotationControls.getAnnotationsToolBar(); ((JButton) annotationToolBar.getComponent(1)).setBorderPainted(false); ((JToggleButton) annotationToolBar.getComponent(2)).setBorderPainted(false); // add toolbars to toolBarPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new ModifiedFlowLayout(ModifiedFlowLayout.LEFT, 0, 0)); toolBarPanel.setBorder(new EtchedBorder()); toolBarPanel.add(fileToolBar); toolBarPanel.add(graphToolBar); toolBarPanel.add(viewToolBar); toolBarPanel.add(annotationToolBar); mainPanel.add(toolBarPanel, BorderLayout.NORTH); mainPanel.add(hsplitPane, BorderLayout.CENTER); // GridBagManager.add(mainPanel, toolBarPanel, 0, 0, 1, 1); // GridBagManager.add(mainPanel, hsplitPane, 0, 1, 1, 1); // mainPanel.add(toolBarPanel, BorderLayout.NORTH); // ===================vsplitPane Setting================= vsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); vsplitPane.setContinuousLayout(true); vsplitPane.setOneTouchExpandable(true); vsplitPane.setResizeWeight(0.9); hsplitPane.setLeftComponent(vsplitPane); // GridBagManager.GRID_BAG.weightx = 0.9; // GridBagManager.GRID_BAG.weighty = 1; // GridBagManager.add(mainPanel, vsplitPane, 0, 1, 1, 2); // mainPanel.add(vsplitPane, BorderLayout.CENTER); // ===================vvPanel Setting=================== vvPanel = new GraphZoomScrollPane(vv); vsplitPane.setTopComponent(vvPanel); // ===================Tab Panel Setting======================= // progressPanel = new ProgressPanel(); verticesTable = new VerticesTable(); verticesTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = verticesTable.rowAtPoint(e.getPoint()); int col = verticesTable.columnAtPoint(e.getPoint()); // System.out.println(row + " " + col); String value = verticesTable.getValueAt(row, col).toString(); // System.out.println(value); if (Global.graph.containsVertex(new HitVertex(value))) { for (int i = 0; i < subSetList.size(); i++) { if (subSetList.get(i).contains(new HitVertex(value))) { curGraph = FilterUtils.createInducedSubgraph(subSetList.get(i), Global.graph); PickedState<HitVertex> pickedVertexState = vv.getPickedVertexState(); // picked is a reference to picked vertices // use a temp set to avoid concurrent modification Set<HitVertex> picked = pickedVertexState.getPicked(); Set<HitVertex> temp = new HashSet<HitVertex>(); for (HitVertex hitVertex : picked) { temp.add(hitVertex); } for (HitVertex hv : temp) { pickedVertexState.pick(hv, false); } pickedVertexState.pick(new HitVertex(value), true); // refreshSubGraphView(); return; } } } } }); verticesTable.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { int row = verticesTable.rowAtPoint(e.getPoint()); int col = verticesTable.columnAtPoint(e.getPoint()); String value = verticesTable.getValueAt(row, col).toString(); // System.out.println(value); if (Global.graph.containsVertex(value)) { Cursor normalCursor = new Cursor(Cursor.HAND_CURSOR); setCursor(normalCursor); } else { Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR); setCursor(normalCursor); } } }); verticesPanel = new JPanel(); verticesPanel.setLayout(new GridLayout()); verticesPanel.add(new JScrollPane(verticesTable)); edgesTable = new EdgesTable(); edgesPanel = new JPanel(); edgesPanel.setLayout(new GridLayout()); edgesPanel.add(new JScrollPane(edgesTable)); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Vertices", verticesPanel); tabbedPane.addTab("Edges", edgesPanel); vsplitPane.setBottomComponent(tabbedPane); graphMouse.addPichedChangeListener(verticesTable, edgesTable); // ===================Info Panel Setting=================== infoPanel = new JPanel(new GridBagLayout()); GridBagManager.GRID_BAG.weightx = 0.1; GridBagManager.GRID_BAG.weighty = 1; hsplitPane.setRightComponent(infoPanel); JPanel mainInfoPanel = new JPanel(new GridBagLayout()); mainInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Main Info")); JPanel currentInfoPanel = new JPanel(new GridBagLayout()); currentInfoPanel.setBorder( BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Current Graph")); JPanel selectedInfoPanel = new JPanel(new GridBagLayout()); selectedInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Selected")); JPanel statisticsInfoPanel = new JPanel(new GridBagLayout()); statisticsInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Statistics")); JPanel progressInfoPanel = new JPanel(new GridBagLayout()); progressInfoPanel .setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Progress")); GridBagManager.GRID_BAG.anchor = GridBagConstraints.NORTH; GridBagManager.GRID_BAG.fill = GridBagConstraints.HORIZONTAL; GridBagManager.GRID_BAG.weighty = 0; GridBagManager.add(infoPanel, mainInfoPanel, 0, 1, 1, 1); GridBagManager.add(infoPanel, currentInfoPanel, 0, 2, 1, 1); GridBagManager.add(infoPanel, selectedInfoPanel, 0, 3, 1, 1); GridBagManager.GRID_BAG.weighty = 0.5; GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.add(infoPanel, statisticsInfoPanel, 0, 4, 1, 1); GridBagManager.add(infoPanel, progressInfoPanel, 0, 5, 1, 1); // mainInfoPanel { JLabel vertices = new JLabel("Vertices:"); vertexCountLabel = new JLabel("0"); JLabel edges = new JLabel("Edges:"); edgeCountLabel = new JLabel("0"); JLabel subGraphs = new JLabel("SubGraphs:"); subGraphCountLabel = new JLabel("0"); GridBagManager.GRID_BAG.anchor = GridBagConstraints.WEST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(mainInfoPanel, vertices, 0, 0, 1, 1); GridBagManager.add(mainInfoPanel, edges, 0, 1, 1, 1); GridBagManager.add(mainInfoPanel, subGraphs, 0, 2, 1, 1); GridBagManager.GRID_BAG.anchor = GridBagConstraints.EAST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(mainInfoPanel, vertexCountLabel, 1, 0, 1, 1); GridBagManager.add(mainInfoPanel, edgeCountLabel, 1, 1, 1, 1); GridBagManager.add(mainInfoPanel, subGraphCountLabel, 1, 2, 1, 1); } // end of mainInfoPanel // currentInfoPanel { JLabel vertices = new JLabel("Vertices:"); currentVertexCountLabel = new JLabel("0"); JLabel edges = new JLabel("Edges:"); currentEdgeCountLabel = new JLabel("0"); JLabel acc = new JLabel("ACC:"); currentAccLabel = new JLabel("0"); GridBagManager.GRID_BAG.anchor = GridBagConstraints.WEST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(currentInfoPanel, vertices, 0, 0, 1, 1); GridBagManager.add(currentInfoPanel, edges, 0, 1, 1, 1); GridBagManager.add(currentInfoPanel, acc, 0, 2, 1, 1); GridBagManager.GRID_BAG.anchor = GridBagConstraints.EAST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(currentInfoPanel, currentVertexCountLabel, 1, 0, 1, 1); GridBagManager.add(currentInfoPanel, currentEdgeCountLabel, 1, 1, 1, 1); GridBagManager.add(currentInfoPanel, currentAccLabel, 1, 2, 1, 1); } // end of currentInfoPanel // selectedInfoPanel { JLabel vertices = new JLabel("Vertices:"); selectedVertexCountLabel = new JLabel("0"); JLabel edges = new JLabel("Edges:"); selectedEdgeCountLabel = new JLabel("0"); GridBagManager.GRID_BAG.anchor = GridBagConstraints.WEST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(selectedInfoPanel, vertices, 0, 0, 1, 1); GridBagManager.add(selectedInfoPanel, edges, 0, 1, 1, 1); GridBagManager.GRID_BAG.anchor = GridBagConstraints.EAST; GridBagManager.GRID_BAG.weightx = 0.5; GridBagManager.add(selectedInfoPanel, selectedVertexCountLabel, 1, 0, 1, 1); GridBagManager.add(selectedInfoPanel, selectedEdgeCountLabel, 1, 1, 1, 1); CollectionChangeListener<HitVertex> svListener = new CollectionChangeListener<HitVertex>() { @Override public void onCollectionChange(Set<HitVertex> set) { selectedVertexCountLabel.setText("" + set.size()); } }; CollectionChangeListener<ValueEdge> veListener = new CollectionChangeListener<ValueEdge>() { @Override public void onCollectionChange(Set<ValueEdge> set) { selectedEdgeCountLabel.setText("" + set.size()); } }; graphMouse.addPichedChangeListener(svListener, veListener); } // end of selectedInfoPanel {// statistics Panel GridBagManager.GRID_BAG.anchor = GridBagConstraints.NORTH; GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.add(statisticsInfoPanel, graphStatisticsPanel, 0, 0, 1, 1); } // statistics Panel {// progressInfoPanel GridBagManager.GRID_BAG.anchor = GridBagConstraints.NORTH; GridBagManager.GRID_BAG.fill = GridBagConstraints.BOTH; GridBagManager.add(progressInfoPanel, progressPanel, 0, 0, 1, 1); } // progressInfoPanel // set frame size Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); setSize((screen.width * 3) / 4, (screen.height * 9) / 10); setLocation(screen.width / 6, screen.height / 16); refreshUI(false); }
From source file:savant.view.swing.GraphPane.java
public void resetCursor() { setCursor(new Cursor(Cursor.HAND_CURSOR)); }
From source file:edu.harvard.i2b2.previousquery.QueryPreviousRunsPanel.java
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equalsIgnoreCase("Rename ...")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); QueryMasterData ndata = (QueryMasterData) node.getUserObject(); Object inputValue = JOptionPane.showInputDialog(this, "Rename this query to: ", "Rename Query Dialog", JOptionPane.PLAIN_MESSAGE, null, null, ndata.name().substring(0, ndata.name().lastIndexOf("[") - 1)); if (inputValue != null) { String newQueryName = (String) inputValue; String requestXml = ndata.writeRenameQueryXML(newQueryName); lastRequestMessage = requestXml; setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = QueryListNamesClient.sendQueryRequestREST(requestXml); if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); }// w w w. ja v a 2 s . c o m }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } lastResponseMessage = response; if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { ndata.name(newQueryName + " [" + ndata.userId() + "]"); node.setUserObject(ndata); //DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } else if (e.getActionCommand().equalsIgnoreCase("Delete")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); QueryMasterData ndata = (QueryMasterData) node.getUserObject(); Object selectedValue = JOptionPane.showConfirmDialog(this, "Delete Query \"" + ndata.name() + "\"?", "Delete Query Dialog", JOptionPane.YES_NO_OPTION); if (selectedValue.equals(JOptionPane.YES_OPTION)) { System.out.println("delete " + ndata.name()); String requestXml = ndata.writeDeleteQueryXML(); lastRequestMessage = requestXml; //System.out.println(requestXml); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = QueryListNamesClient.sendQueryRequestREST(requestXml); if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } lastResponseMessage = response; if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { treeModel.removeNodeFromParent(node); //jTree1.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } else if (e.getActionCommand().equalsIgnoreCase("Refresh All")) { String status = loadPreviousQueries(false); if (status.equalsIgnoreCase("")) { reset(200, false); } else if (status.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); } } }
From source file:com._17od.upm.gui.DatabaseActions.java
public boolean syncWithRemoteDatabase() throws TransportException, ProblemReadingDatabaseFile, IOException, CryptoException, PasswordDatabaseException { boolean syncSuccessful = false; try {/*from w w w . j ava 2s . co m*/ fileMonitor.pause(); mainWindow.getContentPane().setCursor(new Cursor(Cursor.WAIT_CURSOR)); // Get the remote database options String remoteLocation = database.getDbOptions().getRemoteLocation(); String authDBEntry = database.getDbOptions().getAuthDBEntry(); String httpUsername = null; String httpPassword = null; if (!authDBEntry.equals("")) { httpUsername = database.getAccount(authDBEntry).getUserId(); httpPassword = database.getAccount(authDBEntry).getPassword(); } // Download the database that's already at the remote location Transport transport = Transport.getTransportForURL(new URL(remoteLocation)); File remoteDatabaseFile = transport.getRemoteFile(remoteLocation, database.getDatabaseFile().getName(), httpUsername, httpPassword); // Attempt to decrypt the database using the password the user entered PasswordDatabase remoteDatabase = null; char[] password = null; boolean successfullyDecryptedDb = false; try { remoteDatabase = dbPers.load(remoteDatabaseFile); successfullyDecryptedDb = true; } catch (InvalidPasswordException e) { // The password for the downloaded database is different to that of the open database // (most likely the user changed the local database's master password) boolean okClicked = false; do { password = askUserForPassword(Translator.translate("enterPaswordForRemoteDB")); if (password == null) { okClicked = false; } else { okClicked = true; try { remoteDatabase = dbPers.load(remoteDatabaseFile, password); successfullyDecryptedDb = true; } catch (InvalidPasswordException invalidPassword) { JOptionPane.showMessageDialog(mainWindow, Translator.translate("incorrectPassword")); } } } while (okClicked && !successfullyDecryptedDb); } /* If the local database revision > remote database version => upload local database If the local database revision < remote database version => replace local database with remote database If the local database revision = remote database version => do nothing */ if (successfullyDecryptedDb) { if (database.getRevision() > remoteDatabase.getRevision()) { transport.delete(remoteLocation, database.getDatabaseFile().getName(), httpUsername, httpPassword); transport.put(remoteLocation, database.getDatabaseFile(), httpUsername, httpPassword); syncSuccessful = true; } else if (database.getRevision() < remoteDatabase.getRevision()) { Util.copyFile(remoteDatabaseFile, database.getDatabaseFile()); database = new PasswordDatabase(remoteDatabase.getRevisionObj(), remoteDatabase.getDbOptions(), remoteDatabase.getAccountsHash(), database.getDatabaseFile()); doOpenDatabaseActions(); syncSuccessful = true; } else { syncSuccessful = true; } if (syncSuccessful) { setLocalDatabaseDirty(false); // Create a thread that will mark the database dirty after // a short period. Without this the database would remain // in a synced state until the user makes a change. The // longer we wait before syncing up the greater chance there // is that we'll miss changes made elsewhere and end up // with a conflicting version of the database. final long dirtyThreadStartTime = System.currentTimeMillis(); runSetDBDirtyThread = true; Thread setDBDirtyThread = new Thread(new Runnable() { public void run() { while (runSetDBDirtyThread) { try { Thread.sleep(1000); } catch (InterruptedException e1) { } long currentTime = System.currentTimeMillis(); if (currentTime - dirtyThreadStartTime > 5 * 60 * 1000) { LOG.info("SetDBDirtyThread setting database dirty"); setLocalDatabaseDirty(true); runSetDBDirtyThread = false; } } } }); setDBDirtyThread.setName("SetDBDirty"); setDBDirtyThread.start(); LOG.info("Started SetDBDirtyThread thread"); } } } finally { mainWindow.getContentPane().setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); fileMonitor.start(); } return syncSuccessful; }
From source file:gtu._work.etc.EnglishTester.java
private void initGUI() { try {/* w w w. j a v a 2s .c om*/ JCommonUtil.defaultToolTipDelay(); BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.setPreferredSize(new java.awt.Dimension(462, 259)); jTabbedPane1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { // XXX // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx jTabbedPane1.requestFocus();// FOCUS TODO // XXX // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx } }); jTabbedPane1.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { System.out.println("2===" + evt.getKeyCode()); if (evt.getKeyCode() == 49) {// 0 jTabbedPane1.setSelectedIndex(0); } if (evt.getKeyCode() == 50) {// 1 jTabbedPane1.setSelectedIndex(1); } if (evt.getKeyCode() == 10) {// enter skipBtnAction(); } if (evt.getKeyCode() == 32) {// removeBtnAction(); } } }); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("english", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(420, 141)); { englishArea = new JTextArea(); jScrollPane1.setViewportView(englishArea); englishArea.setFont(new java.awt.Font("Microsoft JhengHei", 0, 22)); } } { jPanel5 = new JPanel(); jPanel1.add(jPanel5, BorderLayout.SOUTH); jPanel5.setPreferredSize(new java.awt.Dimension(402, 65)); { skipBtn = new JButton(); jPanel5.add(skipBtn); skipBtn.setText("skip"); skipBtn.setPreferredSize(new java.awt.Dimension(187, 24)); skipBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { skipBtnAction(); } }); } { removeBtn = new JButton(); jPanel5.add(removeBtn); removeBtn.setText("remove"); removeBtn.setPreferredSize(new java.awt.Dimension(180, 24)); removeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { removeBtnAction(); } }); } { questionCountLabel = new JLabel(); jPanel5.add(questionCountLabel); questionCountLabel.setPreferredSize(new java.awt.Dimension(47, 21)); questionCountLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); questionCountLabel.setToolTipText(""); } { propCountLabel = new JLabel(); jPanel5.add(propCountLabel); propCountLabel.setPreferredSize(new java.awt.Dimension(45, 21)); propCountLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); propCountLabel.setToolTipText(""); } { googleSearchBtn = new JButton(); jPanel5.add(googleSearchBtn); googleSearchBtn.setText("<html>GPic</html>"); googleSearchBtn.setPreferredSize(new java.awt.Dimension(58, 24)); googleSearchBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { String word = currentWordIndex.trim(); ClipboardUtil.getInstance().setContents(word); word = word.replace(" ", "%20"); URI uri = new URI( "https://www.google.com.tw/search?num=10&hl=zh-TW&site=imghp&tbm=isch&source=hp&biw=1280&bih=696&q=" + word); //URI uri = new URI("http://image.baidu.com/search/index?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=" + word); Desktop.getDesktop().browse(uri); } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); } { yahooDicBtn = new JButton(); jPanel5.add(yahooDicBtn); yahooDicBtn.setText("<html>Dict</html>"); yahooDicBtn.setPreferredSize(new java.awt.Dimension(57, 24)); yahooDicBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { // URI uri = new // URI("http://tw.dictionary.yahoo.com/dictionary?p=" // + currentWord.trim()); URI uri = new URI("http://www.dreye.com/axis/ddict.jsp?ver=big5&dod=0102&w=" + currentWordIndex.trim() + "&x=0&y=0"); Desktop.getDesktop().browse(uri); } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); } { pickBtn = new JButton(); jPanel5.add(pickBtn); pickBtn.setText("<html>+Pick</html>"); pickBtn.setPreferredSize(new java.awt.Dimension(60, 24)); pickBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { String key = currentWordIndex; String value = englishProp.getProperty(currentWordIndex); if (StringUtils.isEmpty(value)) { JCommonUtil._jOptionPane_showMessageDialog_error( "add pick failed : no such word => " + key); } else { pickProp.setProperty(key, value); JCommonUtil._jOptionPane_showMessageDialog_info( "key=" + key + "\nvalue=" + value + "\nsize=" + pickProp.size(), "??"); } } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); } { scanPicBtn = new JButton(); scanPicBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); jPanel5.add(scanPicBtn); scanPicBtn.setPreferredSize(new java.awt.Dimension(46, 24)); scanPicBtn.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (picDir == null) { JCommonUtil._jOptionPane_showMessageDialog_error("picDir is null"); return; } if (picSet != null && picSet.size() > 0) { try { Desktop.getDesktop().open(picSet.iterator().next()); } catch (IOException e) { JCommonUtil.handleException(e); } return; } try { String text = currentWordIndex.trim().toLowerCase(); ClipboardUtil.getInstance().setContents(text); text = text.replace(" ", "%20"); URI uri = new URI( "https://www.google.com.tw/search?num=10&hl=zh-TW&site=imghp&tbm=isch&source=hp&biw=1280&bih=696&q=" + text); //URI uri = new URI("http://image.baidu.com/search/index?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=" + text); Desktop.getDesktop().browse(uri); } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); } { showChineseOption = new JCheckBox(); showChineseOption.setSelected(true); jPanel5.add(showChineseOption); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("chinese", null, jPanel2, null); jPanel2.setPreferredSize(new java.awt.Dimension(420, 211)); { showEnglishText = new JTextField(); jPanel2.add(showEnglishText, BorderLayout.NORTH); showEnglishText.setEditable(false); } { jPanel10 = new JPanel(); jPanel2.add(jPanel10, BorderLayout.CENTER); } { answerBtn[0] = new JButton(); jPanel10.add(answerBtn[0]); answerBtn[0].setPreferredSize(new java.awt.Dimension(190, 110)); answerBtn[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { answerBtnClick(answerBtn[0]); } }); } { answerBtn[1] = new JButton(); jPanel10.add(answerBtn[1]); answerBtn[1].setPreferredSize(new java.awt.Dimension(190, 110)); answerBtn[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { answerBtnClick(answerBtn[1]); } }); } { answerBtn[2] = new JButton(); jPanel10.add(answerBtn[2]); answerBtn[2].setPreferredSize(new java.awt.Dimension(190, 110)); answerBtn[2].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { answerBtnClick(answerBtn[2]); } }); } { answerBtn[3] = new JButton(); jPanel10.add(answerBtn[3]); answerBtn[3].setPreferredSize(new java.awt.Dimension(190, 110)); answerBtn[3].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { answerBtnClick(answerBtn[3]); } }); } { for (int ii = 0; ii < 4; ii++) { answerBtn[ii].setFont(new java.awt.Font("", 0, 14)); } } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("word", null, jPanel3, null); { jScrollPane3 = new JScrollPane(); jPanel3.add(jScrollPane3, BorderLayout.CENTER); jScrollPane3.setPreferredSize(new java.awt.Dimension(420, 187)); { propTable = new JTable(); jScrollPane3.setViewportView(propTable); JTableUtil.defaultSetting(propTable); propTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JPopupMenuUtil.newInstance(propTable) .addJMenuItem(JTableUtil.newInstance(propTable).getDefaultJMenuItems()) .applyEvent(evt).show(); } }); } } { saveBtn = new JButton(); jPanel3.add(saveBtn, BorderLayout.SOUTH); saveBtn.setText("save table"); saveBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { DefaultTableModel model = JTableUtil.newInstance(propTable).getModel(); for (int ii = 0; ii < model.getRowCount(); ii++) { String key = (String) model.getValueAt(ii, 0); String value = (String) model.getValueAt(ii, 1); if (!englishProp.containsKey(key)) { englishProp.setProperty(key, value); } } try { englishProp.store(new FileOutputStream(englishFile), "comment"); } catch (Exception e) { e.printStackTrace(); } JCommonUtil._jOptionPane_showMessageDialog_info("save file ok! \n" + englishFile); } }); } { queryText = new JTextField(); jPanel3.add(queryText, BorderLayout.NORTH); queryText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { @Override public void process(DocumentEvent event) { String text = JCommonUtil.getDocumentText(event); Pattern pattern = Pattern.compile(text); Matcher matcher = null; DefaultTableModel propTableModel = JTableUtil.createModel(false, "english", "chinese"); for (Enumeration<?> enu = englishProp.propertyNames(); enu .hasMoreElements();) { String key = (String) enu.nextElement(); String value = englishProp.getProperty(key); if (key.contains(text)) { propTableModel.addRow(new Object[] { key, value }); continue; } matcher = pattern.matcher(key); if (matcher.find()) { propTableModel.addRow(new Object[] { key, value }); continue; } } propTable.setModel(propTableModel); } })); } } { jPanel4 = new JPanel(); jTabbedPane1.addTab("config", null, jPanel4, null); { savePickBtn = new JButton(); jPanel4.add(savePickBtn); savePickBtn.setText("save pick"); savePickBtn.setPreferredSize(new java.awt.Dimension(116, 40)); savePickBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (englishFile == null) { File file = new File(// PropertiesUtil.getJarCurrentPath(EnglishTester.class), "temp.properties"); englishFile = file; } if (pickProp.isEmpty()) { JCommonUtil._jOptionPane_showMessageDialog_error("?!"); return; } String fileName = englishFile.getName().replaceAll("\\.properties", "_bak.properties"); File jarWhereFile = PropertiesUtil.getJarCurrentPath(EnglishTester.class); fileName = JCommonUtil._jOptionPane_showInputDialog("save target properties", fileName); if (StringUtils.isEmpty(fileName)) { JCommonUtil._jOptionPane_showMessageDialog_error("can't save!"); return; } if (fileName.equalsIgnoreCase(englishFile.getName())) { JCommonUtil._jOptionPane_showMessageDialog_error( "??englishFile???"); return; } if (!fileName.endsWith(".properties")) { fileName += ".properties"; } File newFile = new File(jarWhereFile, fileName); Properties oldProp = new Properties(); if (newFile.exists()) { try { oldProp.load(new FileInputStream(newFile)); } catch (Exception e) { e.printStackTrace(); } } oldProp.putAll(pickProp); try { oldProp.store(new FileOutputStream(newFile), "comment"); } catch (Exception e) { e.printStackTrace(); } JCommonUtil._jOptionPane_showMessageDialog_info("save file ok! \n" + newFile); } }); } { saveConfigBtn2 = new JButton(); jPanel4.add(saveConfigBtn2); saveConfigBtn2.setText("save config"); saveConfigBtn2.setPreferredSize(new java.awt.Dimension(108, 40)); saveConfigBtn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveConfigBtnAction(); } }); } { startAllBtn = new JButton(); jPanel4.add(startAllBtn); startAllBtn.setText("start all"); startAllBtn.setPreferredSize(new java.awt.Dimension(101, 40)); startAllBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Object[] files = fileList.getSelectedValues(); if (files == null || files.length == 0) { JCommonUtil ._jOptionPane_showMessageDialog_error("?properties"); return; } Properties allProp = new Properties(); Properties prop = new Properties(); for (Object ff : files) { try { prop.load(new FileInputStream((File) ff)); } catch (Exception e) { JCommonUtil.handleException(e); } allProp.putAll(prop); } englishProp = allProp; System.out.println("englishProp = " + englishProp.size()); startNow(); } }); } { startNow = new JButton(); jPanel4.add(startNow); startNow.setText("start now"); startNow.setPreferredSize(new java.awt.Dimension(101, 40)); startNow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startNow(); } }); } { picOnly = new JCheckBox(); jPanel4.add(picOnly); picOnly.setText("picOnly"); } { sortChkBox = new JCheckBox(); jPanel4.add(sortChkBox); sortChkBox.setText("sort"); } { showPicChkBox = new JCheckBox(); showPicChkBox.setSelected(true); jPanel4.add(showPicChkBox); showPicChkBox.setText("showPic"); } { JCommonUtil.defaultToolTipDelay(); fontSizeSliber = new JSlider(JSlider.HORIZONTAL); jPanel4.add(fontSizeSliber); fontSizeSliber.setPreferredSize(new java.awt.Dimension(419, 35)); fontSizeSliber.setValue(22); fontSizeSliber.setMinimum(22); fontSizeSliber.setMaximum(300); fontSizeSliber.setMajorTickSpacing(30); fontSizeSliber.setMinorTickSpacing(5); fontSizeSliber.setCursor(new Cursor(Cursor.HAND_CURSOR)); fontSizeSliber.setPaintTicks(false); fontSizeSliber.setPaintLabels(true); { picFolderDirText = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(picFolderDirText, true); jPanel4.add(picFolderDirText); picFolderDirText.setColumns(20); } fontSizeSliber.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int size = fontSizeSliber.getValue(); fontSizeSliber.setToolTipText("" + size); englishArea.setFont(new java.awt.Font("Microsoft JhengHei", 0, size)); } }); } } { jPanel6 = new JPanel(); jTabbedPane1.addTab("files", null, jPanel6, null); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); { jScrollPane4 = new JScrollPane(); jPanel6.add(jScrollPane4, BorderLayout.CENTER); jScrollPane4.setPreferredSize(new java.awt.Dimension(420, 211)); { fileList = new JList(); reloadFileList(); jScrollPane4.setViewportView(fileList); fileList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { final File file = JListUtil.getLeadSelectionObject(fileList); if (JMouseEventUtil.buttonRightClick(1, evt)) { JPopupMenuUtil.newInstance(EnglishTester.this.fileList).applyEvent(evt)// .addJMenuItem("reload", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reloadFileList(); } })// .addJMenuItem("delete : " + file.getName(), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean result = JCommonUtil ._JOptionPane_showConfirmDialog_yesNoOption( "delete : " + file.getName() + " ?", "confirm"); if (result) { file.delete(); reloadFileList(); } }// }).show(); return; } if (evt.getClickCount() == 1) { return; } if (JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption( "?,?\n" + file.getName(), "")) { loadEnglishFile(file); } } }); fileList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(fileList).defaultJListKeyPressed(evt); } }); } } } { jPanel9 = new JPanel(); jTabbedPane1.addTab("pic", null, jPanel9, null); { picCheckText = new JTextField(); jPanel9.add(picCheckText); picCheckText.setPreferredSize(new java.awt.Dimension(177, 39)); } { picCheckBtn = new JButton(); jPanel9.add(picCheckBtn); picCheckBtn.setText("check"); picCheckBtn.setPreferredSize(new java.awt.Dimension(98, 43)); { jPanel11 = new JPanel(); jTabbedPane1.addTab("", null, jPanel11, null); jPanel11.setLayout(new BorderLayout(0, 0)); { inputTestArea2 = new JTextArea(); inputTestArea2.setFont(new Font("", Font.PLAIN, 12)); inputTestArea2.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { inputTestTrainer.keyin(e); } }); jPanel11.add(inputTestArea2, BorderLayout.SOUTH); } { inputTestArea1 = new JTextArea(); JTextAreaUtil.setWrapTextArea(inputTestArea1); inputTestArea1.setFont(new Font("", Font.PLAIN, 22)); jPanel11.add(inputTestArea1, BorderLayout.CENTER); } { panel = new JPanel(); jPanel11.add(panel, BorderLayout.NORTH); { inputTestLabel = new JLabel(""); panel.add(inputTestLabel); } { inputTestChk = new JCheckBox(""); inputTestChk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { inputTestTrainer.initQuestion(); } }); panel.add(inputTestChk); } } } picCheckBtn.addActionListener(new ActionListener() { void scanPic(String searchWord, File file, Set<File> findFile) { if (file.isDirectory()) { File[] list = null; if ((list = file.listFiles()) != null) { for (File f : list) { scanPic(searchWord, f, findFile); } } } else { String text = searchWord; String name = file.getName().toLowerCase(); if (isMatch(name, text)) { findFile.add(file); } } } public void actionPerformed(ActionEvent evt) { picDir = new File(picFolderDirText.getText()); if (picDir == null) { JCommonUtil._jOptionPane_showMessageDialog_error("picDir is null"); return; } if (!picDir.exists() || !picDir.isDirectory()) { JCommonUtil._jOptionPane_showMessageDialog_error("picDir "); return; } picCheckBtn.setText("search.."); String searchWord = picCheckText.getText().toLowerCase().trim(); Set<File> picSet2 = new HashSet<File>(); scanPic(searchWord, picDir, picSet2); if (picSet2 != null && picSet2.size() > 0) { picCheckBtn.setText("" + picSet2.size()); try { Desktop.getDesktop().open(picSet2.iterator().next()); } catch (IOException e) { JCommonUtil.handleException(e); } } else { picCheckBtn.setText("0"); } } }); } } } JCommonUtil.setJFrameIcon(this, "resource/images/ico/english_tester.ico"); pack(); this.setSize(423, 314); configHelper.init(); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } }
From source file:com.josescalia.tumblr.form.TumblrImageViewer.java
private void btnAddToCollectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddToCollectionActionPerformed frame = (MainFrame) this.getTopLevelAncestor(); form = this;/*from www . j a va 2s. c o m*/ if (validateUrl()) { final Rss rss = constructNewObject(); if (rss != null) { //set Progressbar and cursor form.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.startProgressBar("Saving"); new SwingWorker<Boolean, Boolean>() { @Override protected Boolean doInBackground() throws Exception { try { rssService.save(rss); return Boolean.TRUE; } catch (Exception e) { UIAlert.showError(null, UIMessageConstants.saveFailedMsg + "\n" + e.getMessage()); } return Boolean.FALSE; } protected void done() { try { if (get()) { UIAlert.showInformation(null, UIMessageConstants.saveSucceedMsg); } else { UIAlert.showInformation(null, UIMessageConstants.saveFailedMsg); } } catch (InterruptedException e) { logger.error(e); } catch (ExecutionException e) { logger.error(e); } form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.stopProgressBar(""); } }.execute(); } } }
From source file:convcao.com.agent.ConvcaoNeptusInteraction.java
@Override public void initSubPanel() { jPanelMain = new JPanel(); jPanel1 = new JPanel(); jPanel2 = new JPanel(); jLabel2 = new JLabel(); jScrollPane1 = new JScrollPane(); jTextPane1 = new JTextPane(); renewButton = new JButton(); jLabel4 = new JLabel(); jTextField1 = new JTextField(); jLabel5 = new JLabel(); jPasswordField1 = new JPasswordField(); connectButton = new JButton(); jScrollPane2 = new JScrollPane(); jTextArea1 = new JTextArea(); jLabel7 = new JLabel(); jLabel8 = new JLabel(); jButton1 = new JButton(); jButton2 = new JButton(); jLabel1 = new JLabel(); jLabel9 = new JLabel(); jLabel10 = new JLabel(); jLabel11 = new JLabel(); jLabel12 = new JLabel(); jLabel6 = new JLabel(); jLabel3 = new JLabel(); jLabel11.setIcon(noptilusLogo);// www .j a v a 2s. c o m jLabel12.setHorizontalAlignment(SwingConstants.LEFT); jLabel12.setText("<html>www.convcao.com<br>version 0.01</html>"); jLabel12.setToolTipText(""); jLabel12.setHorizontalTextPosition(SwingConstants.RIGHT); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel11, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGap(0, 19, Short.MAX_VALUE).addComponent(jLabel12, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel11, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel12, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); jLabel2.setFont(new Font("Tahoma", 0, 10)); // NOI18N jLabel2.setText("Unique ID"); jTextPane1.setEditable(true); jScrollPane1.setViewportView(jTextPane1); //jTextPane1.getAccessibleContext().setAccessibleName(""); renewButton.setText("RENEW"); renewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { renewButtonActionPerformed(evt); } }); jLabel4.setFont(new Font("Tahoma", 0, 12)); // NOI18N jLabel4.setText("Username"); jTextField1.setText("FTPUser"); jLabel5.setFont(new Font("Tahoma", 0, 12)); // NOI18N jLabel5.setText("Password"); jPasswordField1.setText("FTPUser123"); connectButton.setText("Connect"); connectButton.setEnabled(false); connectButton.setActionCommand("connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { connectButtonActionPerformed(evt); } catch (FileNotFoundException | UnsupportedEncodingException e) { e.printStackTrace(); } catch (SocketException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); jTextArea1.setEditable(false); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane2.setViewportView(jTextArea1); jLabel7.setFont(new Font("Tahoma", 0, 12)); // NOI18N jLabel7.setText("Command Monitor"); jButton1.setFont(new Font("Tahoma", 1, 12)); // NOI18N jButton1.setText("START"); jButton1.setEnabled(false); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startButtonActionPerformed(evt); } }); jButton2.setFont(new Font("Tahoma", 1, 12)); // NOI18N jButton2.setText("STOP"); jButton2.setEnabled(false); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stopButtonActionPerformed(evt); } }); jLabel1.setForeground(new Color(255, 0, 0)); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText( "<html>Click HERE to activate the web service using your ID<br>When the web application is ready, press Start </html>"); jLabel1.setCursor(new Cursor(Cursor.HAND_CURSOR)); jLabel1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { try { jLabel1MouseClicked(evt); } catch (URISyntaxException | IOException e) { e.printStackTrace(); } } }); //jLabel9.setText("Working..."); jLabel9.setIcon(runIcon); jLabel9.setVisible(false); jLabel10.setText("---"); jLabel6.setForeground(new Color(0, 204, 0)); jLabel6.setHorizontalAlignment(SwingConstants.CENTER); jLabel6.setText("---"); GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(126, 126, 126) .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup().addGap(23, 23, 23) .addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jLabel9, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addGap(29, 29, 29) .addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane2, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 308, GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel10, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 299, GroupLayout.PREFERRED_SIZE)))) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(renewButton)) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel4, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel5, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jPasswordField1))) .addGap(14, 14, 14).addComponent(connectButton))))) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(renewButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1) .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPasswordField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(connectButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(jButton2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel10, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE) .addGap(5, 5, 5))); jLabel1.getAccessibleContext().setAccessibleName("jLabel1"); jLabel3.setFont(new Font("Tahoma", 1, 22)); // NOI18N jLabel3.setText("Real Time Navigation"); jLabel8.setIcon(appLogo); GroupLayout layout = new GroupLayout(jPanelMain); jPanelMain.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel3) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, 331, GroupLayout.PREFERRED_SIZE) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addComponent(jLabel3) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); addMenuItem("Settings>Noptilus>Coordinate Settings", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginUtils.editPluginProperties(coords, true); coords.saveProps(); } }); addMenuItem("Settings>Noptilus>ConvCAO Settings", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginUtils.editPluginProperties(ConvcaoNeptusInteraction.this, true); } }); addMenuItem("Settings>Noptilus>Force vehicle depth", ImageUtils.getIcon(PluginUtils.getPluginIcon(getClass())), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (positions.isEmpty()) { GuiUtils.errorMessage(getConsole(), "Force vehicle depth", "ConvCAO control is not active"); return; } String[] choices = nameTable.values().toArray(new String[0]); String vehicle = (String) JOptionPane.showInputDialog(getConsole(), "Force vehicle depth", "Choose vehicle", JOptionPane.QUESTION_MESSAGE, null, choices, choices[0]); if (vehicle != null) { double depth = depths.get(vehicle); String newDepth = JOptionPane.showInputDialog(getConsole(), "New depth", "" + depth); try { double dd = Double.parseDouble(newDepth); depths.put(vehicle, dd); } catch (Exception ex) { GuiUtils.errorMessage(getConsole(), ex); } } } }); add(jPanelMain); renewButtonActionPerformed(null); }
From source file:savant.view.swing.GraphPane.java
/** * {@inheritDoc}/*from w ww . j av a 2 s . c om*/ */ @Override public void mouseExited(final MouseEvent event) { this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); setMouseModifier(event); mouseInside = false; GraphPaneController.getInstance().setMouseXPosition(-1); GraphPaneController.getInstance().setMouseYPosition(Double.NaN, false); }
From source file:org.jets3t.apps.cockpitlite.CockpitLite.java
/** * Starts a progress display dialog. While the dialog is running the user cannot interact * with the application, except to cancel the task. * * @param statusMessage//from w w w . j a v a2s . c o m * describes the status of a task text meaningful to the user, such as "3 files of 7 uploaded" * @param detailsText * describes the status of a task in more detail, such as the current transfer rate and Time remaining. * @param minTaskValue the minimum progress value for a task, generally 0 * @param maxTaskValue * the maximum progress value for a task, such as the total number of threads or 100 if * using percentage-complete as a metric. * @param cancelEventListener * listener that is responsible for cancelling a long-lived task when the user clicks * the cancel button. If a task cannot be cancelled this must be null. * @param cancelButtonText * text displayed in the cancel button if a task can be cancelled. This is only used if * a cancel event listener is provided. */ private void startProgressDialog(final String statusMessage, final String detailsText, final int minTaskValue, final int maxTaskValue, final String cancelButtonText, final CancelEventTrigger cancelEventListener) { if (this.progressDialog == null) { this.progressDialog = new ProgressDialog(this.ownerFrame, "Please wait...", cockpitLiteProperties.getProperties()); } this.getContentPane().setCursor(new Cursor(Cursor.WAIT_CURSOR)); SwingUtilities.invokeLater(new Runnable() { public void run() { progressDialog.startDialog(statusMessage, detailsText, minTaskValue, maxTaskValue, cancelEventListener, cancelButtonText); } }); }