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