Search in sources :

Example 21 with JProgressBar

use of javax.swing.JProgressBar in project JWildfire by thargor6.

the class BatchFlameRendererInternalFrame method getBatchRenderJobProgressBar.

/**
 * This method initializes batchRenderJobProgressBar
 *
 * @return javax.swing.JProgressBar
 */
JProgressBar getBatchRenderJobProgressBar() {
    if (batchRenderJobProgressBar == null) {
        batchRenderJobProgressBar = new JProgressBar();
        batchRenderJobProgressBar.setValue(0);
        batchRenderJobProgressBar.setPreferredSize(new Dimension(568, 21));
        batchRenderJobProgressBar.setStringPainted(true);
    }
    return batchRenderJobProgressBar;
}
Also used : JProgressBar(javax.swing.JProgressBar) Dimension(java.awt.Dimension)

Example 22 with JProgressBar

use of javax.swing.JProgressBar in project JWildfire by thargor6.

the class MeshGenInternalFrame method getPanel_89.

private JPanel getPanel_89() {
    if (panel_89 == null) {
        panel_89 = new JPanel();
        panel_89.setPreferredSize(new Dimension(10, 130));
        panel_89.setLayout(new BorderLayout(0, 0));
        panel_89.add(getPanel_90(), BorderLayout.WEST);
        JPanel panel_1 = new JPanel();
        panel_1.setBorder(new TitledBorder(null, "Voxelstack", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_89.add(panel_1, BorderLayout.CENTER);
        panel_1.setLayout(new BorderLayout(0, 0));
        JPanel panel_2 = new JPanel();
        panel_2.setPreferredSize(new Dimension(10, 20));
        panel_1.add(panel_2, BorderLayout.SOUTH);
        panel_2.setLayout(new BorderLayout(0, 0));
        meshGenProgressbar = new JProgressBar();
        meshGenProgressbar.setValue(0);
        meshGenProgressbar.setStringPainted(true);
        meshGenProgressbar.setPreferredSize(new Dimension(568, 21));
        panel_2.add(meshGenProgressbar, BorderLayout.CENTER);
        JPanel panel_3 = new JPanel();
        panel_3.setPreferredSize(new Dimension(620, 10));
        panel_1.add(panel_3, BorderLayout.WEST);
        panel_3.setLayout(null);
        JLabel lblRenderWidth = new JLabel();
        lblRenderWidth.setText("Render width");
        lblRenderWidth.setSize(new Dimension(68, 22));
        lblRenderWidth.setPreferredSize(new Dimension(94, 22));
        lblRenderWidth.setName("");
        lblRenderWidth.setLocation(new Point(4, 76));
        lblRenderWidth.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        lblRenderWidth.setBounds(252, 26, 79, 22);
        panel_3.add(lblRenderWidth);
        meshGenRenderWidthREd = new JWFNumberField();
        meshGenRenderWidthREd.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                if (tinaController != null && tinaController.getMeshGenController() != null) {
                    tinaController.getMeshGenController().renderWidth_changed();
                }
            }
        });
        meshGenRenderWidthREd.setMinValue(16.0);
        meshGenRenderWidthREd.setOnlyIntegers(true);
        meshGenRenderWidthREd.setValueStep(1.0);
        meshGenRenderWidthREd.setText("");
        meshGenRenderWidthREd.setSize(new Dimension(100, 24));
        meshGenRenderWidthREd.setPreferredSize(new Dimension(100, 24));
        meshGenRenderWidthREd.setMaxValue(4096.0);
        meshGenRenderWidthREd.setLocation(new Point(71, 76));
        meshGenRenderWidthREd.setHasMinValue(true);
        meshGenRenderWidthREd.setHasMaxValue(true);
        meshGenRenderWidthREd.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        meshGenRenderWidthREd.setBounds(328, 24, 100, 24);
        panel_3.add(meshGenRenderWidthREd);
        JLabel lblRenderHeight = new JLabel();
        lblRenderHeight.setText("Render height");
        lblRenderHeight.setSize(new Dimension(68, 22));
        lblRenderHeight.setPreferredSize(new Dimension(94, 22));
        lblRenderHeight.setName("");
        lblRenderHeight.setLocation(new Point(4, 76));
        lblRenderHeight.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        lblRenderHeight.setBounds(252, 50, 79, 22);
        panel_3.add(lblRenderHeight);
        meshGenRenderHeightREd = new JWFNumberField();
        meshGenRenderHeightREd.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                if (tinaController != null && tinaController.getMeshGenController() != null) {
                    tinaController.getMeshGenController().renderHeight_changed();
                }
            }
        });
        meshGenRenderHeightREd.setMinValue(16.0);
        meshGenRenderHeightREd.setOnlyIntegers(true);
        meshGenRenderHeightREd.setValueStep(1.0);
        meshGenRenderHeightREd.setText("");
        meshGenRenderHeightREd.setSize(new Dimension(100, 24));
        meshGenRenderHeightREd.setPreferredSize(new Dimension(100, 24));
        meshGenRenderHeightREd.setMaxValue(4096.0);
        meshGenRenderHeightREd.setLocation(new Point(71, 76));
        meshGenRenderHeightREd.setHasMinValue(true);
        meshGenRenderHeightREd.setHasMaxValue(true);
        meshGenRenderHeightREd.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        meshGenRenderHeightREd.setBounds(328, 48, 100, 24);
        panel_3.add(meshGenRenderHeightREd);
        meshGenSliceCountREd = new JWFNumberField();
        meshGenSliceCountREd.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                if (tinaController != null && tinaController.getMeshGenController() != null) {
                    tinaController.getMeshGenController().sliceCount_changed();
                }
            }
        });
        meshGenSliceCountREd.setHasMaxValue(true);
        meshGenSliceCountREd.setMinValue(2.0);
        meshGenSliceCountREd.setOnlyIntegers(true);
        meshGenSliceCountREd.setValueStep(1.0);
        meshGenSliceCountREd.setText("");
        meshGenSliceCountREd.setSize(new Dimension(100, 24));
        meshGenSliceCountREd.setPreferredSize(new Dimension(100, 24));
        meshGenSliceCountREd.setMaxValue(4096.0);
        meshGenSliceCountREd.setLocation(new Point(71, 76));
        meshGenSliceCountREd.setHasMinValue(true);
        meshGenSliceCountREd.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        meshGenSliceCountREd.setBounds(148, 24, 100, 24);
        panel_3.add(meshGenSliceCountREd);
        JLabel lblNumberOfSlices = new JLabel();
        lblNumberOfSlices.setText("Total number of slices");
        lblNumberOfSlices.setSize(new Dimension(68, 22));
        lblNumberOfSlices.setPreferredSize(new Dimension(94, 22));
        lblNumberOfSlices.setName("");
        lblNumberOfSlices.setLocation(new Point(6, 76));
        lblNumberOfSlices.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        lblNumberOfSlices.setBounds(0, 26, 151, 22);
        panel_3.add(lblNumberOfSlices);
        JLabel lblSlicesPerPass = new JLabel();
        lblSlicesPerPass.setText("Slices per pass (for speedup)");
        lblSlicesPerPass.setSize(new Dimension(68, 22));
        lblSlicesPerPass.setPreferredSize(new Dimension(94, 22));
        lblSlicesPerPass.setName("");
        lblSlicesPerPass.setLocation(new Point(4, 76));
        lblSlicesPerPass.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        lblSlicesPerPass.setBounds(0, 50, 151, 22);
        panel_3.add(lblSlicesPerPass);
        meshGenSlicesPerRenderREd = new JWFNumberField();
        meshGenSlicesPerRenderREd.setMinValue(1.0);
        meshGenSlicesPerRenderREd.setOnlyIntegers(true);
        meshGenSlicesPerRenderREd.setValueStep(1.0);
        meshGenSlicesPerRenderREd.setText("");
        meshGenSlicesPerRenderREd.setSize(new Dimension(100, 24));
        meshGenSlicesPerRenderREd.setPreferredSize(new Dimension(100, 24));
        meshGenSlicesPerRenderREd.setMaxValue(1.0);
        meshGenSlicesPerRenderREd.setLocation(new Point(71, 76));
        meshGenSlicesPerRenderREd.setHasMinValue(true);
        meshGenSlicesPerRenderREd.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        meshGenSlicesPerRenderREd.setBounds(148, 48, 100, 24);
        panel_3.add(meshGenSlicesPerRenderREd);
        meshGenRenderQualityREd = new JWFNumberField();
        meshGenRenderQualityREd.setMinValue(10.0);
        meshGenRenderQualityREd.setOnlyIntegers(true);
        meshGenRenderQualityREd.setValueStep(1.0);
        meshGenRenderQualityREd.setText("");
        meshGenRenderQualityREd.setSize(new Dimension(100, 24));
        meshGenRenderQualityREd.setPreferredSize(new Dimension(100, 24));
        meshGenRenderQualityREd.setLocation(new Point(71, 76));
        meshGenRenderQualityREd.setHasMinValue(true);
        meshGenRenderQualityREd.setHasMaxValue(false);
        meshGenRenderQualityREd.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        meshGenRenderQualityREd.setBounds(521, 0, 100, 24);
        panel_3.add(meshGenRenderQualityREd);
        JLabel lblRenderQuality = new JLabel();
        lblRenderQuality.setText("Render quality");
        lblRenderQuality.setSize(new Dimension(68, 22));
        lblRenderQuality.setPreferredSize(new Dimension(94, 22));
        lblRenderQuality.setName("");
        lblRenderQuality.setLocation(new Point(4, 76));
        lblRenderQuality.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        lblRenderQuality.setBounds(441, 0, 79, 22);
        panel_3.add(lblRenderQuality);
        meshGenOutputTypeCmb = new JComboBox();
        meshGenOutputTypeCmb.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                if (tinaController != null && tinaController.getMeshGenController() != null) {
                    tinaController.getMeshGenController().outputTypeCmb_changed();
                }
            }
        });
        meshGenOutputTypeCmb.setToolTipText("Random-flame-generator");
        meshGenOutputTypeCmb.setPreferredSize(new Dimension(110, 24));
        meshGenOutputTypeCmb.setMinimumSize(new Dimension(110, 24));
        meshGenOutputTypeCmb.setMaximumSize(new Dimension(32767, 24));
        meshGenOutputTypeCmb.setMaximumRowCount(48);
        meshGenOutputTypeCmb.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        meshGenOutputTypeCmb.setBounds(149, 0, 279, 24);
        panel_3.add(meshGenOutputTypeCmb);
        JLabel lblOutputType = new JLabel();
        lblOutputType.setText("Output type");
        lblOutputType.setSize(new Dimension(68, 22));
        lblOutputType.setPreferredSize(new Dimension(94, 22));
        lblOutputType.setName("");
        lblOutputType.setLocation(new Point(6, 76));
        lblOutputType.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        lblOutputType.setBounds(0, 2, 151, 22);
        panel_3.add(lblOutputType);
        meshGenCellSizeREd = new JWFNumberField();
        meshGenCellSizeREd.setMinValue(RasterPointCloud.MIN_OCTREE_CELL_SIZE);
        meshGenCellSizeREd.setMaxValue(RasterPointCloud.MAX_OCTREE_CELL_SIZE);
        meshGenCellSizeREd.setValueStep(0.001);
        meshGenCellSizeREd.setText("");
        meshGenCellSizeREd.setSize(new Dimension(100, 24));
        meshGenCellSizeREd.setPreferredSize(new Dimension(100, 24));
        meshGenCellSizeREd.setLocation(new Point(71, 76));
        meshGenCellSizeREd.setHasMinValue(true);
        meshGenCellSizeREd.setHasMaxValue(true);
        meshGenCellSizeREd.setFont(new Font("Dialog", Font.PLAIN, 10));
        meshGenCellSizeREd.setBounds(521, 26, 100, 24);
        panel_3.add(meshGenCellSizeREd);
        JLabel lblCellSize = new JLabel();
        lblCellSize.setToolTipText("The smaller the cellsize the more detail is generated, and vice versa");
        lblCellSize.setText("Cell size");
        lblCellSize.setSize(new Dimension(68, 22));
        lblCellSize.setPreferredSize(new Dimension(94, 22));
        lblCellSize.setName("");
        lblCellSize.setLocation(new Point(4, 76));
        lblCellSize.setFont(new Font("Dialog", Font.BOLD, 10));
        lblCellSize.setBounds(441, 26, 79, 22);
        panel_3.add(lblCellSize);
        JPanel panel_8 = new JPanel();
        panel_8.setPreferredSize(new Dimension(132, 10));
        panel_1.add(panel_8, BorderLayout.EAST);
        meshGenGenerateBtn = new JButton();
        meshGenGenerateBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                tinaController.getMeshGenController().generateButton_clicked();
            }
        });
        panel_8.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        meshGenGenerateBtn.setText("Render slices");
        meshGenGenerateBtn.setIcon(new ImageIcon(TinaInternalFrame.class.getResource("/org/jwildfire/swing/icons/new/sports-soccer.png")));
        meshGenGenerateBtn.setPreferredSize(new Dimension(132, 46));
        meshGenGenerateBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        panel_8.add(meshGenGenerateBtn);
    }
    return panel_89;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) ItemEvent(java.awt.event.ItemEvent) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) ActionEvent(java.awt.event.ActionEvent) JProgressBar(javax.swing.JProgressBar) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Point(java.awt.Point) TitledBorder(javax.swing.border.TitledBorder) Font(java.awt.Font) BorderLayout(java.awt.BorderLayout) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) ChangeListener(javax.swing.event.ChangeListener) ItemListener(java.awt.event.ItemListener)

