java.awt.Cursor Java Examples

The following examples show how to use java.awt.Cursor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XComponentPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void pSetCursor(Cursor cursor, boolean ignoreSubComponents) {
    XToolkit.awtLock();
    try {
        long xcursor = XGlobalCursorManager.getCursor(cursor);

        XSetWindowAttributes xwa = new XSetWindowAttributes();
        xwa.set_cursor(xcursor);

        long valuemask = XConstants.CWCursor;

        XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData);
        XlibWrapper.XFlush(XToolkit.getDisplay());
        xwa.dispose();
    } finally {
        XToolkit.awtUnlock();
    }
}
 
Example #2
Source File: CommandExecutor.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private OperationResponse execute(ModelNode request, boolean useWaitCursor) throws IOException {

        if(request.get(Util.OPERATION).asString().equals(Util.COMPOSITE) &&
                (!request.get(Util.STEPS).isDefined() || request.get(Util.STEPS).asList().isEmpty())) {
            return OperationResponse.Factory.createSimple(new ModelNode("WARN: no request was sent as there were no server-side operations to execute"));
        }

        try {
            if (useWaitCursor) {
                cliGuiCtx.getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            }
            return client.get().executeOperation(OperationBuilder.create(request).build(), OperationMessageHandler.DISCARD);
        } finally {
            if (useWaitCursor) {
                cliGuiCtx.getMainWindow().setCursor(Cursor.getDefaultCursor());
            }
        }
    }
 
Example #3
Source File: WeightedMeanGraphPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
     * Creates a new instance of WeightedMeanGraphPanel
     *
     * @param sample
     */
    public WeightedMeanGraphPanel(SampleInterface sample) {
        super();

        this.sample = sample;

        setOpaque(true);

        setBackground(Color.white);

        graphWidth = 775;
        graphHeight = 600;

        selectedSampleDateModels = new Object[0][0];

        weightedMeanCursor = Cursor.getDefaultCursor();
        imageMode = "PAN";
//        setInRandomMode( false );
        weightedMeanOptions = new SampleDateInterpretationGUIOptions().getWeightedMeanOptions();

        addMouseListener(this);
        addMouseMotionListener(this);
    }
 
Example #4
Source File: MaskingShade.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param e
 */
@Override
public void mouseDragged(MouseEvent e) {

    if (mouseIsPressedInPullTab) {
        currentMouseX = e.getX();
        currentMouseY = e.getY();

        if (pullFrom == PULL_FROM_LEFT) {
            setShadeCover(Math.max(WIDTH_OF_PULLTAB, getWidth() + (currentMouseX - pressedMouseX)));
            pressedMouseX = currentMouseX;
        } else {
            setShadeCover(Math.max(WIDTH_OF_PULLTAB, getWidth() + (pressedMouseX - currentMouseX)));
            pressedMouseX = WIDTH_OF_PULLTAB / 2;
        }

        if (!mouseInPullTab()) {
            processMouseExitedPullTab();
            setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
        }
    }
}
 
Example #5
Source File: XComponentPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void pSetCursor(Cursor cursor, boolean ignoreSubComponents) {
    XToolkit.awtLock();
    try {
        long xcursor = XGlobalCursorManager.getCursor(cursor);

        XSetWindowAttributes xwa = new XSetWindowAttributes();
        xwa.set_cursor(xcursor);

        long valuemask = XConstants.CWCursor;

        XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData);
        XlibWrapper.XFlush(XToolkit.getDisplay());
        xwa.dispose();
    } finally {
        XToolkit.awtUnlock();
    }
}
 
Example #6
Source File: RangeSlider.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void mouseMoved(MouseEvent e) {
    isOverBar = false;
    if (model == null) {
        return;
    }


    Point p = e.getPoint();
    if (isOverFirstPosition(p) || isOverSecondPosition(p)) {
        setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
    } else if (isOverSelection(p)) {
        isOverBar = true;
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        this.setCursor(Cursor.getDefaultCursor());
    }
    repaint();
}
 
Example #7
Source File: DQC.java    From javagame with MIT License 6 votes vote down vote up
/**
 * �t���X�N���[�����[�h�̏�����
 * 
 */
