List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:org.datacleaner.widgets.result.DateGapAnalyzerResultSwingRenderer.java
@Override public JComponent render(DateGapAnalyzerResult result) { final TaskSeriesCollection dataset = new TaskSeriesCollection(); final Set<String> groupNames = result.getGroupNames(); final TaskSeries completeDurationTaskSeries = new TaskSeries(LABEL_COMPLETE_DURATION); final TaskSeries gapsTaskSeries = new TaskSeries(LABEL_GAPS); final TaskSeries overlapsTaskSeries = new TaskSeries(LABEL_OVERLAPS); for (final String groupName : groupNames) { final String groupDisplayName; if (groupName == null) { if (groupNames.size() == 1) { groupDisplayName = "All"; } else { groupDisplayName = LabelUtils.NULL_LABEL; }/*from w ww . ja va2 s. c o m*/ } else { groupDisplayName = groupName; } final TimeInterval completeDuration = result.getCompleteDuration(groupName); final Task completeDurationTask = new Task(groupDisplayName, createTimePeriod(completeDuration.getFrom(), completeDuration.getTo())); completeDurationTaskSeries.add(completeDurationTask); // plot gaps { final SortedSet<TimeInterval> gaps = result.getGaps(groupName); int i = 1; Task rootTask = null; for (TimeInterval interval : gaps) { final TimePeriod timePeriod = createTimePeriod(interval.getFrom(), interval.getTo()); if (rootTask == null) { rootTask = new Task(groupDisplayName, timePeriod); gapsTaskSeries.add(rootTask); } else { Task task = new Task(groupDisplayName + " gap" + i, timePeriod); rootTask.addSubtask(task); } i++; } } // plot overlaps { final SortedSet<TimeInterval> overlaps = result.getOverlaps(groupName); int i = 1; Task rootTask = null; for (TimeInterval interval : overlaps) { final TimePeriod timePeriod = createTimePeriod(interval.getFrom(), interval.getTo()); if (rootTask == null) { rootTask = new Task(groupDisplayName, timePeriod); overlapsTaskSeries.add(rootTask); } else { Task task = new Task(groupDisplayName + " overlap" + i, timePeriod); rootTask.addSubtask(task); } i++; } } } dataset.add(overlapsTaskSeries); dataset.add(gapsTaskSeries); dataset.add(completeDurationTaskSeries); final SlidingGanttCategoryDataset slidingDataset = new SlidingGanttCategoryDataset(dataset, 0, GROUPS_VISIBLE); final JFreeChart chart = ChartFactory.createGanttChart( "Date gaps and overlaps in " + result.getFromColumnName() + " / " + result.getToColumnName(), result.getGroupColumnName(), "Time", slidingDataset, true, true, false); ChartUtils.applyStyles(chart); // make sure the 3 timeline types have correct coloring { final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDrawingSupplier(new DCDrawingSupplier(WidgetUtils.ADDITIONAL_COLOR_GREEN_BRIGHT, WidgetUtils.ADDITIONAL_COLOR_RED_BRIGHT, WidgetUtils.BG_COLOR_BLUE_BRIGHT)); } final int visibleLines = Math.min(GROUPS_VISIBLE, groupNames.size()); final ChartPanel chartPanel = ChartUtils.createPanel(chart, ChartUtils.WIDTH_WIDE, visibleLines * 50 + 200); chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseMoved(ChartMouseEvent event) { Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); ChartEntity entity = event.getEntity(); if (entity instanceof PlotEntity) { cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); } chartPanel.setCursor(cursor); } @Override public void chartMouseClicked(ChartMouseEvent event) { // do nothing } }); final JComponent decoratedChartPanel; final StringBuilder chartDescription = new StringBuilder("<html>"); chartDescription.append("<p>The chart displays the recorded timeline based on FROM and TO dates.</p>"); chartDescription.append( "<p>The <b>red items</b> represent gaps in the timeline and the <b>green items</b> represent points in the timeline where more than one record show activity.</p>"); chartDescription.append( "<p>You can <b>zoom in</b> by clicking and dragging the area that you want to examine in further detail.</p>"); if (groupNames.size() > GROUPS_VISIBLE) { final JScrollBar scroll = new JScrollBar(JScrollBar.VERTICAL); scroll.setMinimum(0); scroll.setMaximum(groupNames.size()); scroll.addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { int value = e.getAdjustable().getValue(); slidingDataset.setFirstCategoryIndex(value); } }); chartPanel.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { int scrollType = e.getScrollType(); if (scrollType == MouseWheelEvent.WHEEL_UNIT_SCROLL) { int wheelRotation = e.getWheelRotation(); scroll.setValue(scroll.getValue() + wheelRotation); } } }); final DCPanel outerPanel = new DCPanel(); outerPanel.setLayout(new BorderLayout()); outerPanel.add(chartPanel, BorderLayout.CENTER); outerPanel.add(scroll, BorderLayout.EAST); chartDescription.append("<p>Use the right <b>scrollbar</b> to scroll up and down on the chart.</p>"); decoratedChartPanel = outerPanel; } else { decoratedChartPanel = chartPanel; } chartDescription.append("</html>"); final JLabel chartDescriptionLabel = new JLabel(chartDescription.toString()); final DCPanel panel = new DCPanel(); panel.setLayout(new VerticalLayout()); panel.add(chartDescriptionLabel); panel.add(decoratedChartPanel); return panel; }
From source file:org.datacleaner.panels.WelcomePanel.java
private JComponent createContentPanel() { JComponent result = null;//w w w.j a v a 2s . c o m final String welcomePanelClassName = SystemProperties.getString(SystemProperties.UI_DESKTOP_WELCOME_PANEL, null); if (!Strings.isNullOrEmpty(welcomePanelClassName)) { final Injector injector = _dcModule.createInjectorBuilder().with(WelcomePanel.class, this) .createInjector(); try { @SuppressWarnings("unchecked") final Class<? extends JComponent> componentClass = (Class<? extends JComponent>) Class .forName(welcomePanelClassName); result = injector.getInstance(componentClass); } catch (Exception e) { logger.error("Failed to instantiate welcome panel class: {}", welcomePanelClassName, e); } } if (result == null) { result = new DCPanel(); if (Version.isCommunityEdition()) { final JXEditorPane editorPane = new JXEditorPane("text/html", "You're now using the <b>Community Edition</b> of DataCleaner.<br/><br/>" + "We hope that you enjoy this free product. We encourage you to also check out the " + "commercial DataCleaner editions which feature added functionality, " + "helpful getting started wizards and commercial support. " + "You can find more information about them online."); editorPane.setEditable(false); editorPane.setOpaque(false); editorPane.setFont(WidgetUtils.FONT_HEADER2); editorPane.setPreferredSize(new Dimension(DCSplashPanel.WIDTH_CONTENT, 120)); final JButton tryProfessionalButton = WidgetFactory.createDefaultButton("Try professional edition", IconUtils.APPLICATION_ICON); tryProfessionalButton .addActionListener(new OpenBrowserAction("http://datacleaner.org/get_datacleaner")); final JButton readMoreButton = WidgetFactory.createDefaultButton("Compare the editions", IconUtils.WEBSITE); readMoreButton.addActionListener(new OpenBrowserAction("http://datacleaner.org/editions")); final JButton discussionForumButton = WidgetFactory .createDefaultButton("Visit the discussion forum", "images/menu/forum.png"); discussionForumButton.setToolTipText( "Visit the online discussion forum for questions and answers in the community"); final OpenBrowserAction forumActionListener = new OpenBrowserAction("http://datacleaner.org/forum"); discussionForumButton.addActionListener(forumActionListener); final JButton twitterButton = WidgetFactory.createDefaultButton(null, "images/menu/twitter.png"); twitterButton.setToolTipText("Spread the message about #DataCleaner on Twitter"); twitterButton.addActionListener(new OpenBrowserAction("https://twitter.com/intent/tweet?text=" + UrlEscapers.urlFormParameterEscaper().escape("I'm using @DataCleaner (v. " + Version.getVersion() + ") for some really fancy #dataquality stuff!"))); final JButton linkedInButton = WidgetFactory.createDefaultButton(null, "images/menu/linkedin.png"); linkedInButton.setToolTipText("Join our LinkedIn group of users and professionals"); linkedInButton .addActionListener(new OpenBrowserAction("http://www.linkedin.com/groups?gid=3352784")); final JLabel loveFeedbackAnimation = new JLabel( ImageManager.get().getImageIcon("images/window/we_love_community_and_feedback.gif"), JLabel.LEFT); loveFeedbackAnimation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); loveFeedbackAnimation.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { forumActionListener.actionPerformed(null); } }); final DCPanel innerPanel = new DCPanel(); innerPanel.setLayout(new VerticalLayout()); innerPanel.setBorder( new CompoundBorder(WidgetUtils.BORDER_LIST_ITEM_LEFT_ONLY, new EmptyBorder(0, 20, 0, 0))); innerPanel.add(editorPane); innerPanel.add(DCPanel.flow(tryProfessionalButton, readMoreButton)); innerPanel.add(Box.createVerticalStrut(80)); innerPanel.add(loveFeedbackAnimation); innerPanel.add(Box.createVerticalStrut(20)); innerPanel.add(DCPanel.flow(discussionForumButton, twitterButton, linkedInButton)); innerPanel.add(Box.createVerticalStrut(5)); result.setLayout(new VerticalLayout()); result.add(Box.createVerticalStrut(100)); result.add(innerPanel); } } return wrapContent(result); }
From source file:org.eobjects.datacleaner.widgets.result.DateGapAnalyzerResultSwingRenderer.java
@Override public JComponent render(DateGapAnalyzerResult result) { final TaskSeriesCollection dataset = new TaskSeriesCollection(); final Set<String> groupNames = result.getGroupNames(); final TaskSeries completeDurationTaskSeries = new TaskSeries(LABEL_COMPLETE_DURATION); final TaskSeries gapsTaskSeries = new TaskSeries(LABEL_GAPS); final TaskSeries overlapsTaskSeries = new TaskSeries(LABEL_OVERLAPS); for (final String groupName : groupNames) { final String groupDisplayName; if (groupName == null) { if (groupNames.size() == 1) { groupDisplayName = "All"; } else { groupDisplayName = LabelUtils.NULL_LABEL; }/* w w w .jav a2 s . co m*/ } else { groupDisplayName = groupName; } final TimeInterval completeDuration = result.getCompleteDuration(groupName); final Task completeDurationTask = new Task(groupDisplayName, createTimePeriod(completeDuration.getFrom(), completeDuration.getTo())); completeDurationTaskSeries.add(completeDurationTask); // plot gaps { final SortedSet<TimeInterval> gaps = result.getGaps(groupName); int i = 1; Task rootTask = null; for (TimeInterval interval : gaps) { final TimePeriod timePeriod = createTimePeriod(interval.getFrom(), interval.getTo()); if (rootTask == null) { rootTask = new Task(groupDisplayName, timePeriod); gapsTaskSeries.add(rootTask); } else { Task task = new Task(groupDisplayName + " gap" + i, timePeriod); rootTask.addSubtask(task); } i++; } } // plot overlaps { final SortedSet<TimeInterval> overlaps = result.getOverlaps(groupName); int i = 1; Task rootTask = null; for (TimeInterval interval : overlaps) { final TimePeriod timePeriod = createTimePeriod(interval.getFrom(), interval.getTo()); if (rootTask == null) { rootTask = new Task(groupDisplayName, timePeriod); overlapsTaskSeries.add(rootTask); } else { Task task = new Task(groupDisplayName + " overlap" + i, timePeriod); rootTask.addSubtask(task); } i++; } } } dataset.add(overlapsTaskSeries); dataset.add(gapsTaskSeries); dataset.add(completeDurationTaskSeries); final SlidingGanttCategoryDataset slidingDataset = new SlidingGanttCategoryDataset(dataset, 0, GROUPS_VISIBLE); final JFreeChart chart = ChartFactory.createGanttChart( "Date gaps and overlaps in " + result.getFromColumnName() + " / " + result.getToColumnName(), result.getGroupColumnName(), "Time", slidingDataset, true, true, false); ChartUtils.applyStyles(chart); // make sure the 3 timeline types have correct coloring { final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDrawingSupplier(new DCDrawingSupplier(WidgetUtils.ADDITIONAL_COLOR_GREEN_BRIGHT, WidgetUtils.ADDITIONAL_COLOR_RED_BRIGHT, WidgetUtils.BG_COLOR_BLUE_BRIGHT)); } final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseMoved(ChartMouseEvent event) { Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); ChartEntity entity = event.getEntity(); if (entity instanceof PlotEntity) { cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); } chartPanel.setCursor(cursor); } @Override public void chartMouseClicked(ChartMouseEvent event) { // do nothing } }); final int visibleLines = Math.min(GROUPS_VISIBLE, groupNames.size()); chartPanel.setPreferredSize(new Dimension(0, visibleLines * 50 + 200)); final JComponent decoratedChartPanel; StringBuilder chartDescription = new StringBuilder(); chartDescription .append("<html><p>The chart displays the recorded timeline based on FROM and TO dates.<br/><br/>"); chartDescription.append( "The <b>red items</b> represent gaps in the timeline and the <b>green items</b> represent points in the timeline where more than one record show activity.<br/><br/>"); chartDescription.append( "You can <b>zoom in</b> by clicking and dragging the area that you want to examine in further detail."); if (groupNames.size() > GROUPS_VISIBLE) { final JScrollBar scroll = new JScrollBar(JScrollBar.VERTICAL); scroll.setMinimum(0); scroll.setMaximum(groupNames.size()); scroll.addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { int value = e.getAdjustable().getValue(); slidingDataset.setFirstCategoryIndex(value); } }); chartPanel.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { int scrollType = e.getScrollType(); if (scrollType == MouseWheelEvent.WHEEL_UNIT_SCROLL) { int wheelRotation = e.getWheelRotation(); scroll.setValue(scroll.getValue() + wheelRotation); } } }); final DCPanel outerPanel = new DCPanel(); outerPanel.setLayout(new BorderLayout()); outerPanel.add(chartPanel, BorderLayout.CENTER); outerPanel.add(scroll, BorderLayout.EAST); chartDescription.append("<br/><br/>Use the right <b>scrollbar</b> to scroll up and down on the chart."); decoratedChartPanel = outerPanel; } else { decoratedChartPanel = chartPanel; } chartDescription.append("</p></html>"); final JLabel chartDescriptionLabel = new JLabel(chartDescription.toString()); chartDescriptionLabel.setBorder(new EmptyBorder(4, 10, 4, 10)); final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(decoratedChartPanel); split.add(chartDescriptionLabel); split.setDividerLocation(550); return split; }
From source file:org.jax.maanova.test.gui.VolcanoPlotPanel.java
/** * Constructor// www .j a va2 s . c om * @param parent the parent frame * @param maanovaTestResult * the test result to plot * @param initialTestIndex * the initial test index to use * @param selectedIndices * the initially selected indices */ public VolcanoPlotPanel(JFrame parent, MaanovaTestResult maanovaTestResult, int initialTestIndex, int[] selectedIndices) { selectedIndices = SequenceUtilities.uniqueInts(selectedIndices); this.chartConfigurationDialog = new SimpleChartConfigurationDialog(parent); this.chartConfigurationDialog.addOkActionListener(new ActionListener() { /** * {@inheritDoc} */ public void actionPerformed(ActionEvent e) { VolcanoPlotPanel.this.updateDataPoints(); } }); this.maanovaTestResult = maanovaTestResult; this.saveSelectedPointsMenuItem = new JMenuItem("Save Selected Points to Gene List"); this.saveSelectedPointsMenuItem.setEnabled(selectedIndices != null && selectedIndices.length >= 1); this.saveSelectedPointsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VolcanoPlotPanel.this.saveSelectedPoints(); } }); this.displayTestResultsAction = new DisplayTestResultsAction("Show Results Table", maanovaTestResult); this.selectedIndices = selectedIndices; this.setLayout(new BorderLayout()); JPanel chartAndControlPanel = new JPanel(new BorderLayout()); this.add(chartAndControlPanel, BorderLayout.CENTER); this.chartPanel = new MaanovaChartPanel(); this.chartPanel.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); this.chartPanel.addComponentListener(this.chartComponentListener); this.chartPanel.addAreaSelectionListener(this.areaSelectionListener); this.chartPanel.addMouseListener(this.chartMouseListener); chartAndControlPanel.add(this.chartPanel, BorderLayout.CENTER); this.controlPanel = new JPanel(new FlowLayout()); ItemListener updateDataItemListener = new ItemListener() { /** * {@inheritDoc} */ public void itemStateChanged(ItemEvent e) { VolcanoPlotPanel.this.forgetGraphState(); VolcanoPlotPanel.this.updateDataPoints(); } }; this.statisticTypeComboBox = new JComboBox(); for (MaanovaTestStatisticType testStatType : MaanovaTestStatisticType.values()) { this.statisticTypeComboBox.addItem(testStatType); } this.statisticTypeComboBox.addItemListener(updateDataItemListener); this.controlPanel.add(this.statisticTypeComboBox); List<MaanovaTestStatisticSubtype> availableTestSubtypes = new ArrayList<MaanovaTestStatisticSubtype>(); this.statisticSubtypeComboBox = new JComboBox(); MaanovaTestStatistics fStat = this.maanovaTestResult.getStatistics(MaanovaTestStatisticType.F_STAT); for (MaanovaTestStatisticSubtype statSubtype : MaanovaTestStatisticSubtype.values()) { if (fStat.hasTestStatistic(statSubtype)) { availableTestSubtypes.add(statSubtype); if (statSubtype != MaanovaTestStatisticSubtype.F_OBSERVED) { this.statisticSubtypeComboBox.addItem(statSubtype); } } } this.statisticSubtypeComboBox.addItemListener(updateDataItemListener); this.controlPanel.add(this.statisticSubtypeComboBox); int testStatCount = availableTestSubtypes.size() * MaanovaTestStatisticType.values().length; this.availableTestStatistics = new TestStatisticItem[testStatCount]; for (int i = 0; i < MaanovaTestStatisticType.values().length; i++) { for (int j = 0; j < availableTestSubtypes.size(); j++) { int flatIndex = i * availableTestSubtypes.size() + j; this.availableTestStatistics[flatIndex] = new TestStatisticItem( MaanovaTestStatisticType.values()[i], availableTestSubtypes.get(j)); } } int testCount = fStat.getContrastCount(); if (testCount == 1) { this.testNumberComboBox = null; } else { this.testNumberComboBox = new JComboBox(); for (int i = 1; i <= testCount; i++) { this.testNumberComboBox.addItem("Test Number " + i); } this.testNumberComboBox.setSelectedIndex(initialTestIndex); this.testNumberComboBox.addItemListener(updateDataItemListener); this.controlPanel.add(this.testNumberComboBox); } chartAndControlPanel.add(this.controlPanel, BorderLayout.NORTH); JMenuBar menu = this.createMenu(); this.add(menu, BorderLayout.NORTH); this.forgetGraphState(); this.updateDataPoints(); this.chartPanel.addMouseMotionListener(this.myMouseMotionListener); this.chartPanel.setLayout(null); this.toolTip = new JToolTip(); }
From source file:org.adempiere.apps.graph.Graph.java
public void chartMouseClicked(ChartMouseEvent event) { if ((event.getEntity() != null) && (event.getTrigger().getClickCount() > 1)) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try {//from w w w. j av a2 s. co m GraphColumn bgc = getGraphColumn(event); if (bgc == null) { return; } MQuery query = bgc.getMQuery(builder.getMGoal()); if (query != null) AEnv.zoom(query); else log.warning("Nothing to zoom to - " + bgc); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }
From source file:ca.canuckcoding.wosqi.FeedViewer.java
public FeedViewer(java.awt.Frame parent, WebOSConnection wc, PackageManager pm) { super(parent); bundle = WebOSQuickInstallApp.bundle; URL bgURL = getClass().getResource("resources/background2.jpg"); background = new ImageIcon(bgURL).getImage(); initComponents();/*from www . j a va 2s.co m*/ loaded = false; UNKNOWN_VALUE = bundle.getString("UNKNOWN"); NO_SCREENSHOT = jLabel1.getIcon(); TAB_FILTER = new PackageFilter[] { PackageFilter.Applications, PackageFilter.Services, PackageFilter.Plugins, PackageFilter.Linux_Apps, PackageFilter.Linux_Daemons, PackageFilter.Kernels, PackageFilter.Patches, PackageFilter.Themes }; CATEGORY = new JComboBox[] { jComboBox1, jComboBox2, jComboBox3, jComboBox4, jComboBox9, jComboBox5, jComboBox6, jComboBox7 }; SEARCH = new JTextField[] { jTextField1, jTextField2, jTextField3, jTextField4, jTextField9, jTextField5, jTextField6, jTextField7 }; LIST = new JList[] { jList1, jList2, jList3, jList4, jList9, jList5, jList6, jList7, jList8 }; NAME = new JLabel[] { jLabel2, jLabel13, jLabel24, jLabel35, jLabel90, jLabel46, jLabel57, jLabel68, jLabel79 }; VERSION = new JLabel[] { jLabel5, jLabel16, jLabel27, jLabel38, jLabel93, jLabel49, jLabel60, jLabel71, jLabel82 }; DEVELOPER = new JLabel[] { jLabel9, jLabel20, jLabel31, jLabel42, jLabel97, jLabel53, jLabel64, jLabel75, jLabel86 }; LASTUPDATED = new JLabel[] { jLabel6, jLabel17, jLabel28, jLabel39, jLabel94, jLabel50, jLabel61, jLabel72, jLabel83 }; SCREENSHOT = new JLabel[] { jLabel1, jLabel12, jLabel23, jLabel34, jLabel89, jLabel45, jLabel56, jLabel67, jLabel78 }; LICENSE = new JLabel[] { jLabel10, jLabel21, jLabel32, jLabel43, jLabel98, jLabel54, jLabel65, jLabel76, jLabel87 }; FEED = new JLabel[] { jLabel7, jLabel19, jLabel30, jLabel41, jLabel96, jLabel52, jLabel63, jLabel74, jLabel85 }; DESCRIPTION_LABEL = new JLabel[] { jLabel8, jLabel18, jLabel29, jLabel40, jLabel95, jLabel51, jLabel62, jLabel73, jLabel84 }; HOMEPAGE = new JLabel[] { jLabel11, jLabel22, jLabel33, jLabel44, jLabel99, jLabel55, jLabel66, jLabel77, jLabel88 }; LICENSE_LABEL = new JLabel[] { jLabel3, jLabel15, jLabel26, jLabel37, jLabel92, jLabel48, jLabel59, jLabel70, jLabel81 }; FEED_LABEL = new JLabel[] { jLabel4, jLabel14, jLabel25, jLabel36, jLabel91, jLabel47, jLabel58, jLabel69, jLabel80 }; DESCRIPTION = new JTextPane[] { jTextPane1, jTextPane2, jTextPane3, jTextPane4, jTextPane9, jTextPane5, jTextPane6, jTextPane7, jTextPane8 }; INSTALL_BUTTON = new JButton[] { jButton2, jButton4, jButton6, jButton8, jButton18, jButton10, jButton12, jButton14, jButton16 }; packages = new ArrayList[9]; filtered = new ArrayList[9]; selected = new PackageEntry[9]; webOS = wc; pkgMgr = pm; t = new Timer(); if (!webOS.isConnected()) { DeviceInfo info = webOS.getDeviceInfo(); if (info != null && !info.model().equals(DeviceInfo.Model.Unknown.toString())) { JOptionPane.showMessageDialog(rootPane, MessageFormat.format( bundle.getString("{0}_IS_DISCONNECTED._PLEASE_RECONNECT_THEN_TRY_AGAIN."), new Object[] { info.model() })); } else { JOptionPane.showMessageDialog(rootPane, bundle.getString("DEVICE_IS_DISCONNECTED._PLEASE_RECONNECT_THEN_TRY_AGAIN.")); } t.schedule(new DoDispose(), 200); } else { for (int i = 0; i < HOMEPAGE.length; i++) { HOMEPAGE[i].setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } for (int i = 0; i < NAME.length; i++) { NAME[i].setVisible(false); } t.schedule(new DoLoad(), 200); } }
From source file:com.mirth.connect.manager.ManagerController.java
public void stopMirthWorker() { PlatformUI.MANAGER_DIALOG.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setEnabledOptions(false, false, false, false); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { private String errorMessage = null; public Void doInBackground() { errorMessage = stopMirth();/*from www . ja v a 2 s . c o m*/ return null; } public void done() { if (errorMessage == null) { PlatformUI.MANAGER_TRAY.alertInfo("The Mirth Connect Service was stopped successfully."); } else { PlatformUI.MANAGER_TRAY.alertError(errorMessage); } updateMirthServiceStatus(); PlatformUI.MANAGER_DIALOG.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; worker.execute(); }
From source file:org.martus.client.swingui.FxInSwingMainWindow.java
@Override public Object getWaitCursor() { return Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); }
From source file:net.panthema.BispanningGame.MyEditingGraphMousePlugin.java
public void mouseExited(MouseEvent e) { JComponent c = (JComponent) e.getSource(); c.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:net.sf.vfsjfilechooser.accessories.connection.ConnectionDialog.java
private void initListeners() { this.portTextField.addKeyListener(new KeyAdapter() { @Override//from w w w.j a va 2s . c o m public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))) { getToolkit().beep(); e.consume(); } else { setPortTextFieldDirty(true); } } }); this.portTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { JFormattedTextField f = (JFormattedTextField) e.getSource(); String text = f.getText(); if (text.length() == 0) { f.setValue(null); } try { f.commitEdit(); } catch (ParseException exc) { } } }); this.cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentWorker != null) { if (currentWorker.isAlive()) { currentWorker.interrupt(); setCursor(Cursor.getDefaultCursor()); } } setVisible(false); } }); this.connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { currentWorker = new Thread() { @Override public void run() { StringBuilder error = new StringBuilder(); FileObject fo = null; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { String m_username = usernameTextField.getText(); String m_defaultRemotePath = defaultRemotePathTextField.getText(); char[] m_password = passwordTextField.getPassword(); String m_hostname = hostnameTextField.getText(); String m_protocol = protocolList.getSelectedItem().toString(); int m_port = -1; if (portTextField.isEditValid() && (portTextField.getValue() != null)) { String s = portTextField.getValue().toString(); m_port = Integer.valueOf(s); } Builder credentialsBuilder = Credentials.newBuilder(m_hostname) .defaultRemotePath(m_defaultRemotePath).username(m_username) .password(m_password).protocol(m_protocol).port(m_port); Credentials credentials = credentialsBuilder.build(); String uri = credentials.toFileObjectURL(); if (isInterrupted()) { setPortTextFieldDirty(false); return; } fo = VFSUtils.resolveFileObject(uri); if ((fo != null) && !fo.exists()) { fo = null; } } catch (Exception err) { error.append(err.getMessage()); setCursor(Cursor.getDefaultCursor()); } if ((error.length() > 0) || (fo == null)) { error.delete(0, error.length()); error.append("Failed to connect!"); error.append("\n"); error.append("Please check parameters and try again."); JOptionPane.showMessageDialog(ConnectionDialog.this, error, "Error", JOptionPane.ERROR_MESSAGE); setCursor(Cursor.getDefaultCursor()); return; } if (isInterrupted()) { return; } fileChooser.setCurrentDirectory(fo); setCursor(Cursor.getDefaultCursor()); resetFields(); if (bookmarksDialog != null) { String bTitle = fo.getName().getBaseName(); if (bTitle.trim().equals("")) { bTitle = fo.getName().toString(); } String bURL = fo.getName().getURI(); bookmarksDialog.getBookmarks().add(new TitledURLEntry(bTitle, bURL)); bookmarksDialog.getBookmarks().save(); } setVisible(false); } }; currentWorker.setPriority(Thread.MIN_PRIORITY); currentWorker.start(); } }); // add the usual right click popup menu(copy, paste, etc.) PopupHandler.installDefaultMouseListener(hostnameTextField); PopupHandler.installDefaultMouseListener(portTextField); PopupHandler.installDefaultMouseListener(usernameTextField); PopupHandler.installDefaultMouseListener(passwordTextField); PopupHandler.installDefaultMouseListener(defaultRemotePathTextField); this.protocolList.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectPortNumber(); } } }); this.protocolList.setSelectedItem(Protocol.FTP); }