Search in sources :

Example 46 with JProgressBar

use of javax.swing.JProgressBar in project jabref by JabRef.

the class FindUnlinkedFilesDialog method initComponents.

/**
     * Initializes the visible components in this dialog.
     */
private void initComponents() {
    this.addComponentListener(dialogPositionListener);
    /* Interrupts the searchThread by setting the State-Array to 0 */
    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            threadState.set(false);
        }
    });
    panelDirectory = new JPanel();
    panelSearchArea = new JPanel();
    panelFiles = new JPanel();
    panelOptions = new JPanel();
    panelEntryTypesSelection = new JPanel();
    panelButtons = new JPanel();
    panelImportArea = new JPanel();
    buttonBrowse = new JButton(Localization.lang("Browse"));
    buttonBrowse.setMnemonic('B');
    buttonBrowse.setToolTipText(Localization.lang("Opens the file browser."));
    buttonScan = new JButton(Localization.lang("Scan directory"));
    buttonScan.setMnemonic('S');
    buttonScan.setToolTipText(Localization.lang("Searches the selected directory for unlinked files."));
    buttonApply = new JButton(Localization.lang("Apply"));
    buttonApply.setMnemonic('I');
    buttonApply.setToolTipText(Localization.lang("Starts the import of BibTeX entries."));
    buttonClose = new JButton(Localization.lang("Close"));
    buttonClose.setToolTipText(Localization.lang("Leave this dialog."));
    buttonClose.setMnemonic('C');
    /* Options for the TreeView */
    buttonOptionSelectAll = new JButton();
    buttonOptionSelectAll.setMnemonic('A');
    buttonOptionSelectAll.setAction(actionSelectAll);
    buttonOptionDeselectAll = new JButton();
    buttonOptionDeselectAll.setMnemonic('U');
    buttonOptionDeselectAll.setAction(actionUnselectAll);
    buttonOptionExpandAll = new JButton();
    buttonOptionExpandAll.setMnemonic('E');
    buttonOptionExpandAll.setAction(actionExpandTree);
    buttonOptionCollapseAll = new JButton();
    buttonOptionCollapseAll.setMnemonic('L');
    buttonOptionCollapseAll.setAction(actionCollapseTree);
    checkboxCreateKeywords = new JCheckBox(Localization.lang("Create directory based keywords"));
    checkboxCreateKeywords.setToolTipText(Localization.lang("Creates keywords in created entrys with directory pathnames"));
    checkboxCreateKeywords.setSelected(checkBoxWhyIsThereNoGetSelectedStupidSwing);
    checkboxCreateKeywords.addItemListener(e -> checkBoxWhyIsThereNoGetSelectedStupidSwing = !checkBoxWhyIsThereNoGetSelectedStupidSwing);
    textfieldDirectoryPath = new JTextField();
    textfieldDirectoryPath.setText(lastSelectedDirectory == null ? "" : lastSelectedDirectory.toAbsolutePath().toString());
    labelDirectoryDescription = new JLabel(Localization.lang("Select a directory where the search shall start."));
    labelFileTypesDescription = new JLabel(Localization.lang("Select file type:"));
    labelFilesDescription = new JLabel(Localization.lang("These files are not linked in the active library."));
    labelEntryTypeDescription = new JLabel(Localization.lang("Entry type to be created:"));
    labelSearchingDirectoryInfo = new JLabel(Localization.lang("Searching file system..."));
    labelSearchingDirectoryInfo.setHorizontalAlignment(SwingConstants.CENTER);
    labelSearchingDirectoryInfo.setVisible(false);
    labelImportingInfo = new JLabel(Localization.lang("Importing into Library..."));
    labelImportingInfo.setHorizontalAlignment(SwingConstants.CENTER);
    labelImportingInfo.setVisible(false);
    tree = new JTree();
    scrollpaneTree = new JScrollPane(tree);
    scrollpaneTree.setWheelScrollingEnabled(true);
    progressBarSearching = new JProgressBar();
    progressBarSearching.setIndeterminate(true);
    progressBarSearching.setVisible(false);
    progressBarSearching.setStringPainted(true);
    progressBarImporting = new JProgressBar();
    progressBarImporting.setIndeterminate(false);
    progressBarImporting.setVisible(false);
    progressBarImporting.setStringPainted(true);
}
Also used : JCheckBox(javax.swing.JCheckBox) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTree(javax.swing.JTree) WindowEvent(java.awt.event.WindowEvent) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) WindowAdapter(java.awt.event.WindowAdapter) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField)

