Package org.tools.ui.notification

Examples of org.tools.ui.notification.NotificationDialog


     * @param message
     * @param black
     */
    public void scheduleInfoMessage(String message) {
        // make new notification
        NotificationDialog dlg = NotificationFactory.createInfoNotification(message, frame, Color.white, Color.black);
        // add listener that displays the next notification
        dlg.addNotificationListener(new NotificationListener() {
            @Override
            public void notificationResult(boolean value) {
                // TODO notifications must be non-empty

                // remove ourselves
                notifications.remove();
                // if there is another one, set it visible
                if (!notifications.isEmpty()) {
                    notifications.peek().setVisible();
                }
            }
        });
        // add it to the list of notifications and set it visible if it is the actual one
        notifications.add(dlg);
        if (notifications.peek() == dlg) {
            dlg.setVisible();
        }

    }
View Full Code Here


     * @param evt parameter
     */
    private void showDialogButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_showDialogButtonActionPerformed
        // get the message
        String message = messageTextField.getText();
        NotificationDialog dlg = NotificationFactory.createStandardNotification(message, this);
        dlg.addNotificationListener(this);

        dlg.setFadeInTime(0);
        dlg.setFadeOutTime(0);
        dlg.setOnTime(0);

        // get the decoration
        int decorationIndex = decorationComboBox.getSelectedIndex();

        if (fadeInToggleButton.isSelected()) {
            int fadeInTime = Integer.parseInt(fadeInTextField.getText()) * 1000; // conversion seconds to ms
            dlg.setFadeInTime(fadeInTime);
        }

        if (fadeOutToggleButton.isSelected()) {
            int fadeOutTime = Integer.parseInt(fadeOutTextField.getText()) * 1000;
            dlg.setFadeOutTime(fadeOutTime);
        }

        int onTime = Integer.parseInt(onTimeTextField.getText()) * 1000;
        if (onTime > 0) {
            dlg.setOnTime(onTime);
        }

        // get the position handling
        if (framePositionRadioButton.isSelected()) {
            WindowCorner corner = WindowCorner.NorthWest;
            switch (frameOrientationComboBox.getSelectedIndex()) {
                case 1:
                    corner = WindowCorner.NorthEast;
                    break;
                case 2:
                    corner = WindowCorner.SouthWest;
                    break;
                case 3:
                    corner = WindowCorner.SouthEast;
                    break;
            }
            dlg.setLocationRelativeTo(this, RelativeLayoutConstraint.corner(corner, 5, 5));


        } else if (desktopPositionRadioButton.isSelected()) {
            WindowCorner corner = WindowCorner.NorthWest;
            switch (desktopOrientationComboBox.getSelectedIndex()) {
                case 1:
                    corner = WindowCorner.NorthEast;
                    break;
                case 2:
                    corner = WindowCorner.SouthWest;
                    break;
                case 3:
                    corner = WindowCorner.SouthEast;
                    break;
            }
            dlg.setLocationRelativeToDesktop(corner, 5, 5);
        }

        dlg.setVisible();
    }//GEN-LAST:event_showDialogButtonActionPerformed
View Full Code Here

TOP

Related Classes of org.tools.ui.notification.NotificationDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.