Search in sources :

Example 96 with Cursor

use of java.awt.Cursor in project vcell by virtualcell.

the class ImagePlaneManagerPanel method setToolCursor.

/**
 * Insert the method's description here.
 * Creation date: (7/4/2003 12:04:20 PM)
 */
private void setToolCursor() {
    Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    if (getCurveEditorTool() != null) {
        if (getCurveEditorTool().getTool() == cbit.vcell.geometry.gui.CurveEditorTool.TOOL_PAN) {
            cursor = panCursor;
        // cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
        } else if (getCurveEditorTool().getTool() == cbit.vcell.geometry.gui.CurveEditorTool.TOOL_ZOOM) {
            cursor = zoomCursor;
        // cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
        }
    }
    org.vcell.util.BeanUtils.setCursorThroughout(getImagePaneScroller1(), cursor);
}
Also used : Cursor(java.awt.Cursor)

Example 97 with Cursor

use of java.awt.Cursor in project vcell by virtualcell.

the class PythonConfigurationPanel2 method initialize.

private void initialize() {
    setLayout(new BorderLayout());
    Border margin = new EmptyBorder(5, 3, 1, 1);
    Border loweredEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    TitledBorder panelBorder = BorderFactory.createTitledBorder(loweredEtchedBorder, " Python Properties ");
    panelBorder.setTitleJustification(TitledBorder.LEFT);
    panelBorder.setTitlePosition(TitledBorder.TOP);
    panelBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
    JPanel mainPanel = new JPanel();
    mainPanel.setBorder(new CompoundBorder(margin, panelBorder));
    mainPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridheight = 1;
    add(mainPanel, BorderLayout.CENTER);
    JPanel upper = new JPanel();
    // TitledBorder titleLeft = BorderFactory.createTitledBorder(loweredEtchedBorder, " Original Physiology ");
    // titleLeft.setTitleJustification(TitledBorder.LEFT);
    // titleLeft.setTitlePosition(TitledBorder.TOP);
    // upper.setBorder(titleLeft);
    upper.setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0.5;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    // top, left, bottom, right
    gbc.insets = new Insets(5, 2, 2, 3);
    mainPanel.add(upper, gbc);
    // ============================================= Populating the upper group box =================
    String managedMiniconda = new File(ResourceUtil.getVcellHome(), "Miniconda").getAbsolutePath();
    String vcellPythonText = "<html>" + "Python is required for parameter estimation and other analysis.<br>" + "VCell manages a dedicated Miniconda python installation " + "at <font color=#8C001A>" + managedMiniconda + "</font>.<br>" + "</html>";
    String vcellPythonText2 = "<html>" + "For more information about Miniconda, see:" + "</html>";
    websiteLabel.setText(textContinuum);
    websiteLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    int gridy = 0;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(4, 4, 2, 10);
    upper.add(new JLabel(vcellPythonText), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(10, 4, 0, 10);
    upper.add(new JLabel(vcellPythonText2), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(0, 4, 2, 10);
    upper.add(websiteLabel, gbc);
    // --------------------------------------------------
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(new JLabel(""), gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    // gbc.weightx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    // top, left, bottom, right
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(getTestConfigurationButton(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    // gbc.weightx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(getInstallPythonButton(), gbc);
    // Dimension size = getTestConfigurationButton().getPreferredSize();
    // getTestConfigurationButton().setPreferredSize(size);
    // getTestConfigurationButton().setMaximumSize(size);
    // getInstallPythonButton().setSize(size);
    // getInstallPythonButton().setPreferredSize(size);
    // getInstallPythonButton().setMaximumSize(size);
    // --------------------------------------------------------
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    // fake cell used for filling all the vertical empty space
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(new JLabel(""), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(4, 4, 2, 10);
    upper.add(testConfigurationResults, gbc);
    getTestConfigurationButton().addActionListener(eventHandler);
    getInstallPythonButton().addActionListener(eventHandler);
    addFocusListener(eventHandler);
    websiteLabel.addMouseListener(eventHandler);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) Cursor(java.awt.Cursor) BorderLayout(java.awt.BorderLayout) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) CompoundBorder(javax.swing.border.CompoundBorder) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder) EtchedBorder(javax.swing.border.EtchedBorder) File(java.io.File)

Example 98 with Cursor

use of java.awt.Cursor in project omegat by omegat-org.

the class StatisticsPanel method gotoFile.

/**
 * code mostly from from org.omegat.gui.filelist.ProjectFilesListController.gotoFile(int)
 */
private void gotoFile(int fileIndex) {
    if (!Core.getProject().isProjectLoaded()) {
        return;
    }
    Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
    Cursor oldCursor = getCursor();
    setCursor(hourglassCursor);
    try {
        Core.getEditor().gotoFile(fileIndex);
        Core.getEditor().requestFocus();
    } finally {
        setCursor(oldCursor);
    }
}
Also used : Cursor(java.awt.Cursor)

Example 99 with Cursor

use of java.awt.Cursor in project omegat by omegat-org.

the class ProjectUICommands method projectCreateMED.

public static void projectCreateMED() {
    UIThreadsUtil.mustBeSwingThread();
    if (!Core.getProject().isProjectLoaded()) {
        return;
    }
    // commit the current entry first
    Core.getEditor().commitAndLeave();
    // ask for new MED file
    ChooseMedProject ndm = new ChooseMedProject();
    // default name
    String zipName = null;
    try {
        File origin = ProjectMedProcessing.getOriginMedFile(Core.getProject().getProjectProperties());
        if (origin != null) {
            zipName = origin.getName();
        }
    } catch (Exception ex) {
    }
    if (zipName == null) {
        zipName = Core.getProject().getProjectProperties().getProjectName() + "-MED.zip";
    }
    ndm.setSelectedFile(new File(Core.getProject().getProjectProperties().getProjectRootDir().getParentFile(), zipName));
    int ndmResult = ndm.showSaveDialog(Core.getMainWindow().getApplicationFrame());
    if (ndmResult != OmegaTFileChooser.APPROVE_OPTION) {
        // user press 'Cancel' in project creation dialog
        return;
    }
    // add .zip extension if there is no
    final File med = ndm.getSelectedFile().getName().toLowerCase(Locale.ENGLISH).endsWith(".zip") ? ndm.getSelectedFile() : new File(ndm.getSelectedFile().getAbsolutePath() + ".zip");
    new SwingWorker<Void, Void>() {

        protected Void doInBackground() throws Exception {
            IMainWindow mainWindow = Core.getMainWindow();
            Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
            Cursor oldCursor = mainWindow.getCursor();
            mainWindow.setCursor(hourglassCursor);
            mainWindow.showStatusMessageRB("MW_STATUS_SAVING");
            Core.executeExclusively(true, () -> {
                Core.getProject().saveProject(true);
                try {
                    Core.getProject().compileProject(".*");
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
            });
            ProjectMedProcessing.createMed(med, Core.getProject().getProjectProperties());
            mainWindow.showStatusMessageRB("MW_STATUS_SAVED");
            mainWindow.setCursor(oldCursor);
            return null;
        }

        protected void done() {
            try {
                get();
                SwingUtilities.invokeLater(Core.getEditor()::requestFocus);
            } catch (Exception ex) {
                Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
                Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
            }
        }
    }.execute();
}
Also used : ChooseMedProject(org.omegat.gui.dialogs.ChooseMedProject) Cursor(java.awt.Cursor) File(java.io.File) KnownException(org.omegat.core.KnownException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Example 100 with Cursor

use of java.awt.Cursor in project omegat by omegat-org.

the class ProjectUICommands method projectCreate.

public static void projectCreate() {
    UIThreadsUtil.mustBeSwingThread();
    if (Core.getProject().isProjectLoaded()) {
        return;
    }
    // ask for new project dir
    NewProjectFileChooser ndc = new NewProjectFileChooser();
    int ndcResult = ndc.showSaveDialog(Core.getMainWindow().getApplicationFrame());
    if (ndcResult != OmegaTFileChooser.APPROVE_OPTION) {
        // user press 'Cancel' in project creation dialog
        return;
    }
    final File dir = ndc.getSelectedFile();
    if (!ensureProjectDir(dir)) {
        return;
    }
    new SwingWorker<Void, Void>() {

        protected Void doInBackground() throws Exception {
            // ask about new project properties
            ProjectProperties props = new ProjectProperties(dir);
            props.setSourceLanguage(Preferences.getPreferenceDefault(Preferences.SOURCE_LOCALE, "EN-US"));
            props.setTargetLanguage(Preferences.getPreferenceDefault(Preferences.TARGET_LOCALE, "EN-GB"));
            ProjectPropertiesDialog newProjDialog = new ProjectPropertiesDialog(Core.getMainWindow().getApplicationFrame(), props, dir.getAbsolutePath(), ProjectPropertiesDialog.Mode.NEW_PROJECT);
            newProjDialog.setVisible(true);
            newProjDialog.dispose();
            IMainWindow mainWindow = Core.getMainWindow();
            Cursor hourglassCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
            Cursor oldCursor = mainWindow.getCursor();
            mainWindow.setCursor(hourglassCursor);
            final ProjectProperties newProps = newProjDialog.getResult();
            if (newProps == null) {
                // user clicks on 'Cancel'
                dir.delete();
                mainWindow.setCursor(oldCursor);
                return null;
            }
            final String projectRoot = newProps.getProjectRoot();
            if (!StringUtil.isEmpty(projectRoot)) {
                // create project
                try {
                    ProjectFactory.createProject(newProps);
                    RecentProjects.add(dir.getAbsolutePath());
                } catch (Exception ex) {
                    Log.logErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
                    Core.getMainWindow().displayErrorRB(ex, "PP_ERROR_UNABLE_TO_READ_PROJECT_FILE");
                }
            }
            mainWindow.setCursor(oldCursor);
            return null;
        }
    }.execute();
}
Also used : NewProjectFileChooser(org.omegat.gui.dialogs.NewProjectFileChooser) ProjectPropertiesDialog(org.omegat.gui.dialogs.ProjectPropertiesDialog) ProjectProperties(org.omegat.core.data.ProjectProperties) Cursor(java.awt.Cursor) File(java.io.File) KnownException(org.omegat.core.KnownException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

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