Example 47 with JProgressBar

use of javax.swing.JProgressBar in project JMRI by JMRI.

the class ThrottlesTableCellRenderer method getTableCellRendererComponent.

@Override
public Component getTableCellRendererComponent(JTable jtable, Object value, boolean bln, boolean bln1, int i, int i1) {
    JPanel retPanel = new JPanel();
    retPanel.setLayout(new BorderLayout());
    if (value == null) {
        return retPanel;
    }
    ThrottleFrame tf = (ThrottleFrame) value;
    ImageIcon icon = null;
    String text = null;
    if (tf.getRosterEntry() != null) {
        icon = iconFactory.getIcon(tf.getAddressPanel().getRosterEntry());
        text = tf.getAddressPanel().getRosterEntry().getId();
    } else if ((tf.getAddressPanel().getCurrentAddress() != null) && (tf.getAddressPanel().getThrottle() != null)) {
        if (tf.getAddressPanel().getCurrentAddress().getNumber() == 0) {
            text = Bundle.getMessage("ThrottleDCControl") + " - " + tf.getAddressPanel().getCurrentAddress();
        } else if (tf.getAddressPanel().getCurrentAddress().getNumber() == 3) {
            text = Bundle.getMessage("ThrottleDCCControl") + " - " + tf.getAddressPanel().getCurrentAddress();
        } else {
            text = Bundle.getMessage("ThrottleAddress") + " " + tf.getAddressPanel().getCurrentAddress();
        }
    } else {
        text = Bundle.getMessage("ThrottleNotAssigned");
    }
    if (icon != null) {
        icon.setImageObserver(jtable);
    }
    JLabel locoID = new JLabel();
    locoID.setHorizontalAlignment(JLabel.CENTER);
    locoID.setVerticalAlignment(JLabel.CENTER);
    locoID.setIcon(icon);
    locoID.setText(text);
    retPanel.add(locoID, BorderLayout.CENTER);
    if (tf.getAddressPanel().getThrottle() != null) {
        JPanel ctrlPanel = new JPanel();
        ctrlPanel.setLayout(new BorderLayout());
        Throttle thr = tf.getAddressPanel().getThrottle();
        JLabel dir = new JLabel();
        if (jmri.jmrit.throttle.ThrottleFrameManager.instance().getThrottlesPreferences().isUsingExThrottle() && jmri.jmrit.throttle.ThrottleFrameManager.instance().getThrottlesPreferences().isUsingFunctionIcon()) {
            if (thr.getIsForward()) {
                dir.setIcon(fwdIcon);
            } else {
                dir.setIcon(bckIcon);
            }
        } else {
            if (thr.getIsForward()) {
                dir.setText(Bundle.getMessage("ButtonForward"));
            } else {
                dir.setText(Bundle.getMessage("ButtonReverse"));
            }
        }
        dir.setVerticalAlignment(JLabel.CENTER);
        ctrlPanel.add(dir, BorderLayout.WEST);
        if (jmri.jmrit.throttle.ThrottleFrameManager.instance().getThrottlesPreferences().isUsingExThrottle() && jmri.jmrit.throttle.ThrottleFrameManager.instance().getThrottlesPreferences().isUsingFunctionIcon()) {
            if (thr.getSpeedSetting() == -1) {
                JLabel estop = new JLabel();
                estop.setPreferredSize(new Dimension(64, height - 8));
                estop.setHorizontalAlignment(JLabel.CENTER);
                estop.setIcon(estopIcon);
                ctrlPanel.add(estop, BorderLayout.CENTER);
            } else {
                JProgressBar speedBar = new javax.swing.JProgressBar();
                speedBar.setPreferredSize(new Dimension(64, height - 8));
                speedBar.setMinimum(0);
                speedBar.setMaximum(100);
                speedBar.setValue((int) (thr.getSpeedSetting() * 100f));
                ctrlPanel.add(speedBar, BorderLayout.CENTER);
            }
        } else {
            JLabel speedLabel = new JLabel("");
            if (thr.getSpeedSetting() == -1) {
                speedLabel.setText(" " + Bundle.getMessage("ButtonEStop") + " ");
            } else {
                speedLabel.setText(" " + (int) (thr.getSpeedSetting() * 100f) + "% ");
            }
            ctrlPanel.add(speedLabel, BorderLayout.CENTER);
        }
        retPanel.add(ctrlPanel, BorderLayout.EAST);
    }
    retPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    return retPanel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) BorderLayout(java.awt.BorderLayout) JProgressBar(javax.swing.JProgressBar) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Throttle(jmri.Throttle)

