source: git/Singular/LIB/surfex/SurfexStartFrame.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: 3.4 KB
Line 
1////////////////////////////////////////////////////////////////////////
2//
3// This file SurfexStartFrame.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 SurfexStartFrame 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 JLabel taskOutput;
46    private String newline = "\n";
47
48
49    public SurfexStartFrame(int LengthOfTask) {
50        super(new BorderLayout());
51        //task = new LongTask();
52
53        progressBar = new JProgressBar(0, LengthOfTask);
54        progressBar.setValue(0);
55        progressBar.setStringPainted(true);
56
57        taskOutput = new JLabel("                         ");
58//        taskOutput.setEditable(false);
59
60        JPanel panel = new JPanel();
61        panel.add(progressBar);
62
63        ImageIcon pic = new ImageIcon("images/classify_no19.jpg");
64        JLabel labPic = new JLabel(pic);
65
66        add(panel, BorderLayout.CENTER);
67        add(labPic, BorderLayout.NORTH);
68        add(taskOutput, BorderLayout.SOUTH);
69        setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
70    }
71
72    /**
73     * Called when the user presses the start button.
74     */
75    public void actionPerformed(ActionEvent evt) {
76        startButton.setEnabled(false);
77        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
78     //   task.go();
79        timer.start();
80    }
81
82    /**
83     * Create the GUI and show it.  For thread safety,
84     * this method should be invoked from the
85     * event-dispatching thread.
86     */
87    private static void createAndShowGUI() {
88        //Make sure we have nice window decorations.
89        JFrame.setDefaultLookAndFeelDecorated(true);
90
91        //Create and set up the window.
92        JFrame frame = new JFrame("ProgressBarDemo");
93        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
94
95        //Create and set up the content pane.
96        JComponent newContentPane = new ProgressFrame(100);
97        newContentPane.setOpaque(true); //content panes must be opaque
98        frame.setContentPane(newContentPane);
99
100        //Display the window.
101        frame.pack();
102        frame.setVisible(true);
103    }
104
105    public void refresh(int progress, String Message){
106        progressBar.setValue(progress);
107//                    System.out.println(progress+Message);
108        String s = Message;
109        if (s != null) {
110            taskOutput.setText(s);
111            taskOutput.repaint();
112//          taskOutput.append(s + newline);
113//          taskOutput.setCaretPosition(
114//              taskOutput.getDocument().getLength());
115        }
116    }
117}
118
Note: See TracBrowser for help on using the repository browser.