private void initFullScreen() {
    GraphicsEnvironment env = GraphicsEnvironment
            .getLocalGraphicsEnvironment();
    device = env.getDefaultScreenDevice();

    // �^�C�g���o�[������
    setUndecorated(true);
    // �}�E�X�J�[�\��������
    Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
            new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB),
            new Point(), "");
    setCursor(cursor);

    if (!device.isFullScreenSupported()) {
        System.out.println("�t���X�N���[�����[�h�̓T�|�[�g����Ă��܂���B");
        System.exit(0);
    }

    device.setFullScreenWindow(this); // �t���X�N���[�����I

    DisplayMode mode = new DisplayMode(640, 480, 16,
            DisplayMode.REFRESH_RATE_UNKNOWN);
    device.setDisplayMode(mode);
}
 
Example #8
Source File: Rubber.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
private void setCursor (MouseEvent e)
{
    if (isDragWanted(e)) {
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    } else if (isAdditionWanted(e)) {
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    } else if (isContextWanted(e)) {
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else if (isRubberWanted(e)) {
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
    } else if (isRezoomWanted(e)) {
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
    } else {
        e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}
 
Example #9
Source File: DataPresentationModeChooserPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param sampleSessionDataView
 * @param dataPresentationMode
 * @param timeArray
 * @param bounds
 * @param meanOnly the value of meanOnly
 */
public DataPresentationModeChooserPanel(//
        JLayeredPane sampleSessionDataView, //
        DataPresentationModeEnum dataPresentationMode, //
        double[] timeArray, //
        Rectangle bounds, //
        boolean meanOnly) {

    super(bounds);

    this.sampleSessionDataView = sampleSessionDataView;

    this.dataPresentationMode = dataPresentationMode;

    this.myOnPeakNormalizedAquireTimes = timeArray;
    this.meanOnly = meanOnly;

    setOpaque(true);
    setBackground(new Color(250, 240, 230));
    setCursor(Cursor.getDefaultCursor());

    dataViewModeButtonGroup = new ButtonGroup();
}
 
Example #10
Source File: XDragSourceContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) {
    assert XToolkit.isAWTLockHeldByCurrentThread();

    if (c == null) {
        return;
    }

    long xcursor = XGlobalCursorManager.getCursor(c);

    if (xcursor == 0) {
        return;
    }

    XlibWrapper.XChangeActivePointerGrab(XToolkit.getDisplay(),
                                         GRAB_EVENT_MASK,
                                         xcursor,
                                         XConstants.CurrentTime);
}
 
Example #11
Source File: RangeSlider.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void mouseMoved(MouseEvent e) {
    isOverBar = false;
    if (model == null) {
        return;
    }


    Point p = e.getPoint();
    if (isOverFirstPosition(p) || isOverSecondPosition(p)) {
        setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
    } else if (isOverSelection(p)) {
        isOverBar = true;
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        this.setCursor(Cursor.getDefaultCursor());
    }
    repaint();
}
 
Example #12
Source File: TN5250jSplashScreen.java    From tn5250j with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method will show or hide the splash screen.  Once the splash
 * screen is hidden, the splash screen window will be disposed. This means
 * the splash screen cannot become visible again.
 */
public void setVisible(boolean show) {
   if (show == true && dialog != null && f != null && !dialog.isVisible()) {
      dialog.setVisible(true);
   }
   else {

      if (dialog != null) {
         updateProgress(steps + 1);
         dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
         dialog.dispose();
      }
      if (f != null) {
         f.dispose();
      }
      dialog = null;
      f = null;
   }
}
 
Example #13
Source File: DatePicker.java    From importer-exporter with Apache License 2.0 6 votes vote down vote up
private JPanel createLinkPanel() {
    linkPanel = new JPanel();
    linkPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    todayLink = new JLabel();
    todayLink.setForeground(new Color(16, 66, 104));
    todayLink.setCursor(new Cursor(Cursor.HAND_CURSOR));
    linkPanel.add(todayLink);

    todayLink.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e)) {
                Action delegate = getActionMap().get(e.getClickCount() != 2 ? JXDatePicker.HOME_NAVIGATE_KEY : JXDatePicker.HOME_COMMIT_KEY);
                if (delegate != null && delegate.isEnabled())
                    delegate.actionPerformed(null);
            }
        }
    });

    return linkPanel;
}
 
