Example usage for java.awt Cursor getPredefinedCursor

List of usage examples for java.awt Cursor getPredefinedCursor

Introduction

In this page you can find the example usage for java.awt Cursor getPredefinedCursor.

Prototype

public static Cursor getPredefinedCursor(int type) 

Source Link

Document

Returns a cursor object with the specified predefined type.

Usage

From source file:de.bfs.radon.omsimulation.gui.OMPanelData.java

/**
 * Initialises the interface of the data panel.
 *///www.j a v  a 2 s  . com
protected void initialize() {
    setLayout(null);

    lblExportChartTo = new JLabel("Export chart to ...");
    lblExportChartTo.setBounds(436, 479, 144, 14);
    lblExportChartTo.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblExportChartTo.setVisible(false);
    add(lblExportChartTo);

    btnCsv = new JButton("CSV");
    btnCsv.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.csv", "csv"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String csv;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("csv")) {
                    csv = "";
                } else {
                    csv = ".csv";
                }
                String csvPath = file.getAbsolutePath() + csv;
                OMRoom selectedRoom = (OMRoom) comboBoxRooms.getSelectedItem();
                double[] selectedValues = selectedRoom.getValues();
                File csvFile = new File(csvPath);
                try {
                    FileWriter logWriter = new FileWriter(csvFile);
                    BufferedWriter csvOutput = new BufferedWriter(logWriter);
                    csvOutput.write("\"ID\";\"" + selectedRoom.getId() + "\"");
                    csvOutput.newLine();
                    for (int i = 0; i < selectedValues.length; i++) {
                        csvOutput.write("\"" + i + "\";\"" + (int) selectedValues[i] + "\"");
                        csvOutput.newLine();
                    }
                    JOptionPane.showMessageDialog(null, "CSV saved successfully!\n" + csvPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                    csvOutput.close();
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write CSV. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write CSV. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnCsv.setBounds(590, 475, 70, 23);
    btnCsv.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnCsv.setVisible(false);
    add(btnCsv);

    btnPdf = new JButton("PDF");
    btnPdf.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.pdf", "pdf"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String pdf;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("pdf")) {
                    pdf = "";
                } else {
                    pdf = ".pdf";
                }
                String pdfPath = file.getAbsolutePath() + pdf;
                OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                String title = building.getName();
                OMRoom selectedRoom = (OMRoom) comboBoxRooms.getSelectedItem();
                JFreeChart chart = OMCharts.createRoomChart(title, selectedRoom, false);
                int height = (int) PageSize.A4.getWidth();
                int width = (int) PageSize.A4.getHeight();
                try {
                    OMExports.exportPdf(pdfPath, chart, width, height, new DefaultFontMapper(), title);
                    JOptionPane.showMessageDialog(null, "PDF saved successfully!\n" + pdfPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write PDF. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write PDF. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnPdf.setBounds(670, 475, 70, 23);
    btnPdf.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnPdf.setVisible(false);
    add(btnPdf);

    lblSelectProject = new JLabel("Select Project");
    lblSelectProject.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectProject.setBounds(10, 65, 132, 14);
    add(lblSelectProject);

    lblSelectRoom = new JLabel("Select Room");
    lblSelectRoom.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectRoom.setBounds(10, 94, 132, 14);
    add(lblSelectRoom);

    panelData = new JPanel();
    panelData.setBounds(10, 118, 730, 347);
    add(panelData);

    btnRefresh = new JButton("Load");
    btnRefresh.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (txtOmbFile.getText() != null && !txtOmbFile.getText().equals("")
                    && !txtOmbFile.getText().equals(" ")) {
                txtOmbFile.setBackground(Color.WHITE);
                String ombPath = txtOmbFile.getText();
                String omb;
                String[] tmpFileName = ombPath.split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("omb")) {
                    omb = "";
                } else {
                    omb = ".omb";
                }
                txtOmbFile.setText(ombPath + omb);
                setOmbFile(ombPath + omb);
                File ombFile = new File(ombPath + omb);
                if (ombFile.exists()) {
                    txtOmbFile.setBackground(Color.WHITE);
                    btnRefresh.setEnabled(false);
                    comboBoxProjects.setEnabled(false);
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    btnPdf.setVisible(false);
                    btnCsv.setVisible(false);
                    lblExportChartTo.setVisible(false);
                    progressBar.setVisible(true);
                    progressBar.setStringPainted(true);
                    progressBar.setIndeterminate(true);
                    refreshProjectsTask = new RefreshProjects();
                    refreshProjectsTask.execute();
                } else {
                    txtOmbFile.setBackground(new Color(255, 222, 222, 128));
                    JOptionPane.showMessageDialog(null, "OMB-file not found, please check the file path!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                }
            } else {
                txtOmbFile.setBackground(new Color(255, 222, 222, 128));
                JOptionPane.showMessageDialog(null, "Please select an OMB-file!", "Warning",
                        JOptionPane.WARNING_MESSAGE);
            }
        }
    });
    btnRefresh.setBounds(616, 61, 124, 23);
    add(btnRefresh);

    btnMaximize = new JButton("Fullscreen");
    btnMaximize.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnMaximize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxRooms.isEnabled()) {
                if (comboBoxRooms.getSelectedItem() != null) {
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    String title = building.getName();
                    OMRoom room = (OMRoom) comboBoxRooms.getSelectedItem();
                    panelRoom = createRoomPanel(title, room, false, false);
                    JFrame chartFrame = new JFrame();
                    JPanel chartPanel = createRoomPanel(title, room, false, true);
                    chartFrame.getContentPane().add(chartPanel);
                    chartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                    chartFrame.setBounds(0, 0, (int) dim.getWidth(), (int) dim.getHeight());
                    chartFrame.setTitle("OM Simulation Tool: " + title + ", Room " + room.getId());
                    chartFrame.setResizable(true);
                    chartFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                    chartFrame.setVisible(true);
                }
            }
        }
    });
    btnMaximize.setBounds(10, 475, 124, 23);
    btnMaximize.setVisible(false);
    add(btnMaximize);

    comboBoxProjects = new JComboBox<OMBuilding>();
    comboBoxProjects.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    comboBoxProjects.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            boolean b = false;
            Color c = null;
            if (comboBoxProjects.isEnabled()) {
                if (comboBoxProjects.getSelectedItem() != null) {
                    b = true;
                    c = Color.WHITE;
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    comboBoxRooms.removeAllItems();
                    for (int i = 0; i < building.getRooms().length; i++) {
                        comboBoxRooms.addItem(building.getRooms()[i]);
                    }
                    for (int i = 0; i < building.getCellars().length; i++) {
                        comboBoxRooms.addItem(building.getCellars()[i]);
                    }
                    for (int i = 0; i < building.getMiscs().length; i++) {
                        comboBoxRooms.addItem(building.getMiscs()[i]);
                    }
                } else {
                    b = false;
                    c = null;
                }
            } else {
                b = false;
                c = null;
            }
            lblSelectRoom.setEnabled(b);
            panelData.setEnabled(b);
            btnMaximize.setVisible(b);
            comboBoxRooms.setEnabled(b);
            panelData.setBackground(c);
        }
    });
    comboBoxProjects.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            boolean b = false;
            Color c = null;
            if (comboBoxProjects.isEnabled()) {
                if (comboBoxProjects.getSelectedItem() != null) {
                    b = true;
                    c = Color.WHITE;
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    comboBoxRooms.removeAllItems();
                    for (int i = 0; i < building.getRooms().length; i++) {
                        comboBoxRooms.addItem(building.getRooms()[i]);
                    }
                    for (int i = 0; i < building.getCellars().length; i++) {
                        comboBoxRooms.addItem(building.getCellars()[i]);
                    }
                    for (int i = 0; i < building.getMiscs().length; i++) {
                        comboBoxRooms.addItem(building.getMiscs()[i]);
                    }
                } else {
                    b = false;
                    c = null;
                }
            } else {
                b = false;
                c = null;
            }
            lblSelectRoom.setEnabled(b);
            panelData.setEnabled(b);
            btnMaximize.setVisible(b);
            comboBoxRooms.setEnabled(b);
            panelData.setBackground(c);
        }
    });
    comboBoxProjects.setBounds(152, 61, 454, 22);
    add(comboBoxProjects);

    comboBoxRooms = new JComboBox<OMRoom>();
    comboBoxRooms.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    comboBoxRooms.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxRooms.isEnabled()) {
                if (comboBoxRooms.getSelectedItem() != null) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    remove(panelData);
                    comboBoxRooms.setEnabled(false);
                    refreshChartsTask = new RefreshCharts();
                    refreshChartsTask.execute();
                }
            }
        }
    });
    comboBoxRooms.setBounds(152, 90, 454, 22);
    add(comboBoxRooms);

    progressBar = new JProgressBar();
    progressBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    progressBar.setBounds(10, 475, 730, 23);
    progressBar.setVisible(false);
    add(progressBar);

    lblSelectRoom.setEnabled(false);
    panelData.setEnabled(false);
    comboBoxRooms.setEnabled(false);

    lblHelp = new JLabel(
            "Select an OMB-Object file to analyse its data. You can inspect radon concentration for each room.");
    lblHelp.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblHelp.setForeground(Color.GRAY);
    lblHelp.setBounds(10, 10, 730, 14);
    add(lblHelp);

    txtOmbFile = new JTextField();
    txtOmbFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    txtOmbFile.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            setOmbFile(txtOmbFile.getText());
        }
    });
    txtOmbFile.setBounds(152, 33, 454, 20);
    add(txtOmbFile);
    txtOmbFile.setColumns(10);

    btnBrowse = new JButton("Browse");
    btnBrowse.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.omb", "omb"));
            fileDialog.showOpenDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String omb;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("omb")) {
                    omb = "";
                } else {
                    omb = ".omb";
                }
                txtOmbFile.setText(file.getAbsolutePath() + omb);
                setOmbFile(file.getAbsolutePath() + omb);
            }
        }
    });
    btnBrowse.setBounds(616, 32, 124, 23);
    add(btnBrowse);

    lblSelectOmbfile = new JLabel("Select OMB-File");
    lblSelectOmbfile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectOmbfile.setBounds(10, 36, 132, 14);
    add(lblSelectOmbfile);
}