Example 48 with JProgressBar

use of javax.swing.JProgressBar in project jdk8u_jdk by JetBrains.

the class ProgressBarMemoryLeakTest method showUI.

private static void showUI() {
    sFrame = new JFrame();
    JProgressBar progressBar = new JProgressBar();
    progressBar.setVisible(false);
    progressBar.setIndeterminate(false);
    progressBar.setIndeterminate(true);
    progressBar.setIndeterminate(false);
    progressBar.setValue(10);
    progressBar.setString("Progress");
    sFrame.add(progressBar);
    sProgressBar = new WeakReference<>(progressBar);
    sFrame.setSize(200, 200);
    sFrame.setVisible(true);
}
Also used : JFrame(javax.swing.JFrame) JProgressBar(javax.swing.JProgressBar)

Example 49 with JProgressBar

use of javax.swing.JProgressBar in project jdk8u_jdk by JetBrains.

the class CAccessible method addNotificationListeners.

public void addNotificationListeners(Component c) {
    if (c instanceof Accessible) {
        AccessibleContext ac = ((Accessible) c).getAccessibleContext();
        ac.addPropertyChangeListener(new AXChangeNotifier());
    }
    if (c instanceof JProgressBar) {
        JProgressBar pb = (JProgressBar) c;
        pb.addChangeListener(new AXProgressChangeNotifier());
    } else if (c instanceof JSlider) {
        JSlider slider = (JSlider) c;
        slider.addChangeListener(new AXProgressChangeNotifier());
    }
}
Also used : AccessibleContext(javax.accessibility.AccessibleContext) JProgressBar(javax.swing.JProgressBar) JSlider(javax.swing.JSlider) Accessible(javax.accessibility.Accessible)

Example 50 with JProgressBar

use of javax.swing.JProgressBar in project processdash by dtuma.

the class HierarchyEditor method createProgressDialog.

private void createProgressDialog(int size) {
    progressDialog = new JDialog(frame, resource.getString("SavingChanges"), true);
    progressDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    progressDialog.getContentPane().add(new JLabel(resource.getString("SavingChangesDots")), BorderLayout.NORTH);
    progressDialog.getContentPane().add(progressBar = new JProgressBar(0, size), BorderLayout.CENTER);
    progressDialog.pack();
    progressDialog.setLocationRelativeTo(frame);
}
Also used : JProgressBar(javax.swing.JProgressBar) JLabel(javax.swing.JLabel) JDialog(javax.swing.JDialog)

Aggregations

JProgressBar (javax.swing.JProgressBar)86 JLabel (javax.swing.JLabel)52 JPanel (javax.swing.JPanel)39 JButton (javax.swing.JButton)32 Dimension (java.awt.Dimension)30 BorderLayout (java.awt.BorderLayout)27 ActionEvent (java.awt.event.ActionEvent)20 JScrollPane (javax.swing.JScrollPane)20 ActionListener (java.awt.event.ActionListener)16 Insets (java.awt.Insets)14 IOException (java.io.IOException)14 GridBagConstraints (java.awt.GridBagConstraints)13 GridBagLayout (java.awt.GridBagLayout)13 JCheckBox (javax.swing.JCheckBox)12 FlowLayout (java.awt.FlowLayout)11 ArrayList (java.util.ArrayList)11 JDialog (javax.swing.JDialog)11 File (java.io.File)10 ImageIcon (javax.swing.ImageIcon)10 JComboBox (javax.swing.JComboBox)9