Search in sources :

Example 56 with Cursor

use of java.awt.Cursor in project mafscaling by vimsh.

the class OpenLoop method loadData.

public void loadData() {
    fileChooser.setMultiSelectionEnabled(false);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;
    File file = fileChooser.getSelectedFile();
    int i, j, k, l;
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    BufferedReader br = null;
    try {
        br = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsoluteFile()), Config.getEncoding()));
        String line = br.readLine();
        if (line == null || !line.equals(SaveDataFileHeader)) {
            JOptionPane.showMessageDialog(null, "Invalid saved data file!", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        line = br.readLine();
        String[] elements;
        JTable table = null;
        i = k = l = 0;
        while (line != null) {
            elements = line.split(Utils.fileFieldSplitter, -1);
            switch(i) {
                case 0:
                    Utils.ensureColumnCount(elements.length - 1, mafTable);
                    for (j = 0; j < elements.length - 1; ++j) mafTable.setValueAt(elements[j], i, j);
                    break;
                case 1:
                    Utils.ensureColumnCount(elements.length - 1, mafTable);
                    for (j = 0; j < elements.length - 1; ++j) mafTable.setValueAt(elements[j], i, j);
                    break;
                default:
                    int offset = runTables.size() * 3 + mafTable.getRowCount();
                    if (i > 1 && i < offset) {
                        if (l == 0)
                            table = runTables.get(k++);
                        Utils.ensureRowCount(elements.length - 1, table);
                        for (j = 0; j < elements.length - 1; ++j) table.setValueAt(elements[j], j, l);
                        l += 1;
                        if (l == 3)
                            l = 0;
                    }
            }
            i += 1;
            line = br.readLine();
        }
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                logger.error(e);
            }
        }
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) JTable(javax.swing.JTable) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) Cursor(java.awt.Cursor) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException)

Example 57 with Cursor

use of java.awt.Cursor in project freeplane by freeplane.

the class MNodeDragListener method dragGestureRecognized.

public void dragGestureRecognized(final DragGestureEvent e) {
    final MainView mainView = (MainView) e.getComponent();
    final NodeView nodeView = mainView.getNodeView();
    final MapView mapView = nodeView.getMap();
    mapView.select();
    if (!nodeView.isSelected()) {
        nodeView.getMap().getModeController().getController().getSelection().selectAsTheOnlyOneSelected(nodeView.getModel());
    }
    Rectangle bounds = new Rectangle(0, 0, mainView.getWidth(), mainView.getHeight());
    if (!bounds.contains(e.getDragOrigin()))
        return;
    final int dragActionType = e.getDragAction();
    if (dragActionType == DnDConstants.ACTION_MOVE) {
        final NodeModel node = nodeView.getModel();
        if (node.isRoot()) {
            if (!isLinkDragEvent(e))
                return;
        }
    }
    final String dragActionName;
    Cursor cursor = getCursorByAction(dragActionType);
    if (isLinkDragEvent(e)) {
        cursor = DragSource.DefaultLinkDrop;
        dragActionName = "LINK";
    } else if ((e.getTriggerEvent().getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        cursor = DragSource.DefaultCopyDrop;
        dragActionName = "COPY";
    } else {
        dragActionName = "MOVE";
    }
    final Transferable t = ClipboardController.getController().copy(Controller.getCurrentController().getSelection());
    ((MindMapNodesSelection) t).setDropAction(dragActionName);
    try {
        e.startDrag(cursor, t, new DragSourceListener() {

            public void dragDropEnd(final DragSourceDropEvent dsde) {
            }

            public void dragEnter(final DragSourceDragEvent e) {
            }

            public void dragExit(final DragSourceEvent dse) {
            }

            public void dragOver(final DragSourceDragEvent dsde) {
            }

            public void dropActionChanged(final DragSourceDragEvent dsde) {
                dsde.getDragSourceContext().setCursor(getCursorByAction(dsde.getUserAction()));
            }
        });
    } catch (final InvalidDnDOperationException ex) {
    }
}
Also used : InvalidDnDOperationException(java.awt.dnd.InvalidDnDOperationException) MainView(org.freeplane.view.swing.map.MainView) DragSourceDragEvent(java.awt.dnd.DragSourceDragEvent) Rectangle(java.awt.Rectangle) Transferable(java.awt.datatransfer.Transferable) NodeView(org.freeplane.view.swing.map.NodeView) Cursor(java.awt.Cursor) DragSourceListener(java.awt.dnd.DragSourceListener) DragSourceEvent(java.awt.dnd.DragSourceEvent) NodeModel(org.freeplane.features.map.NodeModel) MapView(org.freeplane.view.swing.map.MapView) DragSourceDropEvent(java.awt.dnd.DragSourceDropEvent) MindMapNodesSelection(org.freeplane.features.clipboard.MindMapNodesSelection)

Example 58 with Cursor

use of java.awt.Cursor in project screenbird by adamhub.

the class RecorderPanel method showVideoURL.

/**
     * Displays the screenbird URL on the upload form.
     */
private void showVideoURL() {
    this.txtUrl.setText(Session.getInstance().user.getBaseURL() + this.outputMovieSlug);
    this.txtUrl.setCursor(new Cursor(Cursor.HAND_CURSOR));
    this.txtUrl.addMouseListener(uploadUrlListener);
    this.txtUrl.setVisible(true);
    this.jLabel2.setVisible(true);
    this.btnCopy.setVisible(true);
    this.btnCopy.setEnabled(true);
    ((JFrame) this.getParent().getParent().getParent().getParent()).pack();
    this.redrawWindow();
}
Also used : JFrame(javax.swing.JFrame) Cursor(java.awt.Cursor)

Example 59 with Cursor

use of java.awt.Cursor in project zaproxy by zaproxy.

the class ManageAddOnsDialog method checkForUpdates.

protected void checkForUpdates() {
    this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    extension.getLatestVersionInfo(this);
    this.setCursor(Cursor.getDefaultCursor());
}
Also used : Cursor(java.awt.Cursor)

Example 60 with Cursor

use of java.awt.Cursor in project adempiere by adempiere.

the class SwingTool method setCursor.

public static void setCursor(Component c, boolean waiting) {
    if (isIgnoredComponent(c)) {
        return;
    }
    Cursor cursor_wait = new Cursor(Cursor.WAIT_CURSOR);
    Cursor cursor_def = getPredefinedCursor(c);
    Component com = c;
    if (waiting) {
        com.setCursor(cursor_wait);
    } else {
        com.setCursor(cursor_def);
    }
}
Also used : Cursor(java.awt.Cursor) JComponent(javax.swing.JComponent) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent)

Aggregations

Cursor (java.awt.Cursor)136 IOException (java.io.IOException)34 File (java.io.File)27 Point (java.awt.Point)19 MouseEvent (java.awt.event.MouseEvent)16 MouseAdapter (java.awt.event.MouseAdapter)13 Component (java.awt.Component)12 BufferedReader (java.io.BufferedReader)10 FileInputStream (java.io.FileInputStream)10 InputStreamReader (java.io.InputStreamReader)10 JLabel (javax.swing.JLabel)10 ArrayList (java.util.ArrayList)8 URISyntaxException (java.net.URISyntaxException)7 Color (java.awt.Color)6 Insets (java.awt.Insets)6 WalletCallException (com.vaklinov.zcashui.ZCashClientCaller.WalletCallException)5 Dimension (java.awt.Dimension)5 GridBagConstraints (java.awt.GridBagConstraints)5 Rectangle (java.awt.Rectangle)5 JPanel (javax.swing.JPanel)5