Fixed remote connection.

This commit is contained in:
amontano 2011-05-03 17:32:57 +00:00
parent e7d4758756
commit c15caea8c2
3 changed files with 29 additions and 11 deletions

View file

@ -4,7 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Checkbox; import java.awt.Checkbox;
import java.awt.CheckboxGroup; import java.awt.CheckboxGroup;
import java.awt.Choice; import java.awt.Choice;
import java.awt.FileDialog; // import java.awt.Color;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Frame; import java.awt.Frame;
import java.awt.GridLayout; import java.awt.GridLayout;
@ -12,8 +12,13 @@ import java.awt.Label;
import java.awt.Panel; import java.awt.Panel;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
/* import java.awt.Cursor;
import java.awt.FileDialog;
import java.io.FilenameFilter;
import java.io.File; */
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
/** provides a friendly user interface when the command-line /** provides a friendly user interface when the command-line
is not used for choosing a dictionary or connection to open. is not used for choosing a dictionary or connection to open.
@ -21,7 +26,7 @@ import javax.swing.JFileChooser;
class SwingWhichDictionaryFrame extends WhichDictionaryFrame class SwingWhichDictionaryFrame extends WhichDictionaryFrame
{ {
private CreateDatabaseWizard cdw; private CreateDatabaseWizard cdw;
private DictionaryFileFilter dicFilter; // private DictionaryFileFilter dicFilter;
private Checkbox createNewDictDB; private Checkbox createNewDictDB;
public SwingWhichDictionaryFrame(Frame owner) public SwingWhichDictionaryFrame(Frame owner)
@ -30,8 +35,8 @@ class SwingWhichDictionaryFrame extends WhichDictionaryFrame
Panel p; Panel p;
CheckboxGroup cbg = new CheckboxGroup(); CheckboxGroup cbg = new CheckboxGroup();
dicFilter = null; // dicFilter = null;
// this.setBackground(Color.white);
this.setLayout(new GridLayout(6, 1)); this.setLayout(new GridLayout(6, 1));
this.setSize(400, 200); this.setSize(400, 200);
@ -99,11 +104,23 @@ class SwingWhichDictionaryFrame extends WhichDictionaryFrame
} }
else if (obj == browse) else if (obj == browse)
{ {
if (dicFilter == null) dicFilter = new DictionaryFileFilter(); /* FileDialog fileDialog = new FileDialog(this, "Select dictionary to open", FileDialog.LOAD);
fileDialog.setFilenameFilter(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".wrd");
}
});
fileDialog.setFile("*.wrd");
fileDialog.setVisible(true);
response = fileDialog.getFile();
if (response != null)
{
if (dicFilter == null) dicFilter = new DictionaryFileFilter(); */
JFileChooser fileChooser = new JFileChooser("Select dictionary to open"); JFileChooser fileChooser = new JFileChooser("Select dictionary to open");
fileChooser.addChoosableFileFilter(dicFilter); FileNameExtensionFilter filter = new FileNameExtensionFilter("Binary tree dictionary (.wrd)", "wrd");
/*setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); fileChooser.setFileFilter(filter);
/* fileChooser.addChoosableFileFilter(dicFilter);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
if (fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) if (fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
{ {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
@ -113,6 +130,7 @@ class SwingWhichDictionaryFrame extends WhichDictionaryFrame
{ {
response = fileChooser.getSelectedFile().getPath(); response = fileChooser.getSelectedFile().getPath();
response = response.substring(0, response.length()-4); response = response.substring(0, response.length()-4);
// response = fileDialog.getDirectory() + System.getProperty("file.separator") + response.substring(0, response.length()-4);
localDict.setText(response); localDict.setText(response);
ok.setEnabled(true); ok.setEnabled(true);
} }

View file

@ -80,7 +80,7 @@ public class SwingWindowScannerFilter extends WindowScannerFilter
} }
else mainWindow.setVisible(false); else mainWindow.setVisible(false);
mainWindow.setLayout(new GridLayout(1,1)); mainWindow.setLayout(new GridLayout(1,1));
mainWindow.setBackground(Color.white); // mainWindow.setBackground(Color.white);
diagAbout = null; diagAbout = null;
mnuAbout = null; mnuAbout = null;

View file

@ -48,7 +48,7 @@ abstract class WhichDictionaryFrame extends Dialog implements ActionListener, It
dictTypes = new String[2]; dictTypes = new String[2];
} }
dictsOnline[0] = "http://www.thdl.org/tibetan/servlet/org.thdl.tib.scanner.RemoteScannerFilter"; dictsOnline[0] = "http://ttt.thlib.org/org.thdl.tib.scanner.RemoteScannerFilter";
dictTypes[0] = "local"; dictTypes[0] = "local";
dictTypes[1] = "public"; dictTypes[1] = "public";