Example 23 with JProgressBar

use of javax.swing.JProgressBar in project JWildfire by thargor6.

the class MutaGenInternalFrame method getPanel_71.

private JPanel getPanel_71() {
    if (panel_71 == null) {
        panel_71 = new JPanel();
        panel_71.setPreferredSize(new Dimension(10, 24));
        panel_71.setMinimumSize(new Dimension(8, 100));
        panel_71.setLayout(new BorderLayout(0, 0));
        mutaGenProgressBar = new JProgressBar();
        panel_71.add(mutaGenProgressBar);
    }
    return panel_71;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JProgressBar(javax.swing.JProgressBar) Dimension(java.awt.Dimension)

Example 24 with JProgressBar

use of javax.swing.JProgressBar in project JWildfire by thargor6.

the class TinaInternalFrame method getRenderProgressBar.

public JProgressBar getRenderProgressBar() {
    if (renderProgressBar == null) {
        renderProgressBar = new JProgressBar();
        renderProgressBar.setValue(0);
        renderProgressBar.setSize(new Dimension(175, 14));
        renderProgressBar.setLocation(new Point(273, 9));
        renderProgressBar.setPreferredSize(new Dimension(169, 14));
        renderProgressBar.setStringPainted(true);
    }
    return renderProgressBar;
}
Also used : JProgressBar(javax.swing.JProgressBar) Dimension(java.awt.Dimension) Point(java.awt.Point)

Example 25 with JProgressBar

use of javax.swing.JProgressBar in project Spark by igniterealtime.

the class CheckUpdates method downloadUpdate.

public void downloadUpdate(final File downloadedFile, final SparkVersion version) {
    final java.util.Timer timer = new java.util.Timer();
    // Prepare HTTP post
    final GetMethod post = new GetMethod(version.getDownloadURL());
    // Get HTTP client
    Protocol.registerProtocol("https", new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
    final HttpClient httpclient = new HttpClient();
    String proxyHost = System.getProperty("http.proxyHost");
    String proxyPort = System.getProperty("http.proxyPort");
    if (ModelUtil.hasLength(proxyHost) && ModelUtil.hasLength(proxyPort)) {
        try {
            httpclient.getHostConfiguration().setProxy(proxyHost, Integer.parseInt(proxyPort));
        } catch (NumberFormatException e) {
            Log.error(e);
        }
    }
    try {
        int result = httpclient.executeMethod(post);
        if (result != 200) {
            return;
        }
        long length = post.getResponseContentLength();
        int contentLength = (int) length;
        bar = new JProgressBar(0, contentLength);
    } catch (IOException e) {
        Log.error(e);
    }
    final JFrame frame = new JFrame(Res.getString("title.downloading.im.client"));
    frame.setIconImage(SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE).getImage());
    titlePanel = new TitlePanel(Res.getString("title.upgrading.client"), Res.getString("message.version", version.getVersion()), SparkRes.getImageIcon(SparkRes.SEND_FILE_24x24), true);
    final Thread thread = new Thread(() -> {
        try {
            InputStream stream = post.getResponseBodyAsStream();
            long size = post.getResponseContentLength();
            ByteFormat formater = new ByteFormat();
            sizeText = formater.format(size);
            titlePanel.setDescription(Res.getString("message.version", version.getVersion()) + " \n" + Res.getString("message.file.size", sizeText));
            downloadedFile.getParentFile().mkdirs();
            FileOutputStream out = new FileOutputStream(downloadedFile);
            copy(stream, out);
            out.close();
            if (!cancel) {
                downloadComplete = true;
                promptForInstallation(downloadedFile, Res.getString("title.download.complete"), Res.getString("message.restart.spark"));
            } else {
                out.close();
                downloadedFile.delete();
            }
            UPDATING = false;
            frame.dispose();
        } catch (Exception ex) {
        // Nothing to do
        } finally {
            timer.cancel();
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
        }
    });
    frame.getContentPane().setLayout(new GridBagLayout());
    frame.getContentPane().add(titlePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    frame.getContentPane().add(bar, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    JEditorPane pane = new JEditorPane();
    boolean displayContentPane = version.getChangeLogURL() != null || version.getDisplayMessage() != null;
    try {
        pane.setEditable(false);
        if (version.getChangeLogURL() != null) {
            pane.setEditorKit(new HTMLEditorKit());
            pane.setPage(version.getChangeLogURL());
        } else if (version.getDisplayMessage() != null) {
            pane.setText(version.getDisplayMessage());
        }
        if (displayContentPane) {
            frame.getContentPane().add(new JScrollPane(pane), new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
        }
    } catch (IOException e) {
        Log.error(e);
    }
    frame.getContentPane().setBackground(Color.WHITE);
    frame.pack();
    if (displayContentPane) {
        frame.setSize(600, 400);
    } else {
        frame.setSize(400, 100);
    }
    frame.setLocationRelativeTo(SparkManager.getMainWindow());
    GraphicUtils.centerWindowOnScreen(frame);
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent windowEvent) {
            thread.interrupt();
            cancel = true;
            UPDATING = false;
            if (!downloadComplete) {
                UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
                JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Res.getString("message.updating.cancelled"), Res.getString("title.cancelled"), JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    frame.setVisible(true);
    thread.start();
    timer.scheduleAtFixedRate(new TimerTask() {

        int seconds = 1;

        public void run() {
            ByteFormat formatter = new ByteFormat();
            long value = bar.getValue();
            long average = value / seconds;
            String text = formatter.format(average) + "/Sec";
            String total = formatter.format(value);
            titlePanel.setDescription(Res.getString("message.version", version.getVersion()) + " \n" + Res.getString("message.file.size", sizeText) + "\n" + Res.getString("message.transfer.rate") + ": " + text + "\n" + Res.getString("message.total.downloaded") + ": " + total);
            seconds++;
        }
    }, 1000, 1000);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JProgressBar(javax.swing.JProgressBar) WindowAdapter(java.awt.event.WindowAdapter) TimerTask(java.util.TimerTask) JFrame(javax.swing.JFrame) ByteFormat(org.jivesoftware.spark.util.ByteFormat) Protocol(org.apache.commons.httpclient.protocol.Protocol) JScrollPane(javax.swing.JScrollPane) InputStream(java.io.InputStream) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) IOException(java.io.IOException) TitlePanel(org.jivesoftware.spark.component.TitlePanel) IOException(java.io.IOException) HttpClient(org.apache.commons.httpclient.HttpClient) FileOutputStream(java.io.FileOutputStream) WindowEvent(java.awt.event.WindowEvent) GetMethod(org.apache.commons.httpclient.methods.GetMethod) JEditorPane(javax.swing.JEditorPane)

Aggregations

JProgressBar (javax.swing.JProgressBar)87 JLabel (javax.swing.JLabel)53 JPanel (javax.swing.JPanel)40 JButton (javax.swing.JButton)32 Dimension (java.awt.Dimension)30 BorderLayout (java.awt.BorderLayout)28 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 FlowLayout (java.awt.FlowLayout)12 JCheckBox (javax.swing.JCheckBox)12 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