use of javax.swing.JProgressBar in project keystore-explorer by kaikramer.
the class DCheckUpdate method initComponents.
private void initComponents() {
jlCheckUpdate = new JLabel(res.getString("DCheckUpdate.jlCheckUpdate.text"));
ImageIcon icon = new ImageIcon(getClass().getResource(res.getString("DCheckUpdate.jlCheckUpdate.image")));
jlCheckUpdate.setIcon(icon);
jlCheckUpdate.setHorizontalTextPosition(SwingConstants.LEADING);
jlCheckUpdate.setIconTextGap(15);
jpCheckUpdate = new JPanel(new FlowLayout(FlowLayout.CENTER));
jpCheckUpdate.add(jlCheckUpdate);
jpCheckUpdate.setBorder(new EmptyBorder(5, 5, 5, 5));
jpbCheckUpdate = new JProgressBar();
jpbCheckUpdate.setIndeterminate(true);
jpbCheckUpdate.setString("DCheckUpdate.jlCheckUpdate.text");
jpProgress = new JPanel(new FlowLayout(FlowLayout.CENTER));
jpProgress.add(jpbCheckUpdate);
jpProgress.setBorder(new EmptyBorder(5, 5, 5, 5));
jbCancel = new JButton(res.getString("DCheckUpdate.jbCancel.text"));
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jpCancel = PlatformUtil.createDialogButtonPanel(jbCancel, false);
getContentPane().add(jpCheckUpdate, BorderLayout.NORTH);
getContentPane().add(jpProgress, BorderLayout.CENTER);
getContentPane().add(jpCancel, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
if ((checker != null) && (checker.isAlive())) {
checker.interrupt();
}
closeDialog();
}
});
setTitle(res.getString("DCheckUpdate.Title"));
setResizable(false);
pack();
}
use of javax.swing.JProgressBar in project keystore-explorer by kaikramer.
the class DExaminingSsl method initComponents.
private void initComponents() {
jlExaminingSsl = new JLabel(res.getString("DExaminingSsl.jlExaminingSsl.text"));
ImageIcon icon = new ImageIcon(getClass().getResource(res.getString("DExaminingSsl.jlExaminingSsl.image")));
jlExaminingSsl.setIcon(icon);
jlExaminingSsl.setHorizontalTextPosition(SwingConstants.LEADING);
jlExaminingSsl.setIconTextGap(15);
jpExaminingSsl = new JPanel(new FlowLayout(FlowLayout.CENTER));
jpExaminingSsl.add(jlExaminingSsl);
jpExaminingSsl.setBorder(new EmptyBorder(5, 5, 5, 5));
jpbExaminingSsl = new JProgressBar();
jpbExaminingSsl.setIndeterminate(true);
jpProgress = new JPanel(new FlowLayout(FlowLayout.CENTER));
jpProgress.add(jpbExaminingSsl);
jpProgress.setBorder(new EmptyBorder(5, 5, 5, 5));
jbCancel = new JButton(res.getString("DExaminingSsl.jbCancel.text"));
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jpCancel = PlatformUtil.createDialogButtonPanel(jbCancel, false);
getContentPane().add(jpExaminingSsl, BorderLayout.NORTH);
getContentPane().add(jpProgress, BorderLayout.CENTER);
getContentPane().add(jpCancel, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
if ((examiner != null) && (examiner.isAlive())) {
examiner.interrupt();
}
closeDialog();
}
});
setTitle(res.getString("DExaminingSsl.Title"));
setResizable(false);
pack();
}
use of javax.swing.JProgressBar in project energy3d by concord-consortium.
the class LogZipper method createDialog.
void createDialog() {
final JDialog dialog = new JDialog(MainFrame.getInstance(), true);
dialog.setTitle("Export log as a zip file");
dialog.setUndecorated(true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
JPanel panel = new JPanel(new BorderLayout(20, 20));
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
panel.setPreferredSize(new Dimension(400, 100));
dialog.setContentPane(panel);
progressBar = new JProgressBar(0, 100);
progressBar.setStringPainted(true);
progressBar.setBorderPainted(true);
panel.add(progressBar, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
panel.add(buttonPanel, BorderLayout.SOUTH);
final JButton closeButton = new JButton("Close");
closeButton.setEnabled(false);
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
buttonPanel.add(closeButton);
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
public Void doInBackground() {
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(new FileOutputStream(zipFile, false));
} catch (IOException e) {
e.printStackTrace();
return null;
}
FileInputStream in = null;
int c;
int count = 0;
try {
File[] files = SnapshotLogger.getLogFolder().listFiles();
for (File f : files) {
zos.putNextEntry(new ZipEntry(f.getName()));
in = new FileInputStream(f);
while ((c = in.read()) != -1) zos.write(c);
in.close();
zos.flush();
zos.closeEntry();
count++;
setProgress(Math.round((float) count / (float) files.length * 100f));
}
setProgress(100);
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
return null;
}
@Override
protected void done() {
Toolkit.getDefaultToolkit().beep();
closeButton.setEnabled(true);
}
};
worker.addPropertyChangeListener(this);
worker.execute();
dialog.pack();
dialog.setLocationRelativeTo(MainFrame.getInstance());
dialog.setVisible(true);
}
use of javax.swing.JProgressBar in project MtgDesktopCompanion by nicho92.
the class SealedPanel method initGUI.
private void initGUI() {
JPanel panelWest;
JButton btnSaveDeck;
JSplitPane panelCenter;
JButton btnAddBoosters;
JScrollPane scrollTablePack;
JTable table;
JPanel panelControl;
JPanel panelAnalyse;
JPanel panelSorters;
JRadioButton rdioCmcSortButton;
JRadioButton rdiocolorSort;
JRadioButton rdiotypeSort;
JPanel panel;
JPanel panelEast;
JPanel panelAnalyseChooser;
JRadioButton rdioDeckAnalyse;
JRadioButton rdioBoosterAnalyse;
JPanel panelLands;
setLayout(new BorderLayout(0, 0));
panelOpenedBooster = new BoosterPanel();
model = new SealedPackTableModel();
panelDetail = new MagicCardDetailPanel();
panelDetail.enableThumbnail(true);
panelDetail.enableCollectionLookup(false);
List<MagicEdition> li;
try {
li = MTGControler.getInstance().getEnabledProviders().loadEditions();
} catch (IOException e1) {
li = new ArrayList<>();
MTGLogger.printStackTrace(e1);
}
panelWest = new JPanel();
panelWest.setPreferredSize(new Dimension(300, 10));
add(panelWest, BorderLayout.WEST);
panelWest.setLayout(new BorderLayout(0, 0));
panelControl = new JPanel();
panelWest.add(panelControl, BorderLayout.NORTH);
table = new JTable(model);
table.getColumnModel().getColumn(1).setCellEditor(new IntegerCellEditor());
panelControl.setLayout(new BorderLayout(0, 0));
panel = new JPanel();
panelControl.add(panel, BorderLayout.NORTH);
GridBagLayout gblpanel = new GridBagLayout();
gblpanel.columnWidths = new int[] { 105, 65, 0, 0, 0 };
gblpanel.rowHeights = new int[] { 41, 0, 0 };
gblpanel.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
gblpanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
panel.setLayout(gblpanel);
cboEditions = new JComboBox<>();
GridBagConstraints gbccboEditions = new GridBagConstraints();
gbccboEditions.fill = GridBagConstraints.HORIZONTAL;
gbccboEditions.gridwidth = 4;
gbccboEditions.insets = new Insets(0, 0, 5, 0);
gbccboEditions.gridx = 0;
gbccboEditions.gridy = 0;
panel.add(cboEditions, gbccboEditions);
cboEditions.setRenderer(new MagicEditionListRenderer());
cboEditions.setModel(new DefaultComboBoxModel<MagicEdition>(li.toArray(new MagicEdition[li.size()])));
btnAddBoosters = new JButton(MTGConstants.ICON_NEW);
GridBagConstraints gbcbtnAddBoosters = new GridBagConstraints();
gbcbtnAddBoosters.anchor = GridBagConstraints.NORTH;
gbcbtnAddBoosters.insets = new Insets(0, 0, 0, 5);
gbcbtnAddBoosters.gridx = 0;
gbcbtnAddBoosters.gridy = 1;
panel.add(btnAddBoosters, gbcbtnAddBoosters);
btnOpen = new JButton(MTGConstants.ICON_OPEN);
GridBagConstraints gbcbtnOpen = new GridBagConstraints();
gbcbtnOpen.insets = new Insets(0, 0, 0, 5);
gbcbtnOpen.anchor = GridBagConstraints.NORTH;
gbcbtnOpen.gridx = 1;
gbcbtnOpen.gridy = 1;
panel.add(btnOpen, gbcbtnOpen);
btnOpen.setEnabled(false);
btnSaveDeck = new JButton(MTGConstants.ICON_SAVE);
GridBagConstraints gbcbtnSaveDeck = new GridBagConstraints();
gbcbtnSaveDeck.insets = new Insets(0, 0, 0, 5);
gbcbtnSaveDeck.gridx = 2;
gbcbtnSaveDeck.gridy = 1;
panel.add(btnSaveDeck, gbcbtnSaveDeck);
lblLoading = new JLabel(MTGConstants.ICON_LOADING);
lblLoading.setVisible(false);
GridBagConstraints gbclblLoading = new GridBagConstraints();
gbclblLoading.gridx = 3;
gbclblLoading.gridy = 1;
panel.add(lblLoading, gbclblLoading);
btnSaveDeck.addActionListener(e -> save());
btnOpen.addActionListener(ae -> open());
btnAddBoosters.addActionListener(ae -> addBooster());
scrollTablePack = new JScrollPane();
scrollTablePack.setPreferredSize(new Dimension(2, 100));
panelControl.add(scrollTablePack);
scrollTablePack.setViewportView(table);
panelAnalyse = new JPanel();
panelWest.add(panelAnalyse, BorderLayout.CENTER);
panelAnalyse.setLayout(new GridLayout(5, 1, 0, 0));
panelSorters = new JPanel();
panelAnalyse.add(panelSorters);
panelSorters.setLayout(new GridLayout(0, 1, 0, 0));
rdioCmcSortButton = new JRadioButton(MTGControler.getInstance().getLangService().getCapitalize("SORT_BY", "cmc"));
rdioCmcSortButton.addActionListener(ae -> sort(new CmcSorter()));
panelSorters.add(rdioCmcSortButton);
rdiocolorSort = new JRadioButton(MTGControler.getInstance().getLangService().getCapitalize("SORT_BY", "color"));
rdiocolorSort.addActionListener(ae -> sort(new ColorSorter()));
panelSorters.add(rdiocolorSort);
rdiotypeSort = new JRadioButton(MTGControler.getInstance().getLangService().getCapitalize("SORT_BY", "type"));
rdiotypeSort.addActionListener(ae -> sort(new TypesSorter()));
panelSorters.add(rdiotypeSort);
ButtonGroup groupSorter = new ButtonGroup();
groupSorter.add(rdioCmcSortButton);
groupSorter.add(rdiocolorSort);
groupSorter.add(rdiotypeSort);
panelAnalyseChooser = new JPanel();
panelSorters.add(panelAnalyseChooser);
FlowLayout flowLayout = (FlowLayout) panelAnalyseChooser.getLayout();
flowLayout.setAlignment(FlowLayout.LEFT);
rdioBoosterAnalyse = new JRadioButton("Booster");
rdioBoosterAnalyse.setSelected(true);
rdioBoosterAnalyse.addActionListener(e -> analyseDeck(false));
panelAnalyseChooser.add(rdioBoosterAnalyse);
rdioDeckAnalyse = new JRadioButton("Deck");
rdioDeckAnalyse.addActionListener(e -> analyseDeck(true));
panelAnalyseChooser.add(rdioDeckAnalyse);
ButtonGroup groupAnalyser = new ButtonGroup();
groupAnalyser.add(rdioBoosterAnalyse);
groupAnalyser.add(rdioDeckAnalyse);
progressBar = new JProgressBar();
progressBar.setMaximum(40);
progressBar.setStringPainted(true);
panelSorters.add(progressBar);
cmcChartPanel = new CmcChartPanel();
panelAnalyse.add(cmcChartPanel);
manaRepartitionPanel = new ManaRepartitionPanel();
panelAnalyse.add(manaRepartitionPanel);
typeRepartitionPanel = new TypeRepartitionPanel();
panelAnalyse.add(typeRepartitionPanel);
panelCenter = new JSplitPane();
panelCenter.setResizeWeight(0.5);
panelCenter.setOrientation(JSplitPane.VERTICAL_SPLIT);
JScrollPane paneBooster = new JScrollPane();
paneBooster.setViewportView(panelOpenedBooster);
panelCenter.setLeftComponent(paneBooster);
panelCenter.setRightComponent(panelDetail);
add(panelCenter, BorderLayout.CENTER);
panelEast = new JPanel();
add(panelEast, BorderLayout.EAST);
panelEast.setLayout(new BorderLayout(0, 0));
panelDeck = new GraveyardPanel() {
@Override
public PositionEnum getOrigine() {
return PositionEnum.DECK;
}
@Override
public void moveCard(DisplayableCard mc, PositionEnum to) {
if (to == PositionEnum.BOOSTER) {
deck.remove(mc.getMagicCard());
list.add(mc.getMagicCard());
refreshStats();
}
}
@Override
public void addComponent(DisplayableCard i) {
super.addComponent(i);
deck.add(i.getMagicCard());
refreshStats();
}
};
JScrollPane scrollDeck = new JScrollPane();
scrollDeck.setViewportView(panelDeck);
panelEast.add(scrollDeck);
panelDeck.setPreferredSize(new Dimension((int) MTGControler.getInstance().getCardsDimension().getWidth() + 5, (int) (MTGControler.getInstance().getCardsDimension().getHeight() * 30)));
panelEast.add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DROP_HERE")), BorderLayout.NORTH);
panelLands = new JPanel();
panelEast.add(panelLands, BorderLayout.SOUTH);
txtNumberLand = new JTextField();
panelLands.add(txtNumberLand);
txtNumberLand.setColumns(2);
cboLands = new JComboBox<>(new DefaultComboBoxModel<>(new String[] { "Plains", "Island", "Swamp", "Mountain", "Forest" }));
panelLands.add(cboLands);
JButton btnAddLands = new JButton("+");
btnAddLands.addActionListener(ae -> addLands());
panelLands.add(btnAddLands);
}
use of javax.swing.JProgressBar in project MtgDesktopCompanion by nicho92.
the class DeckDetailsPanel method initDataBindings.
protected BindingGroup initDataBindings() {
BeanProperty<MagicDeck, String> nameProperty = BeanProperty.create("name");
BeanProperty<JTextField, String> textProperty1 = BeanProperty.create("text");
AutoBinding<MagicDeck, String, JTextField, String> autoBinding1 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, magicDeck, nameProperty, nameJTextField, textProperty1);
autoBinding1.bind();
//
BeanProperty<MagicDeck, Integer> nbCardsProperty = BeanProperty.create("nbCards");
BeanProperty<JProgressBar, Integer> textProperty4 = BeanProperty.create("value");
AutoBinding<MagicDeck, Integer, JProgressBar, Integer> autoBinding2 = Bindings.createAutoBinding(UpdateStrategy.READ, magicDeck, nbCardsProperty, nbCardsProgress, textProperty4);
autoBinding2.bind();
nbCardsProgress.setString("" + magicDeck.getNbCards());
nbSideProgress.setValue(magicDeck.getSideAsList().size());
setLegalities();
//
BeanProperty<MagicDeck, String> descriptionProperty = BeanProperty.create("description");
BeanProperty<JTextArea, String> textProperty2 = BeanProperty.create("text");
AutoBinding<MagicDeck, String, JTextArea, String> autoBinding3 = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, magicDeck, descriptionProperty, textArea, textProperty2);
autoBinding3.bind();
//
BeanProperty<MagicDeck, String> colorIdentityProperty = BeanProperty.create("colors");
BeanProperty<ManaPanel, String> manaCostProperty3 = BeanProperty.create("manaCost");
AutoBinding<MagicDeck, String, ManaPanel, String> autoBinding4 = Bindings.createAutoBinding(UpdateStrategy.READ, magicDeck, colorIdentityProperty, manaPanel, manaCostProperty3);
autoBinding4.bind();
//
BindingGroup bindingGroup = new BindingGroup();
bindingGroup.addBinding(autoBinding1);
bindingGroup.addBinding(autoBinding2);
bindingGroup.addBinding(autoBinding3);
bindingGroup.addBinding(autoBinding4);
if (magicDeck != null && magicDeck.getDateCreation() != null) {
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, MTGControler.getInstance().getLocale());
lblDateInformation.setText(df.format(magicDeck.getDateCreation()));
}
tagsPanel.clean();
if (magicDeck != null)
tagsPanel.bind(magicDeck.getTags());
return bindingGroup;
}
Aggregations