Java 类javax.swing.JProgressBar 实例源码
项目:incubator-netbeans
文件:ProgressHandleFactoryTest.java
@RandomlyFails // NB-Core-Build #1176
public void testCustomComponentIsInitialized() {
Controller.defaultInstance = new TestController();
ProgressHandle handle = ProgressHandleFactory.createHandle("task 1");
// Warning, this will make the handle to work with a new Controller, not TestController.
JComponent component = ProgressHandleFactory.createProgressComponent(handle);
handle.start(15);
handle.progress(2);
waitForTimerFinish();
assertEquals(15, ((JProgressBar) component).getMaximum());
assertEquals(2, ((JProgressBar) component).getValue());
handle = ProgressHandleFactory.createHandle("task 2");
component = ProgressHandleFactory.createProgressComponent(handle);
handle.start(20);
waitForTimerFinish();
assertEquals(20, ((JProgressBar) component).getMaximum());
assertEquals(0, ((JProgressBar) component).getValue());
}
项目:incubator-netbeans
文件:ReferencesBrowserController.java
Dialog createProgressPanel(final String message, BoundedRangeModel model) {
Dialog dialog;
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout(10, 10));
panel.setBorder(new EmptyBorder(15, 15, 15, 15));
panel.add(new JLabel(message), BorderLayout.NORTH);
final Dimension ps = panel.getPreferredSize();
ps.setSize(Math.max(ps.getWidth(), DEFAULT_WIDTH), Math.max(ps.getHeight(), DEFAULT_HEIGHT));
panel.setPreferredSize(ps);
final JProgressBar progress = new JProgressBar();
if (model == null) {
progress.setIndeterminate(true);
} else {
progress.setStringPainted(true);
progress.setModel(model);
}
panel.add(progress, BorderLayout.SOUTH);
dialog = DialogDisplayer.getDefault().createDialog(new DialogDescriptor(panel, Bundle.ReferencesBrowserController_ProgressDialogCaption(), true, new Object[] { },
DialogDescriptor.CANCEL_OPTION, DialogDescriptor.RIGHT_ALIGN,
null, null));
return dialog;
}
项目:marathonv5
文件:JavaElementFactory.java
public static void reset() {
add(Component.class, JavaElement.class);
add(JList.class, JListJavaElement.class);
add(JTabbedPane.class, JTabbedPaneJavaElement.class);
add(JComboBox.class, JComboBoxJavaElement.class);
add(JTable.class, JTableJavaElement.class);
add(JTableHeader.class, JTableHeaderJavaElement.class);
add(JTree.class, JTreeJavaElement.class);
add(JToggleButton.class, JToggleButtonJavaElement.class);
add(JSpinner.class, JSpinnerJavaElement.class);
add(JProgressBar.class, JProgressBarJavaElement.class);
add(JSplitPane.class, JSplitPaneJavaElement.class);
add(JTextComponent.class, JTextComponentJavaElement.class);
add(EditorContainer.class, JTreeEditingContainerJavaElement.class);
add(JEditorPane.class, JEditorPaneJavaElement.class);
add(JMenuItem.class, JMenuItemJavaElement.class);
add(JSlider.class, JSliderJavaElement.class);
add(JSpinner.class, JSpinnerJavaElement.class);
add(DefaultEditor.class, DefaultEditorJavaElement.class);
add(JColorChooser.class, JColorChooserJavaElement.class);
add(JFileChooser.class, JFileChooserJavaElement.class);
}
项目:marathonv5
文件:RComponentFactory.java
public static void reset() {
entries.clear();
add(Component.class, RUnknownComponent.class);
add(Window.class, RWindow.class);
add(JTable.class, RTable.class);
add(JTableHeader.class, RTableHeader.class);
add(AbstractButton.class, RAbstractButton.class);
add(JToggleButton.class, RToggleButton.class);
add(JComboBox.class, RComboBox.class);
add(JTextComponent.class, RTextComponent.class);
add(JTree.class, RTree.class);
add(JList.class, RList.class);
add(JTabbedPane.class, RTabbedPane.class);
add(JMenuItem.class, RMenuItem.class);
add(JSlider.class, RSlider.class);
add(JProgressBar.class, RProgressBar.class);
add(JSpinner.class, RSpinner.class);
add(DefaultEditor.class, RDefaultEditor.class);
add(JColorChooser.class, RColorChooser.class);
add(JSplitPane.class, RSplitPane.class);
add(BasicSplitPaneDivider.class, RSplitPane.class);
add(JFileChooser.class, RFileChooser.class);
add(JEditorPane.class, REditorPane.class);
add(JLabel.class, RLabel.class);
add(JScrollBar.class, RIgnoreComponent.class);
}
项目:USB3Installer
文件:FooterBar.java
public FooterBar() {
setPreferredSize(new Dimension(640, 16));
setLayout(new GridLayout());
setBorder(new BevelBorder(BevelBorder.LOWERED));
Border margin = new EmptyBorder(0, 5, 0, 5);
label = new JLabel("Ready", SwingConstants.LEFT);
label.setBorder(margin);
add(label);
progress = new JProgressBar();
progress.setMaximum(6);
progress.setStringPainted(true);
progress.setPreferredSize(new Dimension(10, 16));
progress.setValue(0);
add(progress);
}
项目:myqq
文件:SendFileFrame.java
/**
* @param bar
* @param passlen
* @param sumlen
* @param lbl
*/
public void updateProgressBar(JProgressBar bar, long passlen, long sumlen,
JLabel lbl, double passTime)
{
int percent = (int) (passlen * 100 / sumlen);
bar.setValue(percent);
if (lbl != null)
{
String msg = "正在接受文件....." + (passlen / 1024) + "kb" + " /"
+ (sumlen / 1024) + "kb" + "已接收 "+ percent + "%"
+ "\n 发射点" + (int) ((passlen / 1024) / (passTime / 1000))
+ "Kb/s";
if (passlen == sumlen)
msg = "传输完毕!";
lblProgress.setText(msg);
}
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Waits progress bar string to match {@code value} parameter.
*
* @param value a string value.
* @see Operator#waitState(ComponentChooser)
*/
public void waitValue(final String value) {
output.printLine("Wait \"" + value
+ "\" string in progressbar\n : "
+ toStringSource());
output.printGolden("Wait \"" + value
+ "\" string in progressbar");
waitState(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return getComparator().equals(((JProgressBar) comp).getString(), value);
}
@Override
public String getDescription() {
return "'" + value + "' string";
}
@Override
public String toString() {
return "JProgressBarOperator.waitValue.ComponentChooser{description = " + getDescription() + '}';
}
});
}
项目:Luyten4Forge
文件:FileSaver.java
public FileSaver(JProgressBar bar, JLabel label) {
this.bar = bar;
this.label = label;
final JPopupMenu menu = new JPopupMenu("Cancel");
final JMenuItem item = new JMenuItem("Cancel");
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
setCancel(true);
}
});
menu.add(item);
this.label.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent ev) {
if (SwingUtilities.isRightMouseButton(ev) && isExtracting())
menu.show(ev.getComponent(), ev.getX(), ev.getY());
}
});
}
项目:jdk8u-jdk
文件:ProgressBarMemoryLeakTest.java
private static void executeTestCase(String lookAndFeelString) throws Exception{
if (tryLookAndFeel(lookAndFeelString)) {
EventQueue.invokeAndWait( new Runnable() {
@Override
public void run() {
showUI();
}
} );
EventQueue.invokeAndWait( new Runnable() {
@Override
public void run() {
disposeUI();
}
} );
Util.generateOOME();
JProgressBar progressBar = sProgressBar.get();
if ( progressBar != null ) {
throw new RuntimeException( "Progress bar (using L&F: " + lookAndFeelString + ") should have been GC-ed" );
}
}
}
项目:jdk8u-jdk
文件:ProgressBarMemoryLeakTest.java
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);
}
项目:openvisualtraceroute
文件:SplashScreen.java
/**
* Constructor
*
* @throws HeadlessException
*/
public SplashScreen(final JFrame parent, final boolean showImage, final int startupStepsCount) throws HeadlessException {
super(parent, ModalityType.APPLICATION_MODAL);
final String version = Resources.getVersion();
if (showImage) {
final Image image = Resources.getImageIcon("splashscreen.jpg").getImage();
getContentPane().add(new ImageComponent(image, new String[] { "Open Visual Traceroute", version + " Leo Lewis" }), BorderLayout.CENTER);
}
_progress = new JProgressBar(1, startupStepsCount);
_progress.setIndeterminate(false);
_progress.setStringPainted(true);
_progress.setPreferredSize(new Dimension(500, _progress.getPreferredSize().height));
getContentPane().add(_progress, BorderLayout.SOUTH);
setFocusable(false);
setUndecorated(true);
pack();
setLocationRelativeTo(null);
}
项目:openjdk-jdk10
文件:ProgressBarMemoryLeakTest.java
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);
}
项目:openjdk-jdk10
文件:JProgressBarOrientationRobotTest.java
private static void createUI(final String shortenedLookAndFeelString)
throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
progressBar = new JProgressBar();
progressBar.setValue(30);
frame = new JFrame(shortenedLookAndFeelString);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(progressBar);
frame.pack();
frame.setSize(500, frame.getSize().height);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.toFront();
}
});
}
项目:incubator-netbeans
文件:NbProgressBar.java
/** Creates a new instance of NbProgressBar */
public NbProgressBar() {
super();
setOrientation(JProgressBar.HORIZONTAL);
setAlignmentX(0.5f);
setAlignmentY(0.5f);
Color fg = UIManager.getColor ("nbProgressBar.Foreground");
if (fg != null) {
setForeground(fg);
}
Color bg = UIManager.getColor ("nbProgressBar.Background");
if (bg != null) {
setBackground(bg);
}
}
项目:incubator-netbeans
文件:Util.java
public static JDialog createJOptionProgressDialog(JOptionPane p, String title, File source, JProgressBar bar) {
progressBar = bar;
sourceFolder = source;
Object[] options = p.getOptions();
JButton bYES = ((JButton) options[0]);
JButton bNO = ((JButton) options[1]);
OptionsListener listener = new OptionsListener(p, bYES, bNO);
bYES.addActionListener(listener);
bNO.addActionListener(listener);
return createJOptionDialog(p, title);
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.setModel(BoundedRangeModel)} through queue
*/
public void setModel(final BoundedRangeModel boundedRangeModel) {
runMapping(new MapVoidAction("setModel") {
@Override
public void map() {
((JProgressBar) getSource()).setModel(boundedRangeModel);
}
});
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.getString()} through queue
*/
public String getString() {
return (runMapping(new MapAction<String>("getString") {
@Override
public String map() {
return ((JProgressBar) getSource()).getString();
}
}));
}
项目:xdman
文件:XDMProgressBarUI.java
@Override
protected void paintDeterminate(Graphics g, JComponent c) {
Insets b = progressBar.getInsets(); // area for border
int barRectWidth = progressBar.getWidth() - (b.right + b.left);
int barRectHeight = progressBar.getHeight() - (b.top + b.bottom);
if (barRectWidth <= 0 || barRectHeight <= 0) {
return;
}
// amount of progress to draw
int amountFull = getAmountFull(b, barRectWidth, barRectHeight);
Graphics2D g2 = (Graphics2D) g;
g2.setColor(progressBar.getForeground());
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {
g2.setPaint(high);
g2.fillRect(0, 0, amountFull, c.getHeight() / 2);
g2.setPaint(low);
g2.fillRect(0, c.getHeight() / 2, amountFull, c.getHeight());
} else { // VERTICAL
}
// Deal with possible text painting
if (progressBar.isStringPainted()) {
paintString(g, b.left, b.top, barRectWidth, barRectHeight,
amountFull, b);
}
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.setStringPainted(boolean)} through queue
*/
public void setStringPainted(final boolean b) {
runMapping(new MapVoidAction("setStringPainted") {
@Override
public void map() {
((JProgressBar) getSource()).setStringPainted(b);
}
});
}
项目:incubator-netbeans
文件:JComponentBuilders.java
JSliderBuilder(Instance instance, Heap heap) {
super(instance, heap, false);
paintTicks = DetailsUtils.getBooleanFieldValue(instance, "paintTicks", false);
paintTrack = DetailsUtils.getBooleanFieldValue(instance, "paintTrack", true);
paintLabels = DetailsUtils.getBooleanFieldValue(instance, "paintLabels", false);
isInverted = DetailsUtils.getBooleanFieldValue(instance, "isInverted", false);
sliderModel = DefaultBoundedRangeModelBuilder.fromField(instance, "sliderModel", heap);
majorTickSpacing = DetailsUtils.getIntFieldValue(instance, "majorTickSpacing", 0);
minorTickSpacing = DetailsUtils.getIntFieldValue(instance, "minorTickSpacing", 0);
snapToTicks = DetailsUtils.getBooleanFieldValue(instance, "snapToTicks", false);
orientation = DetailsUtils.getIntFieldValue(instance, "orientation", JProgressBar.HORIZONTAL);
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.setString(String)} through queue
*/
public void setString(final String string) {
runMapping(new MapVoidAction("setString") {
@Override
public void map() {
((JProgressBar) getSource()).setString(string);
}
});
}
项目:rapidminer
文件:ProgressBarBorder.java
@Override
public Insets getBorderInsets(Component c, Insets insets) {
boolean compressed = Boolean.parseBoolean(String.valueOf(((JProgressBar) c)
.getClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED)));
if (compressed) {
insets.top = insets.left = insets.bottom = insets.right = 3;
} else {
insets.top = 0;
insets.left = insets.right = 3;
insets.bottom = 10;
}
return insets;
}
项目:scorekeeperfrontend
文件:StatusDialog.java
public StatusDialog()
{
super(new MigLayout("fill", "fill", "fill"), true);
bar = new JProgressBar();
bar.setMinimum(0);
bar.setMaximum(100);
status = new JLabel("status here");
mainPanel.add(status, "wmin 300, wrap");
mainPanel.add(bar, "");
buttonPanel.remove(ok);
cancel.setText("Close");
}
项目:lazycat
文件:CenterPanel.java
public static void main(String[] args) {
JFrame f = new JFrame();
f.setSize(200, 200);
f.setLocationRelativeTo(null);
CenterPanel cp = new CenterPanel(0.85, true);
f.setContentPane(cp);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
JButton b = new JButton("abc");
JLabel l = new JLabel("xxx");
JProgressBar pb1 = new JProgressBar();
cp.show(pb1);
}
项目:Install_Builder_Universal
文件:ManageDirs.java
@SuppressWarnings("rawtypes")
public void copyDir(final DefaultListModel dirModel, final JTextField txt, JProgressBar bar, Logger log) {
bar.setValue(0);
bar.setMinimum(0);
bar.setMaximum(dirModel.size() - 1);
if(dirModel.size() != 0) {
for(int i = 0;i<dirModel.size(); i++) {
log.Info("COPYING: <DIR> " + dirModel.getElementAt(i));
File f = new File(dirModel.getElementAt(i).toString());
try {
if(!System.getProperty("os.name").equals("Linux"))
InstallBuilderWindow.content += "Files\\" + Utils.indexOf(dirModel.getElementAt(i).toString(), '\\') + "\n";
else
InstallBuilderWindow.content += "Files/" + Utils.indexOf(dirModel.getElementAt(i).toString(), '/') + "\n";
if(!System.getProperty("os.name").equals("Linux"))
FileUtils.copyDirectory(f, new File(System.getProperty("user.dir") + "/" + txt.getText() + "/" + "/Files/" +
Utils.indexOf(dirModel.getElementAt(i).toString(), '\\')));
else
FileUtils.copyDirectory(f, new File(System.getProperty("user.dir") + "/" + txt.getText() + "/Files/" +
Utils.indexOf(dirModel.getElementAt(i).toString(), '/')));
} catch (IOException e) {
e.printStackTrace();
log.Error("Could not copy directory\n" + e);
}
bar.setValue(i);
}
InstallBuilderWindow.content += "## DIRS END ##\n";
}else {
InstallBuilderWindow.content += "\n## DIRS END ##\n";
}
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.getUI()} through queue
*/
public ProgressBarUI getUI() {
return (runMapping(new MapAction<ProgressBarUI>("getUI") {
@Override
public ProgressBarUI map() {
return ((JProgressBar) getSource()).getUI();
}
}));
}
项目:javase
文件:JProgressDemo.java
public JProgressDemo() {
frame = new JFrame("install");
frame.setLayout(new BorderLayout());
label = new JLabel("progress",SwingConstants.CENTER);
progressbar = new JProgressBar();
progressbar.setOrientation(JProgressBar.HORIZONTAL);
progressbar.setMinimum(0);
progressbar.setMaximum(100);
progressbar.setValue(0);
//progressbar.setStringPainted(true);
progressbar.addChangeListener(this);
progressbar.setPreferredSize(new Dimension(300, 10));
progressbar.setBorderPainted(false);
progressbar.setBackground(Color.pink);
JPanel progressPane = new JPanel();
progressPane.add(progressbar);
progressPane.setPreferredSize(new Dimension(300, 10));
JPanel panel = new JPanel();
b = new JButton("install");
stop = new JButton("pause");
b.setForeground(Color.blue);
b.addActionListener(this);
stop.addActionListener(this);
panel.add(b);
panel.add(stop);
// timer=new Timer(100,this);
timer = new Timer(1000/10, this);
frame.add(panel, BorderLayout.NORTH);
frame.add(progressPane, BorderLayout.CENTER);
frame.add(label, BorderLayout.SOUTH);
// frame.pack();
frame.setBounds(100, 100, 400, 130);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
项目:owa-notifier
文件:ProgressBarNotification.java
public ProgressBarNotification() {
m_label = new JLabel();
m_progress = new JProgressBar();
this.addComponent(m_label, BorderLayout.NORTH);
JPanel progressPanel = new JPanel(new BorderLayout());
progressPanel.setBorder(BorderFactory.createEmptyBorder(15, 10, 15, 10));
progressPanel.add(m_progress, BorderLayout.CENTER);
this.addComponent(progressPanel, BorderLayout.CENTER);
}
项目:osumer
文件:ProgressDialog.java
/**
* Create the dialog.
*/
public ProgressDialog() {
setBounds(100, 100, 450, 141);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
lblStatus = new JLabel("Status: Initializing");
lblStatus.setFont(new Font("Tahoma", Font.PLAIN, 12));
pb = new JProgressBar();
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel
.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
gl_contentPanel.createSequentialGroup().addContainerGap()
.addGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING)
.addComponent(pb, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404,
Short.MAX_VALUE)
.addComponent(lblStatus, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404,
Short.MAX_VALUE))
.addContainerGap()));
gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup().addContainerGap().addComponent(lblStatus)
.addPreferredGap(ComponentPlacement.RELATED).addComponent(pb, GroupLayout.DEFAULT_SIZE, 28,
Short.MAX_VALUE)));
contentPanel.setLayout(gl_contentPanel);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
项目:EMC-Installer
文件:Progressbar.java
public Progressbar(String title, int max) {
pbar = new JProgressBar();
pbar.setMinimum(0);
pbar.setMaximum(max);
pbar.setPreferredSize(new Dimension(500, 20));
add(pbar);
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(this);
frame.setSize(new Dimension(500, 65));
frame.setVisible(true);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
}
项目:cuttlefish
文件:StatusBar.java
public StatusBar() {
super();
this.setBackground(Color.WHITE);
terminateTask = new JButton("Stop");
label = new JLabel();
label1 = new JLabel("Status ");
progressBar = new JProgressBar();
progressBar.setMinimum(50);
progressBar.setMaximum(100);
add(label1);
add(progressBar);
add(label);
add(terminateTask);
setMessage("Ready");
terminateTask.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (layoutController == null /* || currentTask == null */)
return;
// currentTask.cancel(true);
if (layoutController.canStop())
layoutController.stopLayout();
setMessage("Task canceled");
terminateTask.setEnabled(false);
}
});
}
项目:BrainControl
文件:MotivationsOverlay.java
@Override
public MotivationsOverlay updateOverlayInformation(ArrayList<JProgressBar> resBars, LinkedList<AbstractReservoir> resList,CAEAgent agent) {
this.setActive(true);
reservoirBars = resBars;
reservoirList = resList;
this.agent =agent;
return this;
}
项目:JavaGraph
文件:ProgressBarDialog.java
/** Lazily creates and returns the progress bar on the dialog. */
private JProgressBar getBar() {
if (this.bar == null) {
this.bar = new JProgressBar();
this.bar.setSize(LABEL_WIDTH, LABEL_HEIGHT);
this.bar.setIndeterminate(true);
this.bar.setStringPainted(true);
}
return this.bar;
}
项目:geomapapp
文件:XMImage.java
private void saveSEGY(OutputStream out) throws IOException {
if(image==null) throw new IOException("no image loaded");
String mcsPath = PathUtil.getPath("PORTALS/MULTI_CHANNEL_PATH",
MapApp.BASE_URL+"/data/portals/mcs/");
URL url = URLFactory.url( mcsPath + line.getCruiseID().trim() + "/segy/" +
line.getCruiseID().trim() +"-"+
line.getID().trim() + ".segy" );
URLConnection urlCon = url.openConnection();
BufferedInputStream in = new BufferedInputStream(urlCon.getInputStream());
int length = urlCon.getContentLength();
// Create a JProgressBar + JDialog
JDialog d = new JDialog((Frame)null, "Saving SEGY");
JPanel p = new JPanel(new BorderLayout());
p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
d.setLocationRelativeTo(null);
JProgressBar pb = new JProgressBar(0,length);
p.add(new JLabel("Saving " + (length / 1000000) + "mb segy file"), BorderLayout.NORTH);
p.add(pb);
d.getContentPane().add(p);
d.pack();
d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
d.setVisible(true);
byte[] b = new byte[16384];
int read = in.read(b);
while (read != -1) {
out.write(b, 0, read);
pb.setValue(pb.getValue() + read);
pb.repaint();
read = in.read(b);
}
out.flush();
in.close();
d.dispose();
}
项目:Equella
文件:ProgressWindow.java
private JProgressBar createWholeProgress(int total)
{
whole = new JProgressBar(0, total);
whole.setValue(0);
whole.setStringPainted(true);
whole.setForeground(new Color(153, 153, 204));
whole.setBackground(Color.white);
return whole;
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.setMinimum(int)} through queue
*/
public void setMinimum(final int i) {
runMapping(new MapVoidAction("setMinimum") {
@Override
public void map() {
((JProgressBar) getSource()).setMinimum(i);
}
});
}
项目:Equella
文件:ProgressDialog.java
@SuppressWarnings("nls")
private ProgressDialog(JDialog dialog)
{
this.dialog = dialog;
progress = new JProgressBar();
progress.setIndeterminate(true);
setLayout(new MigLayout("wrap 1, fill", "[200px,grow,fill]"));
add(progress);
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.getValue()} through queue
*/
public int getValue() {
return (runMapping(new MapIntegerAction("getValue") {
@Override
public int map() {
return ((JProgressBar) getSource()).getValue();
}
}));
}
项目:openjdk-jdk10
文件:JProgressBarOperator.java
/**
* Maps {@code JProgressBar.setUI(ProgressBarUI)} through queue
*/
public void setUI(final ProgressBarUI progressBarUI) {
runMapping(new MapVoidAction("setUI") {
@Override
public void map() {
((JProgressBar) getSource()).setUI(progressBarUI);
}
});
}
项目:jaer
文件:NumberReader.java
@Override public void init()
{
enable=false;
buttonGroupSig.add(radioVM);
buttonGroupSig.add(radioFR);
radioVM.setSelected(true);
// Make a list of links connecting neurons to their nets.
miniProbes=new ArrayList<MiniProbe>();
JProgressBar[] jbars={jBar1,jBar2,jBar3,jBar4,jBar5,jBar6,jBar7,jBar8,jBar9,jBar0};
JLabel[] jlabs={jLabel1,jLabel2,jLabel3,jLabel4,jLabel5,jLabel6,jLabel7,jLabel8,jLabel9,jLabel10};
for (int i=0; i<10; i++)
miniProbes.add(new MiniProbe(NN.nUnits()-10+i,jbars[i],jlabs[i]));
this.setVisible(true);
this.jSlider.setValue(10);
this.pushProbe.addActionListener(this);
this.pushControl.addActionListener(this);
this.setTitle("Network "+this.currentNet);
comboNet.removeAllItems();
for (int i=0;i<NA.N.length;i++)
{ comboNet.addItem("Network "+i);
}
enable=true;
}