List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:biz.wolschon.finance.jgnucash.panels.TaxReportPanel.java
/** * Show a dialog to export//from w ww . j ava2 s . co m * a CSV-file that contains the * shown {@link TransactionSum}s * for each month, year or day. */ protected void showExportCSVDialog() { JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(true); fc.addChoosableFileFilter(new FileFilter() { @Override public boolean accept(final File aF) { return aF.isDirectory() || aF.getName().endsWith(".csv"); } @Override public String getDescription() { return "CSV-file"; } }); int dialogResult = fc.showSaveDialog(this); if (dialogResult != JFileChooser.APPROVE_OPTION) { return; } File file = fc.getSelectedFile(); if (file.exists()) { int confirmation = JOptionPane.showConfirmDialog(this, "File exists. Replace file?"); if (confirmation != JOptionPane.YES_OPTION) { showExportCSVDialog(); return; } } ExportGranularities gran = (ExportGranularities) myExportGranularityCombobox.getSelectedItem(); try { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); exportCSV(file, gran); } finally { setCursor(Cursor.getDefaultCursor()); } }
From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java
public void save() { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setPickerEnabled(false);/* www. ja va2 s . c om*/ btnSave.setEnabled(false); if (currentSelected >= 0) saveChanges(currentSelected); setPickerEnabled(true); btnSave.setEnabled(true); setCursor(Cursor.getDefaultCursor()); }
From source file:op.care.info.DlgDiag.java
/** * This method is called from within the constructor to * initialize the form.// w w w .j ava 2 s .c om * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); txtSuche = new JXSearchField(); lblTX = new JLabel(); jspDiagnosen = new JScrollPane(); lstDiag = new JList(); lblDiagBy = new JLabel(); cmbArzt = new JComboBox<>(); btnAddGP = new JButton(); cmbKH = new JComboBox<>(); btnAddHospital = new JButton(); lblSecurity = new JLabel(); lblSide = new JLabel(); cmbKoerper = new JComboBox<>(); cmbSicherheit = new JComboBox<>(); jScrollPane1 = new JScrollPane(); txtBemerkung = new JTextArea(); lblInterval = new JLabel(); panel1 = new JPanel(); btnCancel = new JButton(); btnOK = new JButton(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== jPanel1 ======== { jPanel1.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED)); jPanel1.setLayout(new FormLayout( "default, $lcgap, pref, $lcgap, default:grow, $ugap, pref, $lcgap, default:grow, 2*($lcgap, default)", "default, $lgap, fill:default, $lgap, fill:104dlu:grow, $lgap, fill:default, $lgap, default, $lgap, fill:default, $lgap, fill:89dlu:grow, $ugap, default, $lgap, default")); //---- txtSuche ---- txtSuche.setFont(new Font("Arial", Font.PLAIN, 14)); txtSuche.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtSucheActionPerformed(e); } }); jPanel1.add(txtSuche, CC.xywh(3, 3, 7, 1)); //---- lblTX ---- lblTX.setText(null); lblTX.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/ambulance2.png"))); jPanel1.add(lblTX, CC.xy(11, 3)); //======== jspDiagnosen ======== { //---- lstDiag ---- lstDiag.setFont(new Font("Arial", Font.PLAIN, 14)); jspDiagnosen.setViewportView(lstDiag); } jPanel1.add(jspDiagnosen, CC.xywh(3, 5, 9, 1)); //---- lblDiagBy ---- lblDiagBy.setText("Festgestellt durch:"); lblDiagBy.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(lblDiagBy, CC.xy(3, 7, CC.RIGHT, CC.DEFAULT)); //---- cmbArzt ---- cmbArzt.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbArzt.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbArzt, CC.xywh(5, 7, 5, 1)); //---- btnAddGP ---- btnAddGP.setText(null); btnAddGP.setBorder(null); btnAddGP.setContentAreaFilled(false); btnAddGP.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddGP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddGP.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png"))); btnAddGP.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnAddGPActionPerformed(e); } }); jPanel1.add(btnAddGP, CC.xy(11, 7)); //---- cmbKH ---- cmbKH.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbKH.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbKH, CC.xywh(5, 9, 5, 1)); //---- btnAddHospital ---- btnAddHospital.setText(null); btnAddHospital.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddHospital.setBorder(null); btnAddHospital.setContentAreaFilled(false); btnAddHospital.setBorderPainted(false); btnAddHospital.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddHospital.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png"))); btnAddHospital.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnAddHospitalActionPerformed(e); } }); jPanel1.add(btnAddHospital, CC.xy(11, 9)); //---- lblSecurity ---- lblSecurity.setText("Diagnosesicherheit:"); lblSecurity.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(lblSecurity, CC.xy(7, 11)); //---- lblSide ---- lblSide.setText("K\u00f6rperseite:"); lblSide.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(lblSide, CC.xy(3, 11, CC.RIGHT, CC.DEFAULT)); //---- cmbKoerper ---- cmbKoerper.setModel(new DefaultComboBoxModel<>( new String[] { "Nicht festgelegt", "links", "rechts", "beidseitig" })); cmbKoerper.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbKoerper, CC.xy(5, 11)); //---- cmbSicherheit ---- cmbSicherheit.setModel(new DefaultComboBoxModel<>(new String[] { "Nicht festgelegt", "gesichert", "Verdacht auf", "Ausschlu\u00df von", "Zustand nach" })); cmbSicherheit.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbSicherheit, CC.xywh(9, 11, 3, 1)); //======== jScrollPane1 ======== { //---- txtBemerkung ---- txtBemerkung.setColumns(20); txtBemerkung.setRows(5); txtBemerkung.setFont(new Font("Arial", Font.PLAIN, 14)); jScrollPane1.setViewportView(txtBemerkung); } jPanel1.add(jScrollPane1, CC.xywh(3, 13, 9, 1)); //---- lblInterval ---- lblInterval.setText("text"); jPanel1.add(lblInterval, CC.xywh(3, 15, 5, 1)); //======== panel1 ======== { panel1.setLayout(new HorizontalLayout(5)); //---- btnCancel ---- btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnCancel.setText(null); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCancelActionPerformed(e); } }); panel1.add(btnCancel); //---- btnOK ---- btnOK.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnOK.setText(null); btnOK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnOKActionPerformed(e); } }); panel1.add(btnOK); } jPanel1.add(panel1, CC.xywh(7, 15, 5, 1, CC.RIGHT, CC.DEFAULT)); } contentPane.add(jPanel1, BorderLayout.CENTER); setSize(730, 565); setLocationRelativeTo(getOwner()); }
From source file:plugin.notes.gui.NotesView.java
/** * {@literal handle File->Open.} Will open any .gmn files, and import them into your * notes structure//from ww w . jav a2 s. c o m */ public void handleOpen() { // TODO fix String sFile = SettingsHandler.getGMGenOption(OPTION_NAME_LASTFILE, System.getProperty("user.dir")); File defaultFile = new File(sFile); JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(defaultFile); chooser.addChoosableFileFilter(getFileType()); chooser.setFileFilter(getFileType()); chooser.setMultiSelectionEnabled(true); Component component = GMGenSystem.inst; Cursor originalCursor = component.getCursor(); component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int option = chooser.showOpenDialog(GMGenSystem.inst); if (option == JFileChooser.APPROVE_OPTION) { for (File noteFile : chooser.getSelectedFiles()) { SettingsHandler.setGMGenOption(OPTION_NAME_LASTFILE, noteFile.toString()); if (noteFile.toString().endsWith(EXTENSION)) { openGMN(noteFile); } } } GMGenSystem.inst.setCursor(originalCursor); refreshTree(); }
From source file:au.com.jwatmuff.eventmanager.gui.wizard.SeedingPanel.java
@Override public boolean nextButtonPressed() { if (!GUIUtils.confirmLock(null, "all players and fights in division " + pool.getDescription())) return false; // TODO: I would like this to be wrapped in a transaction, so that it can't fail halfway (e.g. players // locked, but fights not), but I couldn't get this working easily. boolean result = false; try {/*from w ww. ja va2 s . co m*/ context.detectExternalChanges = false; context.wizardWindow.disableNavigation(); seedingTable.setEnabled(false); context.wizardWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); result = commitChanges(); } finally { context.wizardWindow.enableNavigation(); seedingTable.setEnabled(true); context.wizardWindow.setCursor(Cursor.getDefaultCursor()); if (!result) context.detectExternalChanges = true; } return result; }
From source file:no.imr.sea2data.stox.InstallerUtil.java
public static boolean installRstox(Window wnd, String ftpPath, String rFolder) { // String pkgFile = getIOTempDirFile(RSTOX + TARGZ); // retrieveRstox(ftpPath, pkgFile); wnd.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try {/*from w ww .j a v a 2 s . c o m*/ return RUtils.installRstox(ftpPath, rFolder); } finally { wnd.setCursor(Cursor.getDefaultCursor()); } }
From source file:de.main.sessioncreator.DesktopApplication1View.java
private void showReportPanel() { sessionWizardMenuItem.setEnabled(true); reviewVieMenuItem.setEnabled(true);//from w w w . j a v a 2 s.c om sessionReportMenuItem.setEnabled(false); viewReviewsPanel.setVisible(false); mainPanel.validate(); wizardPanel.setVisible(false); mainPanel.validate(); reportOverviewTable.setVisible(false); reportPanel.setVisible(true); mainPanel.validate(); this.getFrame().setTitle("SessionCreator - Report"); //Backgroundprozess to fill data to the reportPanel class ReportData extends SwingWorker<DefaultTableModel, Void> { @Override protected DefaultTableModel doInBackground() throws Exception { rh.addReport(reportChartPanel); reportScrollPOverviewTabel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); reportScrollPOverviewTabel.setToolTipText("Please wait..."); reportlblSum.setText("Sums of Charters done: <counting>"); progressBar.setIndeterminate(true); progressBar.setVisible(true); model = new DefaultTableModel(); reportOverviewTable.removeAll(); model = rh.getTableModel(); reportOverviewTable.setModel(model); reportOverviewTable.setVisible(true); String count = rh.getAllSessionCount(model); reportlblSum.setText("Sums of Charters done: " + count); String[] text = rh.getAllBugsAndIssues(); reportlblBug.setText(text[0]); reportlblIssue.setText(text[1]); return model; } @Override protected void done() { try { reportScrollPOverviewTabel.setCursor(Cursor.getDefaultCursor()); reportScrollPOverviewTabel.setToolTipText(""); progressBar.setIndeterminate(false); progressBar.setVisible(false); reportScrollPOverviewTabel.setEnabled(true); reportOverviewTable.setFillsViewportHeight(true); reportOverviewTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); TableRowSorter<DefaultTableModel> rowSorter = new TableRowSorter<DefaultTableModel>(model); reportOverviewTable.setRowSorter(rowSorter); rowSorter.setComparator(1, new Comparator<Integer>() { @Override public int compare(Integer int1, Integer int2) { return int1.intValue() - int2.intValue(); } }); TableColumn column = null; for (int i = 0; i < 2; i++) { column = reportOverviewTable.getColumnModel().getColumn(i); if (i == 1) { column.setPreferredWidth(10); //third column is bigger DefaultTableCellRenderer myRenderer = new DefaultTableCellRenderer(); //Textalignment in second column right myRenderer.setHorizontalAlignment(SwingConstants.RIGHT); column.setCellRenderer(myRenderer); } else { column.setPreferredWidth(490); } } } catch ( /* InterruptedException, ExecutionException */Exception e) { } } } new ReportData().execute(); }
From source file:JavaXWin.java
public WindowWatcher(JDesktopPane desktop) { m_desktop = desktop;/*from w ww . jav a2s. c o m*/ setOpaque(true); m_northResizer = new NorthResizeEdge(this); m_southResizer = new SouthResizeEdge(this); m_eastResizer = new EastResizeEdge(this); m_westResizer = new WestResizeEdge(this); setLayout(new BorderLayout()); add(m_northResizer, BorderLayout.NORTH); add(m_southResizer, BorderLayout.SOUTH); add(m_eastResizer, BorderLayout.EAST); add(m_westResizer, BorderLayout.WEST); MouseInputAdapter ma = new MouseInputAdapter() { public void mousePressed(MouseEvent e) { m_XDifference = e.getX(); m_YDifference = e.getY(); } public void mouseDragged(MouseEvent e) { int vx = 0; int vy = 0; if (m_desktop.getParent() instanceof JViewport) { vx = ((JViewport) m_desktop.getParent()).getViewPosition().x; vy = ((JViewport) m_desktop.getParent()).getViewPosition().y; } int w = m_desktop.getParent().getWidth(); int h = m_desktop.getParent().getHeight(); int x = getX(); int y = getY(); int ex = e.getX(); int ey = e.getY(); if ((ey + y > vy && ey + y < h + vy) && (ex + x > vx && ex + x < w + vx)) { setLocation(ex - m_XDifference + x, ey - m_YDifference + y); } else if (!(ey + y > vy && ey + y < h + vy) && (ex + x > vx && ex + x < w + vx)) { if (!(ey + y > vy) && ey + y < h + vy) setLocation(ex - m_XDifference + x, vy - m_YDifference); else if (ey + y > vy && !(ey + y < h + vy)) setLocation(ex - m_XDifference + x, (h + vy) - m_YDifference); } else if ((ey + y > vy && ey + y < h + vy) && !(ex + x > vx && ex + x < w + vx)) { if (!(ex + x > vx) && ex + x < w + vx) setLocation(vx - m_XDifference, ey - m_YDifference + y); else if (ex + x > vx && !(ex + x < w)) setLocation((w + vx) - m_XDifference, ey - m_YDifference + y); } else if (!(ey + y > vy) && ey + y < h + vy && !(ex + x > vx) && ex + x < w + vx) setLocation(vx - m_XDifference, vy - m_YDifference); else if (!(ey + y > vy) && ey + y < h + vy && ex + x > vx && !(ex + x < w + vx)) setLocation((w + vx) - m_XDifference, vy - m_YDifference); else if (ey + y > vy && !(ey + y < h + vy) && !(ex + x > vx) && ex + x < w + vx) setLocation(vx - m_XDifference, (h + vy) - m_YDifference); else if (ey + y > vy && !(ey + y < h + vy) && ex + x > vx && !(ex + x < w + vx)) setLocation((w + vx) - m_XDifference, (h + vy) - m_YDifference); } public void mouseEntered(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } public void mouseExited(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; addMouseListener(ma); addMouseMotionListener(ma); }
From source file:org.revager.tools.GUITools.java
/** * Creates a new standard table.//from ww w. java2s .c om * * @param model * the table model * @param showHeader * true if the header of the table should be visible * * @return the newly created table */ @SuppressWarnings("serial") public static JTable newStandardTable(TableModel model, boolean showHeader) { /* * Prep. for rollover */ if (lastRolloverKey == Integer.MAX_VALUE) { lastRolloverKey = 0; } else { lastRolloverKey++; } final int keyIdx = lastRolloverKey; rollOverRowIndex.put(keyIdx, -1); final JTable table = new JTable(model) { @Override public boolean editCellAt(int row, int column, java.util.EventObject e) { boolean result = super.editCellAt(row, column, e); final Component editor = getEditorComponent(); TableCellRenderer renderer = this.getColumnModel().getColumn(column).getCellRenderer(); Font cellFont = null; if (renderer instanceof DefaultTableCellRenderer) { cellFont = ((DefaultTableCellRenderer) renderer).getFont(); } if (editor != null && editor instanceof JTextComponent) { JTextComponent jTextComponent = (JTextComponent) editor; if (e == null) { jTextComponent.selectAll(); } else { SwingUtilities.invokeLater(jTextComponent::selectAll); } jTextComponent.setBorder(UI.MARKED_BORDER_INLINE); if (cellFont != null) { jTextComponent.setFont(cellFont); } editor.requestFocusInWindow(); } return result; } @Override public TableCellRenderer getCellRenderer(int row, int column) { TableCellRenderer renderer = super.getCellRenderer(row, column); if (renderer instanceof DefaultTableCellRenderer) { ((DefaultTableCellRenderer) renderer).setBorder(new EmptyBorder(3, 3, 3, 3)); } return renderer; } @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { Component comp = super.prepareRenderer(renderer, row, col); // Rollover comp.setBackground(getBackground()); comp = super.prepareRenderer(renderer, row, col); if (!isRowSelected(row) && row == rollOverRowIndex.get(keyIdx)) { comp.setForeground(getForeground()); comp.setBackground(UI.BLUE_BACKGROUND_COLOR); } // Tooltips JComponent jcomp = (JComponent) comp; if (renderer instanceof DefaultTableCellRenderer) { String toolTip = ((DefaultTableCellRenderer) renderer).getToolTipText(); if (!StringUtils.isEmpty(toolTip)) { jcomp.setToolTipText(toolTip); } } return comp; } }; // Table properties table.setRowHeight(UI.TABLE_ROW_HEIGHT); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setShowGrid(false); table.setShowHorizontalLines(true); table.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); // Rollover MouseInputAdapter rolloverListener = new MouseInputAdapter() { @Override public void mouseExited(MouseEvent e) { rollOverRowIndex.put(keyIdx, -1); table.repaint(); } @Override public void mouseMoved(MouseEvent e) { int row = table.rowAtPoint(e.getPoint()); if (row != rollOverRowIndex.get(keyIdx)) { rollOverRowIndex.put(keyIdx, row); table.repaint(); } } }; table.addMouseMotionListener(rolloverListener); table.addMouseListener(rolloverListener); // Header if (!showHeader) { table.setTableHeader(null); } return table; }
From source file:edu.harvard.mcz.imagecapture.ImageCaptureApp.java
/** * Carry out actions to set user interface into nobody logged in yet state. */// ww w. jav a 2 s . c o m public static void doStartUpNot() { Singleton.getSingletonInstance().getMainFrame().setStatusMessage("Select File/Change User to login."); Singleton.getSingletonInstance().getMainFrame() .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); Singleton.getSingletonInstance().getMainFrame().setState(MainFrame.STATE_RESET); }