Example #14
Source File: EvolutionPlotPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param evt
 */
@Override
public void mouseMoved(MouseEvent evt) {
    int myX = evt.getX();
    int myY = evt.getY();

    eastResizing = isEastResize(myX);
    southResizing = isSouthResize(myY);

    setCursor(Cursor.getDefaultCursor());
    if (eastResizing ^ southResizing) {
        if (eastResizing) {
            setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
        } else {
            setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
        }
    }

    if (eastResizing && southResizing) {
        setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
    }
}
 
Example #15
Source File: JPanel_FileBrowser.java    From MobyDroid with Apache License 2.0 6 votes vote down vote up
/**
 * Disable the User Interface.
 */
public void disableUI() {
    // turn on the wait cursor
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    // hide jTable (disabling show out of bound exception ! ! !)
    jTable_Browser.setVisible(false);
    // disable input
    jComboBox_Path.setEnabled(false);
    jTextField_Filter.setEnabled(false);
    // disable buttons
    mButton_Copy.setEnabled(false);
    mButton_Delete.setEnabled(false);
    mButton_GoUp.setEnabled(false);
    mButton_MakeDirectory.setEnabled(false);
    mButton_MakeFile.setEnabled(false);
    mButton_Paste.setEnabled(false);
    mButton_Refresh.setEnabled(false);
    mButton_Rename.setEnabled(false);
}
 
Example #16
Source File: BoardEditor.java    From megamek with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Saves the board in PNG image format.
 */
private void boardSaveImage(boolean ignoreUnits) {
    if (curfileImage == null) {
        boardSaveAsImage(ignoreUnits);
        return;
    }
    JDialog waitD = new JDialog(frame, Messages.getString("BoardEditor.waitDialog.title")); //$NON-NLS-1$
    waitD.add(new JLabel(Messages.getString("BoardEditor.waitDialog.message"))); //$NON-NLS-1$
    waitD.setSize(250, 130);
    // move to middle of screen
    waitD.setLocation(
            (frame.getSize().width / 2) - (waitD.getSize().width / 2),
            (frame.getSize().height / 2) - (waitD.getSize().height / 2));
    waitD.setVisible(true);
    frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    waitD.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    // save!
    try {
        ImageIO.write(bv.getEntireBoardImage(ignoreUnits), "png", curfileImage);
    } catch (IOException e) {
        e.printStackTrace();
    }
    waitD.setVisible(false);
    frame.setCursor(Cursor.getDefaultCursor());
}
 
Example #17
Source File: DocumentAnalyzer.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Collection process complete.
 *
 * @see org.apache.uima.collection.base_cpm.BaseStatusCallbackListener#collectionProcessComplete()
 */
@Override
public void collectionProcessComplete() {
  // invoke ProcessingCompleteRunnable in Swing event handler thread
  // SwingUtilities.invokeLater(new ProcessingCompleteRunnable());
  // hide progress bar dialog if it is visible
  if (!progressMonitor.isCanceled()) {
    progressMonitor.close();
    progressTimer.stop();
  }

  // Re-enable frame:
  setEnabled(true);

  // reset cursor
  setCursor(Cursor.getDefaultCursor());

  // if everything works, output performance stats and print them to a
  // pane. Allow users to open generated files.
  showAnalysisResults(new AnalysisEnginePerformanceReports(mCPM.getPerformanceReport()),
          outputDirectory);
}
 
Example #18
Source File: FrmMain.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Load an application
 *
 * @param plugin Application
 */
public void loadApplication(Application plugin) {
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    try {
        PythonInterpreter interp = this.getConsoleDockable().getInterpreter();
        String path = plugin.getPath();
        interp.exec("import " + path);
        interp.exec("from " + path + ".loadApp import LoadApp");
        PyObject loadClass = interp.get("LoadApp");
        PyObject loadObj = loadClass.__call__();
        IPlugin instance = (IPlugin) loadObj.__tojava__(IPlugin.class);
        instance.setApplication(FrmMain.this);
        instance.setName(plugin.getName());
        plugin.setPluginObject(instance);
        plugin.setLoad(true);
        instance.load();
    } catch (Exception e) {
        e.printStackTrace();
    }
    this.setCursor(Cursor.getDefaultCursor());
}
 
