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);
}
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);
}
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);
}
}
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();
}
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();
}
Aggregations