From source file:DragDropTreeExample.java

public void drop(DropTargetDropEvent dtde) {
    DnDUtils.debugPrintln("DropTarget drop, drop action = " + DnDUtils.showActions(dtde.getDropAction()));

    // Check the drop action
    if ((dtde.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0) {
        // Accept the drop and get the transfer data
        dtde.acceptDrop(dtde.getDropAction());
        Transferable transferable = dtde.getTransferable();
        boolean dropSucceeded = false;

        try {//from  w  w w  . ja  v  a  2  s.  co  m
            tree.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            // Save the user's selections
            saveTreeSelection();

            dropSucceeded = dropFile(dtde.getDropAction(), transferable, dtde.getLocation());

            DnDUtils.debugPrintln("Drop completed, success: " + dropSucceeded);
        } catch (Exception e) {
            DnDUtils.debugPrintln("Exception while handling drop " + e);
        } finally {
            tree.setCursor(Cursor.getDefaultCursor());

            // Restore the user's selections
            restoreTreeSelection();
            dtde.dropComplete(dropSucceeded);
        }
    } else {
        DnDUtils.debugPrintln("Drop target rejected drop");
        dtde.dropComplete(false);
    }
}

From source file:com.ivli.roim.controls.ChartControl.java

@Override
public void mouseMoved(MouseEvent e) {
    super.mouseMoved(e);

    if (null == iEntity && null == iMarker) {
        ChartEntity entity = findEntity(e);
        if (entity instanceof XYItemEntity) {
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        } else if (entity instanceof PlotEntity) {

            if (null != findMarker(e))
                setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            else/*ww  w  . j a va 2 s  .  c o  m*/
                setCursor(Cursor.getDefaultCursor());
        } else {
            setCursor(Cursor.getDefaultCursor());
        }
    }
}

From source file:net.technicpack.launcher.ui.LauncherFrame.java

private void initComponents() {
    BorderLayout layout = new BorderLayout();
    setLayout(layout);/*from w  w  w. j a  va 2 s .co  m*/

    /////////////////////////////////////////////////////////////
    //HEADER
    /////////////////////////////////////////////////////////////
    JPanel header = new JPanel();
    header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
    header.setBackground(COLOR_BLUE);
    header.setForeground(COLOR_WHITE_TEXT);
    header.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 10));
    this.add(header, BorderLayout.PAGE_START);

    ImageIcon headerIcon = resources.getIcon("platform_icon_title.png");
    JButton headerLabel = new JButton(headerIcon);
    headerLabel.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0));
    headerLabel.setContentAreaFilled(false);
    headerLabel.setFocusPainted(false);
    headerLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    headerLabel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DesktopUtils.browseUrl("http://beta.technicpack.net/");
        }
    });
    header.add(headerLabel);

    header.add(Box.createRigidArea(new Dimension(6, 0)));

    ActionListener tabListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectTab(e.getActionCommand());
        }
    };

    discoverTab = new HeaderTab(resources.getString("launcher.title.discover"), resources);
    header.add(discoverTab);
    discoverTab.setActionCommand(TAB_DISCOVER);
    discoverTab.addActionListener(tabListener);

    modpacksTab = new HeaderTab(resources.getString("launcher.title.modpacks"), resources);
    modpacksTab.setIsActive(true);
    modpacksTab.setHorizontalTextPosition(SwingConstants.LEADING);
    modpacksTab.addActionListener(tabListener);
    modpacksTab.setActionCommand(TAB_MODPACKS);
    header.add(modpacksTab);

    newsTab = new HeaderTab(resources.getString("launcher.title.news"), resources);
    newsTab.setLayout(null);
    newsTab.addActionListener(tabListener);
    newsTab.setActionCommand(TAB_NEWS);
    header.add(newsTab);

    CountCircle newsCircle = new CountCircle();
    newsCircle.setBackground(COLOR_RED);
    newsCircle.setForeground(COLOR_WHITE_TEXT);
    newsCircle.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS_BOLD, 14));
    newsTab.add(newsCircle);
    newsCircle.setBounds(10, 17, 25, 25);

    header.add(Box.createHorizontalGlue());

    JPanel rightHeaderPanel = new JPanel();
    rightHeaderPanel.setOpaque(false);
    rightHeaderPanel.setLayout(new BoxLayout(rightHeaderPanel, BoxLayout.PAGE_AXIS));
    rightHeaderPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    JPanel windowGadgetPanel = new JPanel();
    windowGadgetPanel.setOpaque(false);
    windowGadgetPanel.setLayout(new BoxLayout(windowGadgetPanel, BoxLayout.LINE_AXIS));
    windowGadgetPanel.setAlignmentX(RIGHT_ALIGNMENT);

    ImageIcon minimizeIcon = resources.getIcon("minimize.png");
    JButton minimizeButton = new JButton(minimizeIcon);
    minimizeButton.setBorder(BorderFactory.createEmptyBorder());
    minimizeButton.setContentAreaFilled(false);
    minimizeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    minimizeButton.setFocusable(false);
    minimizeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            minimizeWindow();
        }
    });
    windowGadgetPanel.add(minimizeButton);

    ImageIcon closeIcon = resources.getIcon("close.png");
    JButton closeButton = new JButton(closeIcon);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            closeWindow();
        }
    });
    closeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    closeButton.setFocusable(false);
    windowGadgetPanel.add(closeButton);

    rightHeaderPanel.add(windowGadgetPanel);
    rightHeaderPanel.add(Box.createVerticalGlue());

    JButton launcherOptionsLabel = new JButton(resources.getString("launcher.title.options"));
    launcherOptionsLabel.setIcon(resources.getIcon("options_cog.png"));
    launcherOptionsLabel.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 14));
    launcherOptionsLabel.setForeground(COLOR_WHITE_TEXT);
    launcherOptionsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    launcherOptionsLabel.setHorizontalTextPosition(SwingConstants.LEADING);
    launcherOptionsLabel.setAlignmentX(RIGHT_ALIGNMENT);
    launcherOptionsLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    launcherOptionsLabel.setBorder(BorderFactory.createEmptyBorder());
    launcherOptionsLabel.setContentAreaFilled(false);
    launcherOptionsLabel.setFocusPainted(false);
    launcherOptionsLabel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openLauncherOptions();
        }
    });
    rightHeaderPanel.add(launcherOptionsLabel);

    header.add(rightHeaderPanel);

    /////////////////////////////////////////////////////////////
    // CENTRAL AREA
    /////////////////////////////////////////////////////////////
    centralPanel = new TintablePanel();
    centralPanel.setBackground(COLOR_CHARCOAL);
    centralPanel.setForeground(COLOR_WHITE_TEXT);
    centralPanel.setTintColor(COLOR_CENTRAL_BACK);
    this.add(centralPanel, BorderLayout.CENTER);
    centralPanel.setLayout(new BorderLayout());

    modpackPanel = new ModpackInfoPanel(resources, iconRepo, logoRepo, backgroundRepo, avatarRepo,
            new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    openModpackOptions((ModpackModel) e.getSource());
                }
            }, new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    refreshModpackOptions((ModpackModel) e.getSource());
                }
            });
    modpackSelector.setInfoPanel(modpackPanel);
    playButton = modpackPanel.getPlayButton();
    playButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof ModpackModel) {
                setupPlayButtonText((ModpackModel) e.getSource(), userModel.getCurrentUser());
            } else if (installer.isCurrentlyRunning()) {
                installer.cancel();
                setupPlayButtonText(modpackSelector.getSelectedPack(), userModel.getCurrentUser());
            } else {
                launchModpack();
            }
        }
    });

    modpackPanel.getDeleteButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (JOptionPane.showConfirmDialog(LauncherFrame.this,
                    resources.getString("modpackoptions.delete.confirmtext"),
                    resources.getString("modpackoptions.delete.confirmtitle"),
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                modpackSelector.getSelectedPack().delete();
                modpackSelector.forceRefresh();
            }
        }
    });

    infoSwap = new JPanel();
    infoLayout = new CardLayout();
    infoSwap.setLayout(infoLayout);
    infoSwap.setOpaque(false);
    newsInfoPanel = new NewsInfoPanel(resources, avatarRepo);
    infoSwap.add(discoverInfoPanel, "discover");

    JPanel newsHost = new JPanel();
    infoSwap.add(newsHost, "news");
    JPanel modpackHost = new JPanel();
    infoSwap.add(modpackHost, "modpacks");
    centralPanel.add(infoSwap, BorderLayout.CENTER);

    newsSelector = new NewsSelector(resources, newsInfoPanel, platformApi, avatarRepo, newsCircle, settings);
    newsHost.setLayout(new BorderLayout());
    newsHost.add(newsInfoPanel, BorderLayout.CENTER);
    newsHost.add(newsSelector, BorderLayout.WEST);

    modpackHost.setLayout(new BorderLayout());
    modpackHost.add(modpackPanel, BorderLayout.CENTER);
    modpackHost.add(modpackSelector, BorderLayout.WEST);

    footer = new TintablePanel();
    footer.setTintColor(COLOR_CENTRAL_BACK);
    footer.setBackground(COLOR_FOOTER);
    footer.setLayout(new BoxLayout(footer, BoxLayout.LINE_AXIS));
    footer.setForeground(COLOR_WHITE_TEXT);
    footer.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 12));

    userWidget = new UserWidget(resources, skinRepository);
    userWidget.setMaximumSize(userWidget.getPreferredSize());
    footer.add(userWidget);

    JLabel dashText = new JLabel("| ");
    dashText.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    dashText.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15));
    footer.add(dashText);

    JButton logout = new JButton(resources.getString("launcher.user.logout"));
    logout.setBorder(BorderFactory.createEmptyBorder());
    logout.setContentAreaFilled(false);
    logout.setFocusable(false);
    logout.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    logout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    logout.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 15));
    logout.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            logout();
        }
    });
    footer.add(logout);

    installProgress = new ProgressBar();
    installProgress.setForeground(Color.white);
    installProgress.setBackground(LauncherFrame.COLOR_GREEN);
    installProgress.setBorder(BorderFactory.createEmptyBorder(5, 45, 4, 45));
    installProgress.setIcon(resources.getIcon("download_icon.png"));
    installProgress.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 12));
    installProgress.setVisible(false);
    footer.add(installProgress);

    installProgressPlaceholder = Box.createHorizontalGlue();
    footer.add(installProgressPlaceholder);

    JLabel buildCtrl = new JLabel(resources.getString("launcher.build.text", resources.getLauncherBuild(),
            resources.getString("launcher.build." + settings.getBuildStream())));
    buildCtrl.setForeground(COLOR_WHITE_TEXT);
    buildCtrl.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    buildCtrl.setHorizontalTextPosition(SwingConstants.RIGHT);
    buildCtrl.setHorizontalAlignment(SwingConstants.RIGHT);
    footer.add(buildCtrl);

    this.add(footer, BorderLayout.PAGE_END);
}