Example #19
Source File: Mouse.java    From haxademic with MIT License 5 votes vote down vote up
public static void setInvisibleCursor(Component comp) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Point hotSpot = new Point(0,0);
    BufferedImage cursorImage = new BufferedImage(1, 1, BufferedImage.TRANSLUCENT); 
    Cursor invisibleCursor = toolkit.createCustomCursor(cursorImage, hotSpot, "InvisibleCursor");
    comp.setCursor(invisibleCursor);
}
 
Example #20
Source File: RawDataSessionOverlayContainer.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseMoved(MouseEvent evt) {
    insidePeak = false;
    onLeftOfPeak = false;
    onRightOfPeak = false;
    insideBackground = false;
    onLeftOfBackground = false;
    onRightOfBackground = false;

    if (confirmMouseInOnPeakZone(evt.getX())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        insidePeak = true;
    } else if (confirmMouseLeftPeakZone(evt.getX())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
        onLeftOfPeak = true;
    } else if (confirmMouseRightPeakZone(evt.getX())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
        onRightOfPeak = true;

    } else if (confirmMouseInBackgroundZone(evt.getX())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        insideBackground = true;
    } else if (confirmMouseLeftBackgroundZone(evt.getX())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
        onLeftOfBackground = true;
    } else if (confirmMouseRightBackgroundZone(evt.getX())) {
        setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
        onRightOfBackground = true;
    } else {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}
 
Example #21
Source File: ShowTabsButton.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
public ShowTabsButton() {
    setOpaque(false);
    setBackground(null);
    setFont(UIManager.getFont("Label.font"));
    setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("Show Hidden Tabs List")));
    setCursor(Cursor.getDefaultCursor());
    addMouseListener(this);
    addMouseMotionListener(this);
    addComponentListener(this);
}
 
Example #22
Source File: MainFrameStatusPanel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
private void createStatusPanel() {
    JPanel statusLeftPanel = new JPanel();
    statusLeftPanel.setLayout(new BoxLayout(statusLeftPanel, BoxLayout.X_AXIS));
    loadingPanel.setPreferredSize(new Dimension(30, 30));
    // todo: this button is a little bit ugly in the UI. Maybe it can be changed to an icon (as in NetBeans)
    cancelButton.setText(translate("button.cancel"));
    cancelButton.setPreferredSize(new Dimension(100, 30));
    cancelButton.setBorderPainted(false);
    cancelButton.setOpaque(false);
    cancelButton.addActionListener((ActionEvent e) -> {
        if (currentWorker != null) {
            currentWorker.cancel(true);
        }
    });
    statusLeftPanel.add(loadingPanel);
    statusLeftPanel.add(cancelButton);
    statusLeftPanel.add(statusLabel);
    setPreferredSize(new Dimension(1, 30));
    setBorder(new BevelBorder(BevelBorder.LOWERED));
    setLayout(new BorderLayout());
    add(statusLeftPanel, BorderLayout.WEST);

    errorNotificationButton = new JButton("");
    errorNotificationButton.setIcon(View.getIcon("okay16"));
    errorNotificationButton.setBorderPainted(false);
    errorNotificationButton.setFocusPainted(false);
    errorNotificationButton.setContentAreaFilled(false);
    errorNotificationButton.setMargin(new Insets(2, 2, 2, 2));
    errorNotificationButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    errorNotificationButton.addActionListener(this::showErrorLogButtonActionPerformed);
    errorNotificationButton.setToolTipText(translate("errors.none"));
    add(errorNotificationButton, BorderLayout.EAST);

    loadingPanel.setVisible(false);
    cancelButton.setVisible(false);
}
 
Example #23
Source File: FontPanel.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void mouseReleased( MouseEvent e ) {
    if ( textToUse == RANGE_TEXT || textToUse == ALL_GLYPHS ) {
        if ( nowZooming )
          zoomWindow.hide();
        nowZooming = false;
    }
    this.setCursor( Cursor.getDefaultCursor() );
}
 
Example #24
Source File: SerialPortSimpleBean.java    From IrScrutinizer with GNU General Public License v3.0 5 votes vote down vote up
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
    Cursor oldCursor = setBusyCursor();
    try {
        setupPortComboBox(false);
    } catch (IOException ex) {
        guiUtils.error(ex);
    } finally {
        resetCursor(oldCursor);
    }
}
 
