source: git/Singular/LIB/surfex/ProgressFrame.java @ 3de2ca

spielwiese
Last change on this file since 3de2ca was 3de2ca, checked in by Hans Schönemann <hannes@…>, 16 years ago
*hannes: surfex_0_90_00 git-svn-id: file:///usr/local/Singular/svn/trunk@11070 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.6 KB
Line 
1////////////////////////////////////////////////////////////////////////
2//
3// This file ProgressFrame.java is part of SURFEX.
4//
5////////////////////////////////////////////////////////////////////////
6
7////////////////////////////////////////////////////////////////////////
8//
9// SURFEX version 0.90.00
10// =================
11//
12// Saarland University at Saarbruecken, Germany
13// Department of Mathematics and Computer Science
14//
15// SURFEX on the web: www.surfex.AlgebraicSurface.net
16//
17// Authors: Oliver Labs (2001-2008), Stephan Holzer (2004-2005)
18//
19// Copyright (C) 2001-2008
20//
21//
22// *NOTICE*
23// ========
24// 
25// This program is free software; you can redistribute it and/or modify it
26// under the terms of the GNU General Public License as published by the
27// Free Software Foundation ( version 3 or later of the License ).
28//
29// See LICENCE.TXT for details.
30//
31/////////////////////////////////////////////////////////////////////////
32
33import java.awt.*;
34import java.awt.event.*;
35import javax.swing.*;
36
37public class ProgressFrame extends JPanel
38                             implements ActionListener {
39    public final static int ONE_SECOND = 1000;
40
41    private JProgressBar progressBar;
42    private Timer timer;
43    private JButton startButton;
44   // private LongTask task;
45    private JTextArea taskOutput;
46    private String newline = "\n";
47   
48    public boolean processCanceled=false;
49
50    JButton playMovieButton=new JButton("play Movie");
51
52    JButton cancelButton=new JButton("cancel");
53
54    JButton closeButton=new JButton("close");
55   
56    JLabel previewLabel=new JLabel(new ImageIcon("prevstart.jpg"));
57
58    public ProgressFrame(int LengthOfTask) {
59        super(new BorderLayout());
60        //task = new LongTask();
61
62
63        ImageIcon i=new ImageIcon();
64       
65        progressBar = new JProgressBar(0, LengthOfTask);
66        progressBar.setValue(0);
67        progressBar.setStringPainted(true);
68
69        taskOutput = new JTextArea(5, 20);
70        taskOutput.setMargin(new Insets(5,5,5,5));
71        taskOutput.setEditable(false);
72        taskOutput.setCursor(null); //inherit the panel's cursor
73                                    //see bug 4851758
74
75        //Create and set up the content pane.
76        JPanel pane=new JPanel(new BorderLayout());
77        JPanel progressPanel = new JPanel(new BorderLayout());
78        progressPanel.add(progressBar,BorderLayout.NORTH);
79        progressPanel.add(new JScrollPane(taskOutput),BorderLayout.CENTER);
80      //  progressPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
81
82        pane.add(progressPanel,BorderLayout.NORTH);
83        JPanel previewPanel =new JPanel(new BorderLayout());
84        previewPanel.add(new JLabel("last frame:"),BorderLayout.WEST);
85        //previewLabel.setSize(100,100);
86        previewPanel.add(new JScrollPane(previewLabel),BorderLayout.CENTER);
87        pane.add(previewPanel,BorderLayout.CENTER);
88    //    System.out.println("dsfkgreg--------------");
89        JPanel controlPanel=new JPanel(new GridLayout(1,3));
90       
91        playMovieButton.setEnabled(false);
92        controlPanel.add(playMovieButton); 
93        cancelButton.addActionListener(new ActionListener(){
94                public void actionPerformed(ActionEvent ae){
95                        processCanceled=true;
96                }
97               
98        });
99        controlPanel.add(cancelButton);
100    //    controlPanel.add(closeButton);
101        pane.add(controlPanel,BorderLayout.SOUTH);
102       // newContentPane.setOpaque(true); //content panes must be opaque
103        //frame.setContentPane(pane);
104       
105       
106        //JPanel panel = new JPanel();
107        //panel.add(progressBar);
108
109        add(pane, BorderLayout.CENTER);
110       //add(new JScrollPane(taskOutput), BorderLayout.CENTER);
111        setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
112
113       
114    }
115
116    /**
117     * Called when the user presses the start button.
118     */
119    public void actionPerformed(ActionEvent evt) {
120        startButton.setEnabled(false);
121        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
122     //   task.go();
123        timer.start();
124    }
125
126
127
128    public void refresh(int progress, String Message){
129        progressBar.setValue(progress);
130//      System.out.println("---");
131        String s = Message;
132        if (s != null) {
133            taskOutput.append(s + newline);
134            taskOutput.setCaretPosition(
135                taskOutput.getDocument().getLength());
136        }
137       
138    }
139   
140    public void refresh(int progress, String Message, String prevFileLoc){
141              refresh(progress, Message);
142             // previewLabel.setText(prevFileLoc);
143              previewLabel.setIcon(new ImageIcon(prevFileLoc));
144//            System.out.println("preview update");
145    }
146   
147}
148
Note: See TracBrowser for help on using the repository browser.