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