Example #25
Source File: StatusBar.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void stopProgress() {
  stopRunner();

  updateProgress(0);
  perc = 0;
  msg  = "";
  repaint();

  setCursor(Cursor.DEFAULT_CURSOR);
}
 
Example #26
Source File: FrmSelectByAttributes.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void jButton_ClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ClearActionPerformed
    // TODO add your handling code here:
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));        
    this._selectLayer.clearSelectedShapes();
    for (Shape shape : _selectLayer.getShapes()) {
        shape.setVisible(true);
    }
    this._frmMain.refreshMap();
    this.jTextField_QueryString.setText("");
    this.setCursor(Cursor.getDefaultCursor());
}
 
Example #27
Source File: SimilarityPanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates new form SimilarityPanel
 */
public SimilarityPanel() {
    initComponents();
    
    message = new SimpleLabel();
    message.setHorizontalAlignment(SimpleLabel.CENTER);
    message.setIcon(UIBox.getIcon("gui/icons/warn.png"));
    
    similarityTextField.setPreferredSize(new Dimension(200, 26));
    
    similarityThresholdSlider.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    similarityTypeComboBox.removeAllItems();
    similarityTypeComboBox.setEditable(false);
    for(int i=0; i<similarityTypes.length; i++) {
        similarityTypeComboBox.addItem(similarityTypes[i].e1);
    }
    similarityTokenizerComboBox.removeAllItems();
    similarityTokenizerComboBox.setEditable(false);
    for(int i=0; i<similarityTokenizers.length; i++) {
        similarityTokenizerComboBox.addItem(similarityTokenizers[i].e1);
    }
    updateSimilarityOptions();
    
    similarityTextField.addKeyListener(
        new java.awt.event.KeyAdapter() {
            @Override
            public void keyReleased(java.awt.event.KeyEvent evt){
                if(evt.getKeyChar()==KeyEvent.VK_ENTER) {
                    doSearch();
                }
            }
        }
    );
}
 
Example #28
Source File: FrmOutputMapData.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void saveShapeFile(final String fileName) {
    FrmOutputMapData.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    FrmOutputMapData.this.jProgressBar1.setVisible(true);
    FrmOutputMapData.this.jProgressBar1.setValue(0);

    //Create a VectorLayer with selected shapes
    int i, j;
    VectorLayer aLayer = new VectorLayer(_currentLayer.getShapeType());
    for (i = 0; i < _currentLayer.getFieldNumber(); i++) {
        aLayer.editAddField(_currentLayer.getField(i).getColumnName(), _currentLayer.getField(i).getDataType());
    }
    boolean hasSelShape = _currentLayer.hasSelectedShapes();

    for (i = 0; i < _currentLayer.getShapeNum(); i++) {
        Shape aPS = _currentLayer.getShapes().get(i);
        if (hasSelShape) {
            if (!aPS.isSelected()) {
                continue;
            }
        }
        int sNum = aLayer.getShapeNum();
        try {
            if (aLayer.editInsertShape(aPS, sNum)) {
                for (j = 0; j < aLayer.getFieldNumber(); j++) {
                    aLayer.editCellValue(j, sNum, _currentLayer.getCellValue(j, i));
                }
            }
        } catch (Exception ex) {
            Logger.getLogger(FrmOutputMapData.class.getName()).log(Level.SEVERE, null, ex);
        }
        FrmOutputMapData.this.jProgressBar1.setValue((int) ((double) i / _currentLayer.getShapeNum() * 100));
    }
    aLayer.setProjInfo(_currentLayer.getProjInfo());
    aLayer.saveFile(fileName);
    
    FrmOutputMapData.this.setCursor(Cursor.getDefaultCursor());
    FrmOutputMapData.this.jProgressBar1.setVisible(false);
}
 
Example #29
Source File: TooltipWindow.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean mouseMoved (Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(Bundle.CTL_AnnotationBar_action_showCommit(revision));
        return true;
    }
    return false;
}
 
Example #30
Source File: JConsole.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void setWaitFeedback(boolean on) {
    if (on) {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    } else {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}