From source file:org.docx4all.ui.main.WordMLEditor.java

public void showViewInTab(final String tabTitle) {
    if (getCurrentInternalFrame() != null) {
        Cursor origCursor = getMainFrame().getCursor();
        getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        getCurrentViewManager().showViewTab(tabTitle);

        getMainFrame().setCursor(origCursor);
    }/*from  w  ww . j av a  2 s  .  c o m*/
}

From source file:javazoom.jlgui.player.amp.visual.ui.SpectrumTimeAnalyzer.java

private void prepareDisplayToggleListener() {
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent pEvent) {
            if (pEvent.getButton() == MouseEvent.BUTTON1) {
                if (displayMode + 1 > 1) {
                    displayMode = 0;//  ww w . j ava  2 s . com
                } else {
                    displayMode++;
                }
            }
        }
    });
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.browser.BrowserModel.java

/**
 * Implemented as specified by the {@link Browser} interface.
 * @see Browser#resetChildDisplay()//from w  ww  . j a v a 2s . c o m
 */
public void resetChildDisplay() {
    rootDisplay.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    Collection<ImageDisplay> rootChildren = rootDisplay.getChildrenDisplay();
    JComponent desktop = rootDisplay.getInternalDesktop();
    desktop.removeAll();
    Iterator<ImageDisplay> i;
    switch (selectedLayout.getIndex()) {
    case LayoutFactory.SQUARY_LAYOUT:
        i = rootChildren.iterator();
        ImageDisplay child;
        while (i.hasNext()) {
            child = i.next();
            desktop.add(child);
            addToDesktop(child);
        }
        break;

    case LayoutFactory.FLAT_LAYOUT:
        i = getImageNodes().iterator();
        while (i.hasNext())
            desktop.add(i.next());
    }
    rootDisplay.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:com.ivli.roim.controls.ChartControl.java

@Override
public void mousePressed(MouseEvent e) {
    ChartEntity entity = findEntity(e);/*  ww w .j av  a  2  s.  c  om*/

    if (entity instanceof XYItemEntity) {
        selectItem(entity);
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else if (null != (iMarker = findMarker(e))) {
        if (SwingUtilities.isLeftMouseButton(e))
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else
        super.mousePressed(e);
}

From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

private void rebuildSigmaProfiles() {
    if (listModel.getSize() == 0) {
        if (err == true) {
            err = false;//  ww  w  .  j a v  a 2 s .  co m
            return;
        }
        JOptionPane.showMessageDialog(this, "Select compounds.", "Error", JOptionPane.OK_OPTION);
        return;
    }

    int num = listModel.getSize();
    COSMOSACCompound[] c = new COSMOSACCompound[num];
    double[][] area = new double[num][];
    double[][] charge = new double[num][];
    XYSeriesCollection dataset = new XYSeriesCollection();

    for (int i = 0; i < num; i++) {
        try {
            c[i] = db.getComp((String) listModel.getElementAt(i));
        } catch (SQLException e1) {
            e1.printStackTrace();
            return;
        }
    }

    COSMOSAC cosmosac = (COSMOSAC) modelBox.getSelectedItem();
    try {
        cosmosac.setComponents(c);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);

    for (int i = 0; i < num; i++) {

        if (c[i] == null)
            return;

        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        area[i] = c[i].area;
        charge[i] = c[i].charge;

        int n = charge[0].length;
        XYSeries comp = new XYSeries(c[i].name);

        // charges represent the center of the segments
        comp.add(charge[i][0], area[i][0]);
        for (int j = 1; j < n; ++j) {
            comp.add(charge[i][j] - (charge[i][j] - charge[i][j - 1]) / 2, area[i][j]);
        }

        double areaT = 0;
        double absSigmaAvg = 0;
        double sigmaAvg2 = 0;
        for (int j = 1; j < n; ++j) {
            areaT += area[i][j];
            absSigmaAvg += area[i][j] * Math.abs(charge[i][j]);
            sigmaAvg2 += area[i][j] * charge[i][j] * charge[i][j];
        }
        absSigmaAvg /= areaT;
        sigmaAvg2 /= areaT;
        comp.setKey(c[i].name + " (A=" + nf.format(areaT) + ", |sigma|=" + nf.format(absSigmaAvg * 1000)
                + ", |sigma|2=" + nf.format(sigmaAvg2 * 10000) + ")");

        dataset.addSeries(comp);
        sigmaProfilePlot.setRenderer(i, stepRenderer);
        sigmaProfilePlot.getRenderer().setSeriesStroke(i, new BasicStroke(2.5f));
    }
    sigmaProfilePlot.setDataset(dataset);

    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.sleuthkit.autopsy.keywordsearch.ExtractedContentViewer.java

private void nextPage() {
    if (currentSource.hasNextPage()) {
        currentSource.nextPage();/*from  w  ww .  j a v a 2 s .  co  m*/

        //set new text
        panel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        panel.refreshCurrentMarkup();
        panel.setCursor(null);

        //update display
        panel.updateCurrentPageDisplay(currentSource.getCurrentPage());

        //scroll to current selection
        ExtractedContentViewer.this.scrollToCurrentHit();

        //update controls if needed
        if (!currentSource.hasNextPage()) {
            panel.enableNextPageControl(false);
        }
        if (currentSource.hasPreviousPage()) {
            panel.enablePrevPageControl(true);
        }

        updateSearchControls();
    }
}