source: trunk/gli/src/org/greenstone/gatherer/collection/ExportCollectionPrompt.java@ 8243

Last change on this file since 8243 was 8243, checked in by mdewsnip, 20 years ago

Removed all occurrences of classes explicitly importing other classes in the same package.

  • Property svn:keywords set to Author Date Id Revision
File size: 23.3 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer.collection;
38
39import java.awt.*;
40import java.awt.event.*;
41import java.io.*;
42import java.util.ArrayList;
43import javax.swing.*;
44import javax.swing.event.*;
45import org.greenstone.gatherer.Configuration;
46import org.greenstone.gatherer.DebugStream;
47import org.greenstone.gatherer.Dictionary;
48import org.greenstone.gatherer.Gatherer;
49import org.greenstone.gatherer.checklist.CheckList;
50import org.greenstone.gatherer.checklist.Entry;
51import org.greenstone.gatherer.gui.GLIButton;
52import org.greenstone.gatherer.gui.ModalDialog;
53import org.greenstone.gatherer.gui.SimpleMenuBar;
54import org.greenstone.gatherer.shell.GShell;
55import org.greenstone.gatherer.shell.GShellEvent;
56import org.greenstone.gatherer.shell.GShellListener;
57import org.greenstone.gatherer.util.ArrayTools;
58import org.greenstone.gatherer.util.GSDLSiteConfig;
59import org.greenstone.gatherer.util.StaticStrings;
60import org.greenstone.gatherer.util.Utility;
61
62/** This class provides the functionality to export current collections from the GSDLHOME/collect/ directory to CDROM. The user chooses the collection from a list, where each entry also displays details about itself, confirms the delete of a collection by checking a checkbox then presses the ok button to actually delete the collection.
63 Copied from DeleteCollectionPrompt
64 * @author John Thompson, Greenstone Digital Library, University of Waikato
65 * @version 2.3
66 */
67public class ExportCollectionPrompt
68 extends ModalDialog
69 implements GShellListener {
70
71 private OKButtonListener ok_button_listener;
72 private ArrayList all_collections = null;
73 private ArrayList selected_collections = null;
74 /** The list of collections to export */
75 private CheckList list = null;
76 /** The currently selected collection for deletion. */
77 private BasicCollectionConfiguration collection = null;
78 /** The model behind the list. */
79 private DefaultListModel list_model = null;
80 /** A reference to ourself so any inner-classes can dispose of us. */
81 private ExportCollectionPrompt prompt = null;
82 /** The close button, which exits the prompt without deleting anything. */
83 private JButton cancel_button = null;
84 /** The ok button which causes the selected collection to be deleted. */
85 private JButton ok_button = null;
86 /** The label above details. */
87 private JLabel details_label = null;
88 /** The label above the list. */
89 private JLabel list_label = null;
90 /** The list of available collections. */
91 //private JList list = null;
92 /** The text area used to display details about the collection selected. */
93 private JTextArea details_textarea = null;
94 /** The text area used to display instructions for the export */
95 private JTextArea instructions_textarea;
96 /** A string array used to pass arguments to the phrase retrieval method. */
97 private JTextField title_field = null;
98 private JLabel title_label = null;
99 private String args[] = null;
100 private String cd_title = null;
101 /** whether the exporting was successful or not */
102 private boolean successful = false;
103 /** whether we are trying to export or not */
104 private boolean exporting = false;
105 /** the error message if any */
106 private StringBuffer error_message = null;
107 /** The size of the export prompt screen. */
108 public static final Dimension SIZE = new Dimension(500, 500);
109
110 /** Constructor.
111 * @see org.greenstone.gatherer.collection.ExportCollectionPrompt.CancelButtonListener
112 * @see org.greenstone.gatherer.collection.ExportCollectionPrompt.CollectionListListener
113 * @see org.greenstone.gatherer.collection.ExportCollectionPrompt.OKButtonListener
114 */
115 public ExportCollectionPrompt() {
116 super(Gatherer.g_man, true);
117 cancel_button = new GLIButton();
118 cancel_button.setMnemonic(KeyEvent.VK_C);
119 Dictionary.setBoth(cancel_button, "General.Close", "General.Close_Tooltip");
120 details_textarea = new JTextArea();
121 details_textarea.setEditable(false);
122 details_textarea.setFont(Configuration.getFont("general.tooltip_font", false));
123 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
124 details_label = new JLabel();
125 Dictionary.setText(details_label, "DeleteCollectionPrompt.Collection_Details");
126
127 instructions_textarea = new JTextArea();
128 instructions_textarea.setCaretPosition(0);
129 instructions_textarea.setEditable(false);
130 instructions_textarea.setLineWrap(true);
131 instructions_textarea.setRows(4);
132 instructions_textarea.setWrapStyleWord(true);
133 Dictionary.registerText(instructions_textarea, "ExportCollectionPrompt.Instructions");
134
135 //list = new JList();
136 //list_model = new DefaultListModel();
137 all_collections = new ArrayList();
138 list = new CheckList(true);
139 list_label = new JLabel();
140 Dictionary.setText(list_label, "DeleteCollectionPrompt.Collection_List");
141 ok_button = new GLIButton();
142 ok_button.setMnemonic(KeyEvent.VK_D);
143 Dictionary.setBoth(ok_button, "ExportCollectionPrompt.Export", "ExportCollectionPrompt.Export_Tooltip");
144
145 title_field = new JTextField();
146 Dictionary.setTooltip(title_field, "ExportCollectionPrompt.CD_Name_Tooltip");
147 title_label = new JLabel();
148 Dictionary.setText(title_label, "ExportCollectionPrompt.CD_Name");
149 scanForCollections();
150 list.setListData(all_collections.toArray());
151
152 prompt = this;
153 setSize(SIZE);
154 Dictionary.setText(this, "ExportCollectionPrompt.Title");
155
156 setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
157 cancel_button.addActionListener(new CancelButtonListener());
158 list.addListSelectionListener(new CollectionListListener());
159 list.clearSelection();
160 list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
161 ok_button_listener = new OKButtonListener();
162 ok_button.addActionListener(ok_button_listener);
163 ok_button.setEnabled(false);
164 //title.getDocument().addDocumentListener(new DocumentListener());
165 }
166
167 /** Destructor. */
168 public void destroy() {
169 all_collections.clear();
170 all_collections = null;
171 cancel_button = null;
172 details_textarea = null;
173 details_label = null;
174 list = null;
175 ok_button = null;
176 prompt = null;
177 if (selected_collections!=null) {
178 selected_collections.clear();
179 selected_collections = null;
180 }
181 title_field = null;
182 title_label = null;
183 }
184
185 /** This method causes the modal prompt to be displayed.
186 * returns true if it has exported the collections that are currently selected */
187 public boolean display() {
188 // Top pane
189 JPanel instructions_pane = new JPanel(new BorderLayout());
190 instructions_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
191 instructions_pane.add(new JScrollPane(instructions_textarea), BorderLayout.CENTER);
192
193 title_label.setBorder(BorderFactory.createEmptyBorder(0,5,0,15));
194
195 JPanel title_pane = new JPanel(new BorderLayout());
196 title_pane.add(title_label, BorderLayout.WEST);
197 title_pane.add(title_field, BorderLayout.CENTER);
198 instructions_pane.add(title_pane, BorderLayout.SOUTH);
199
200 // Central pane
201 JPanel list_pane = new JPanel(new BorderLayout());
202 list_pane.add(list_label, BorderLayout.NORTH);
203 list_pane.add(new JScrollPane(list), BorderLayout.CENTER);
204 list_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
205
206 JPanel details_pane = new JPanel(new BorderLayout());
207 details_pane.add(details_label, BorderLayout.NORTH);
208 details_pane.add(new JScrollPane(details_textarea), BorderLayout.CENTER);
209 details_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
210
211 JPanel central_pane = new JPanel(new GridLayout(2, 1));
212 central_pane.add(list_pane);
213 central_pane.add(details_pane);
214 central_pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
215
216 // Lower pane
217 JPanel button_pane = new JPanel(new GridLayout(1, 2));
218 button_pane.add(ok_button);
219 button_pane.add(cancel_button);
220 button_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
221
222 JPanel lower_pane = new JPanel(new BorderLayout());
223 lower_pane.add(button_pane, BorderLayout.SOUTH);
224 lower_pane.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
225
226 // Final.
227 JPanel content_pane = (JPanel)this.getContentPane();
228 content_pane.setLayout(new BorderLayout());
229 content_pane.add(instructions_pane, BorderLayout.NORTH);
230 content_pane.add(central_pane, BorderLayout.CENTER);
231 content_pane.add(lower_pane, BorderLayout.SOUTH);
232
233 // Center and display.
234 Dimension screen_size = Configuration.screen_size;
235 this.setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
236 this.setVisible(true); // blocks until the dialog is killed
237 return true;
238
239 }
240
241
242 /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor.
243 * @see org.greenstone.gatherer.Configuration
244 * @see org.greenstone.gatherer.Gatherer
245 * @see org.greenstone.gatherer.collection.Collection
246 * @see org.greenstone.gatherer.gui.BuildOptions
247 * @see org.greenstone.gatherer.shell.GShell
248 * @see org.greenstone.gatherer.shell.GShellListener
249 * @see org.greenstone.gatherer.shell.GShellProgressMonitor
250 * @see org.greenstone.gatherer.util.Utility
251 */
252 public void exportCollections() {
253 DebugStream.println("ExportCollectionPrompt.exportCollection()");
254
255 int num_collections = selected_collections.size();
256 if (num_collections == 0) return;
257 cd_title = title_field.getText();
258 cd_title = cd_title.trim();
259 cd_title = cd_title.replaceAll("\"","");
260 int num_args = num_collections + 4;
261 boolean has_title = false;
262 if (!cd_title.equals("")) {
263 num_args += 2;
264 has_title = true;
265 }
266 String args[];
267 int next_arg = 0;
268 if(Utility.isWindows()) {
269 args = new String[num_args+2];
270 args[0] = Configuration.perl_path;
271 args[1] = "-S";
272 next_arg = 2;
273 } else {
274 args = new String[num_args];
275 }
276
277 args[next_arg] = Configuration.getScriptPath() + "exportcol.pl";
278 next_arg++;
279 args[next_arg] = "-gli"; next_arg++;
280 args[next_arg] = "-language"; next_arg++;
281 args[next_arg] = Configuration.getLanguage(); next_arg++;
282
283 if (has_title) {
284 args[next_arg] = "-cdname"; next_arg++;
285 args[next_arg] = cd_title; next_arg++;
286 }
287 for (int i=0; i<num_collections;i++,next_arg++) {
288 args[next_arg] = ((BasicCollectionConfiguration)selected_collections.get(i)).getShortName();
289 }
290
291 DebugStream.print("export command = ");
292 for (int i=0; i<args.length; i++) {
293 DebugStream.print(args[i]+" ");
294 }
295 DebugStream.println("");
296 GShell process = new GShell(args, GShell.EXPORT, 3, this, null, GShell.GSHELL_EXPORT);
297 process.start();
298 //process.run();
299 DebugStream.println("ExportCollectionPrompt.exportCollection().return");
300 }
301
302 /** Shows an export complete prompt.
303 * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
304 * @see org.greenstone.gatherer.collection.Collection
305 */
306 public void resultPrompt(boolean success, String extra) {
307 args = new String[2];
308 StringBuffer coll_names = new StringBuffer();
309 for (int i=0; i<selected_collections.size();i++) {
310 if (i>0) {
311 coll_names.append(", ");
312 }
313 BasicCollectionConfiguration complete_collection = (BasicCollectionConfiguration)selected_collections.get(i);
314 coll_names.append(complete_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + complete_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER);
315 complete_collection = null;
316 }
317
318 args[0] = coll_names.toString();
319 args[1] = Configuration.gsdl_path+"tmp"+File.separator;
320 if(cd_title.equals("")) {
321 args[1] += "exported_collections";
322 } else {
323 args[1] += "exported_"+cd_title.replaceAll("\\s","");
324 }
325 ResultDialog result_dialog = new ResultDialog(success, extra, args);
326 result_dialog.setVisible(true); // Blocks
327 result_dialog.dispose();
328 result_dialog = null;
329 /*
330 if (success) {
331 JOptionPane.showMessageDialog(prompt,Dictionary.get("ExportCollectionPrompt.Successful_Export", args)+"\n\n"+Dictionary.get("ExportCollectionPrompt.Output")+"\n"+extra, Dictionary.get("ExportCollectionPrompt.Successful_Title"),JOptionPane.INFORMATION_MESSAGE);
332 }
333 else {
334 JOptionPane.showMessageDialog(prompt,Dictionary.get("ExportCollectionPrompt.Failed_Export", args)+"\n\n"+Dictionary.get("ExportCollectionPrompt.Output")+"\n"+extra, Dictionary.get("ExportCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE);
335 }
336 */
337 }
338
339 /** Method to scan the collect directory retrieving and reloading each collection it finds, while building the list of known collections.
340 * @see org.greenstone.gatherer.Configuration
341 * @see org.greenstone.gatherer.Gatherer
342 * @see org.greenstone.gatherer.util.ArrayTools
343 * @see org.greenstone.gatherer.util.Utility
344 */
345 private void scanForCollections() {
346 // Start at the collect dir.
347 File collect_directory;
348 if (Gatherer.GS3) {
349 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
350 } else {
351 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
352 }
353 if(collect_directory.exists()) {
354 // Now for each child directory see if it contains a .col file and
355 // if so try to load it..
356 File collections[] = collect_directory.listFiles();
357 ArrayTools.sort(collections);
358 for(int i = 0; collections != null && i < collections.length; i++) {
359 if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
360 File config_file = new File(collections[i], Utility.CONFIG_FILE);
361 if (config_file.exists()) {
362 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
363 all_collections.add(config);
364 config = null;
365 }
366 }
367 }
368 }
369 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
370 }
371
372
373 /** All implementation of GShellListener must include this method so the listener can be informed of messages from the GShell.
374 * @param event A <strong>GShellEvent</strong> that contains, amoung other things, the message.
375 */
376 public synchronized void message(GShellEvent event) {
377 // Ignore the messages from RecPlug with 'show_progress' set (used for progress bars)
378 String message = event.getMessage();
379 if (message.startsWith("exportcol.pl>")) {
380 message = message.substring(13);
381 //DebugStream.println("message = "+event.getMessage());
382 error_message.append(message);
383 error_message.append("\n");
384 }
385 }
386
387 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell begins its task. Implementation side-effect, not actually used.
388 * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement.
389 */
390 public synchronized void processBegun(GShellEvent event) {
391 // We don't care.
392 }
393 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell completes its task.
394 * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion.
395 */
396 public synchronized void processComplete(GShellEvent event) {
397 successful = false;
398 if(event.getStatus() == GShell.OK) {
399 if(event.getType() == GShell.EXPORT) {
400 successful = true;
401 }
402 }
403 ok_button_listener.processComplete();
404 }
405
406 /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
407 private class CancelButtonListener
408 implements ActionListener {
409 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
410 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
411 */
412 public void actionPerformed(ActionEvent event) {
413 prompt.dispose();
414 }
415 }
416
417 /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
418 */
419 private class CollectionListListener
420 implements ListSelectionListener {
421 /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
422 * @param event a <strong>ListSelectionEvent</strong> containing all the relevant information garnered from the event itself
423 */
424 public void valueChanged(ListSelectionEvent event) {
425 ok_button.setEnabled(false);
426 if(!list.isSelectionEmpty()) {
427 collection = (BasicCollectionConfiguration) ((Entry)list.getSelectedValue()).getObject();
428 args = new String[5];
429 args[0] = collection.getName();
430 args[1] = collection.getShortName();
431 args[2] = collection.getCreator();
432 args[3] = collection.getMaintainer();
433 args[4] = collection.getDescription();
434 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
435 details_textarea.setCaretPosition(0);
436 ok_button.setEnabled(true);
437 }
438 else {
439 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
440 ok_button.setEnabled(false);
441 }
442 }
443 }
444
445 /** The OK button listener implementation. */
446 private class OKButtonListener
447 implements ActionListener {
448 private Component glass_pane;
449 private MouseListener mouse_blocker_listener;
450 private ProgressDialog progress_dialog;
451
452 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
453 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
454 * @see org.greenstone.gatherer.Configuration
455 * @see org.greenstone.gatherer.Gatherer
456 * @see org.greenstone.gatherer.util.Utility
457 */
458 public void actionPerformed(ActionEvent event) {
459 ///ystem.err.println("OK Clicked");
460 // Make sure there are some colls specified
461 selected_collections = list.getSelected();
462 error_message = new StringBuffer();
463
464 // Set the cursor to hourglass
465 glass_pane = getGlassPane();
466 mouse_blocker_listener = new MouseAdapter() {};
467 glass_pane.addMouseListener(mouse_blocker_listener);
468 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
469 glass_pane.setVisible(true);
470
471 // Export the selected collection.
472 ///ystem.err.println("Export collections");
473 exportCollections();
474
475 // Show progress dialog
476 ///ystem.err.println("Showing progress dialog");
477 progress_dialog = new ProgressDialog();
478 progress_dialog.setVisible(true);
479 }
480
481 public void processComplete() {
482 ///ystem.err.println("Process complete");
483 // Dispose of progress dialog
484 progress_dialog.setVisible(false);
485 progress_dialog.dispose();
486 progress_dialog = null;
487
488 // unset the cursor
489 glass_pane.setVisible(false);
490 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
491 glass_pane.removeMouseListener(mouse_blocker_listener);
492 glass_pane = null;
493 mouse_blocker_listener= null;
494
495 if (successful) {
496 resultPrompt(true, error_message.toString());
497 } else {
498 resultPrompt(false, error_message.toString());
499 }
500 error_message = null;
501 }
502
503 private class ProgressDialog
504 extends ModalDialog {
505
506 private Dimension size = new Dimension(400,65);
507
508 public ProgressDialog() {
509 super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Title"), true);
510 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
511 setSize(size);
512 JPanel content_pane = (JPanel) getContentPane();
513 JLabel progress_label = new JLabel();
514 Dictionary.setText(progress_label, "ExportCollectionPrompt.Progress_Label");
515 JProgressBar progress_bar = new JProgressBar();
516 progress_bar.setIndeterminate(true);
517 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
518 content_pane.setLayout(new BorderLayout());
519 content_pane.add(progress_label, BorderLayout.NORTH);
520 content_pane.add(progress_bar, BorderLayout.CENTER);
521 // Position
522 Rectangle frame_bounds = Gatherer.g_man.getBounds();
523 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
524 }
525 }
526 }
527
528 private class ResultDialog
529 extends ModalDialog {
530
531 private Dimension size = new Dimension(600,300);
532 private ResultDialog self;
533
534 public ResultDialog(boolean success, String extra, String [] args) {
535 super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Successful_Title"), true);
536
537 this.self = this;
538
539 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
540 setSize(size);
541
542 JPanel content_pane = (JPanel) getContentPane();
543 JLabel result_label = new JLabel();
544 if(success) {
545 Dictionary.registerText(result_label, "ExportCollectionPrompt.Successful_Export", args);
546 }
547 else {
548 Dictionary.registerText(result_label, "ExportCollectionPrompt.Failed_Export", args);
549 }
550
551 JPanel button_pane = new JPanel();
552 JButton close_button = new GLIButton("Close");
553 close_button.setMnemonic(KeyEvent.VK_C);
554 close_button.addActionListener(new CloseButtonListener());
555
556 JPanel output_pane = new JPanel();
557 JLabel output_label = new JLabel();
558 Dictionary.registerText(output_label, "ExportCollectionPrompt.Output");
559
560 JTextArea output_textarea = new JTextArea(extra);
561 output_textarea.setCaretPosition(0);
562 output_textarea.setEditable(false);
563 output_textarea.setLineWrap(true);
564 output_textarea.setWrapStyleWord(true);
565
566 button_pane.setLayout(new BorderLayout());
567 button_pane.add(close_button, BorderLayout.EAST);
568
569 output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
570 output_pane.setLayout(new BorderLayout());
571 output_pane.add(output_label, BorderLayout.NORTH);
572 output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
573
574 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
575 content_pane.setLayout(new BorderLayout());
576 content_pane.add(result_label, BorderLayout.NORTH);
577 content_pane.add(output_pane, BorderLayout.CENTER);
578 content_pane.add(button_pane, BorderLayout.SOUTH);
579
580 // Position
581 Rectangle frame_bounds = Gatherer.g_man.getBounds();
582 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
583 }
584
585 private class CloseButtonListener
586 implements ActionListener {
587 public void actionPerformed(ActionEvent event) {
588 self.setVisible(false);
589 }
590 }
591 }
592}
593
594
595
596
Note: See TracBrowser for help on using the repository browser.