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

Last change on this file since 7281 was 7281, checked in by kjdon, 20 years ago

tidied up some stuff to do with creating BasicCollectionConfigurations - now check for the existence of the config file before creation. and other bits

  • Property svn:keywords set to Author Date Id Revision
File size: 23.2 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.checklist.CheckList;
46import org.greenstone.gatherer.checklist.Entry;
47import org.greenstone.gatherer.Dictionary;
48import org.greenstone.gatherer.Gatherer;
49import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
50import org.greenstone.gatherer.collection.Collection;
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(Gatherer.config.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 = Gatherer.config.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 Gatherer.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] = Gatherer.config.perl_path;
271 args[1] = "-S";
272 next_arg = 2;
273 } else {
274 args = new String[num_args];
275 }
276
277 args[next_arg] = Gatherer.config.getScriptPath() + "exportcol.pl";
278 next_arg++;
279 args[next_arg] = "-gli"; next_arg++;
280 args[next_arg] = "-language"; next_arg++;
281 args[next_arg] = Gatherer.config.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 Gatherer.print("export command = ");
292 for (int i=0; i<args.length; i++) {
293 Gatherer.print(args[i]+" ");
294 }
295 Gatherer.println("");
296 GShell process = new GShell(args, GShell.EXPORT, 3, this, null, GShell.GSHELL_EXPORT);
297 process.start();
298 //process.run();
299 Gatherer.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] = Gatherer.config.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 String collect_directory_name = Utility.getCollectDir(Gatherer.config.gsdl_path);
348 File collect_directory = new File(collect_directory_name);
349 if(collect_directory.exists()) {
350 // Now for each child directory see if it contains a .col file and
351 // if so try to load it..
352 File collections[] = collect_directory.listFiles();
353 ArrayTools.sort(collections);
354 for(int i = 0; collections != null && i < collections.length; i++) {
355 if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
356 File config_file = new File(collections[i], Utility.CONFIG_FILE);
357 if (config_file.exists()) {
358 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
359 all_collections.add(config);
360 config = null;
361 }
362 }
363 }
364 }
365 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
366 }
367
368
369 /** All implementation of GShellListener must include this method so the listener can be informed of messages from the GShell.
370 * @param event A <strong>GShellEvent</strong> that contains, amoung other things, the message.
371 */
372 public synchronized void message(GShellEvent event) {
373 // Ignore the messages from RecPlug with 'show_progress' set (used for progress bars)
374 String message = event.getMessage();
375 if (message.startsWith("exportcol.pl>")) {
376 message = message.substring(13);
377 //Gatherer.println("message = "+event.getMessage());
378 error_message.append(message);
379 error_message.append("\n");
380 }
381 }
382
383 /** 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.
384 * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement.
385 */
386 public synchronized void processBegun(GShellEvent event) {
387 // We don't care.
388 }
389 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell completes its task.
390 * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion.
391 */
392 public synchronized void processComplete(GShellEvent event) {
393 successful = false;
394 if(event.getStatus() == GShell.OK) {
395 if(event.getType() == GShell.EXPORT) {
396 successful = true;
397 }
398 }
399 ok_button_listener.processComplete();
400 }
401
402 /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
403 private class CancelButtonListener
404 implements ActionListener {
405 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
406 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
407 */
408 public void actionPerformed(ActionEvent event) {
409 prompt.dispose();
410 }
411 }
412
413 /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
414 */
415 private class CollectionListListener
416 implements ListSelectionListener {
417 /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
418 * @param event a <strong>ListSelectionEvent</strong> containing all the relevant information garnered from the event itself
419 */
420 public void valueChanged(ListSelectionEvent event) {
421 ok_button.setEnabled(false);
422 if(!list.isSelectionEmpty()) {
423 collection = (BasicCollectionConfiguration) ((Entry)list.getSelectedValue()).getObject();
424 args = new String[5];
425 args[0] = collection.getName();
426 args[1] = collection.getShortName();
427 args[2] = collection.getCreator();
428 args[3] = collection.getMaintainer();
429 args[4] = collection.getDescription();
430 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
431 details_textarea.setCaretPosition(0);
432 ok_button.setEnabled(true);
433 }
434 else {
435 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
436 ok_button.setEnabled(false);
437 }
438 }
439 }
440
441 /** The OK button listener implementation. */
442 private class OKButtonListener
443 implements ActionListener {
444 private Component glass_pane;
445 private MouseListener mouse_blocker_listener;
446 private ProgressDialog progress_dialog;
447
448 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
449 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
450 * @see org.greenstone.gatherer.Configuration
451 * @see org.greenstone.gatherer.Gatherer
452 * @see org.greenstone.gatherer.util.Utility
453 */
454 public void actionPerformed(ActionEvent event) {
455 ///ystem.err.println("OK Clicked");
456 // Make sure there are some colls specified
457 selected_collections = list.getSelected();
458 error_message = new StringBuffer();
459
460 // Set the cursor to hourglass
461 glass_pane = getGlassPane();
462 mouse_blocker_listener = new MouseAdapter() {};
463 glass_pane.addMouseListener(mouse_blocker_listener);
464 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
465 glass_pane.setVisible(true);
466
467 // Export the selected collection.
468 ///ystem.err.println("Export collections");
469 exportCollections();
470
471 // Show progress dialog
472 ///ystem.err.println("Showing progress dialog");
473 progress_dialog = new ProgressDialog();
474 progress_dialog.setVisible(true);
475 }
476
477 public void processComplete() {
478 ///ystem.err.println("Process complete");
479 // Dispose of progress dialog
480 progress_dialog.setVisible(false);
481 progress_dialog.dispose();
482 progress_dialog = null;
483
484 // unset the cursor
485 glass_pane.setVisible(false);
486 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
487 glass_pane.removeMouseListener(mouse_blocker_listener);
488 glass_pane = null;
489 mouse_blocker_listener= null;
490
491 if (successful) {
492 resultPrompt(true, error_message.toString());
493 } else {
494 resultPrompt(false, error_message.toString());
495 }
496 error_message = null;
497 }
498
499 private class ProgressDialog
500 extends ModalDialog {
501
502 private Dimension size = new Dimension(400,65);
503
504 public ProgressDialog() {
505 super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Title"), true);
506 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
507 setSize(size);
508 JPanel content_pane = (JPanel) getContentPane();
509 JLabel progress_label = new JLabel();
510 Dictionary.setText(progress_label, "ExportCollectionPrompt.Progress_Label");
511 JProgressBar progress_bar = new JProgressBar();
512 progress_bar.setIndeterminate(true);
513 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
514 content_pane.setLayout(new BorderLayout());
515 content_pane.add(progress_label, BorderLayout.NORTH);
516 content_pane.add(progress_bar, BorderLayout.CENTER);
517 // Position
518 Rectangle frame_bounds = Gatherer.g_man.getBounds();
519 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
520 }
521 }
522 }
523
524 private class ResultDialog
525 extends ModalDialog {
526
527 private Dimension size = new Dimension(600,300);
528 private ResultDialog self;
529
530 public ResultDialog(boolean success, String extra, String [] args) {
531 super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Successful_Title"), true);
532
533 this.self = this;
534
535 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
536 setSize(size);
537
538 JPanel content_pane = (JPanel) getContentPane();
539 JLabel result_label = new JLabel();
540 if(success) {
541 Dictionary.registerText(result_label, "ExportCollectionPrompt.Successful_Export", args);
542 }
543 else {
544 Dictionary.registerText(result_label, "ExportCollectionPrompt.Failed_Export", args);
545 }
546
547 JPanel button_pane = new JPanel();
548 JButton close_button = new GLIButton("Close");
549 close_button.setMnemonic(KeyEvent.VK_C);
550 close_button.addActionListener(new CloseButtonListener());
551
552 JPanel output_pane = new JPanel();
553 JLabel output_label = new JLabel();
554 Dictionary.registerText(output_label, "ExportCollectionPrompt.Output");
555
556 JTextArea output_textarea = new JTextArea(extra);
557 output_textarea.setCaretPosition(0);
558 output_textarea.setEditable(false);
559 output_textarea.setLineWrap(true);
560 output_textarea.setWrapStyleWord(true);
561
562 button_pane.setLayout(new BorderLayout());
563 button_pane.add(close_button, BorderLayout.EAST);
564
565 output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
566 output_pane.setLayout(new BorderLayout());
567 output_pane.add(output_label, BorderLayout.NORTH);
568 output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
569
570 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
571 content_pane.setLayout(new BorderLayout());
572 content_pane.add(result_label, BorderLayout.NORTH);
573 content_pane.add(output_pane, BorderLayout.CENTER);
574 content_pane.add(button_pane, BorderLayout.SOUTH);
575
576 // Position
577 Rectangle frame_bounds = Gatherer.g_man.getBounds();
578 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
579 }
580
581 private class CloseButtonListener
582 implements ActionListener {
583 public void actionPerformed(ActionEvent event) {
584 self.setVisible(false);
585 }
586 }
587 }
588}
589
590
591
592
Note: See TracBrowser for help on using the repository browser.