version 1.25, 2004/03/04 11:30:11
|
version 1.26, 2004/03/08 13:57:40
|
Line 599 public class FM2SQL extends JFrame imple
|
Line 599 public class FM2SQL extends JFrame imple
|
} |
} |
if (command.equals("Delimiter")) |
if (command.equals("Delimiter")) |
{ |
{ |
|
new DelimiterDialog(fmInstance).setVisible(true); |
delimiter = JOptionPane.showInputDialog(fmInstance,"Enter delimiter String",delimiter); |
delimiter = JOptionPane.showInputDialog(fmInstance,"Enter delimiter String",delimiter); |
|
|
} |
} |
Line 1453 public class FM2SQL extends JFrame imple
|
Line 1454 public class FM2SQL extends JFrame imple
|
} |
} |
|
|
} |
} |
|
public static class DelimiterDialog extends JDialog |
|
{ |
|
JLabel table = new JLabel(" "); |
|
JLabel status = new JLabel(" "); |
|
JLabel title = new JLabel(" "); |
|
JPanel content = new JPanel(); |
|
JPanel titlePanel = new JPanel(); |
|
JPanel delimiterPanel = new JPanel(); |
|
JPanel buttonPanel = new JPanel(); |
|
JTextField delimiter = new JTextField(10); |
|
|
|
JButton cancel = new JButton("Cancel"); |
|
JButton ok = new JButton("Ok"); |
|
Thread thread; |
|
public DelimiterDialog(JFrame frame) |
|
{ |
|
super(frame); |
|
setTitle("Delimiter Editor"); |
|
setModal(true); |
|
content = new JPanel(true); |
|
ActionListener al = new ActionListener() |
|
{ |
|
public void actionPerformed(ActionEvent e) |
|
{ |
|
fmInstance.delimiter=parseDelimiter(delimiter.getText()); |
|
setVisible(false); |
|
} |
|
|
|
}; |
|
this.addWindowListener(new WindowAdapter() |
|
{ |
|
public void windowClosing(WindowEvent e) |
|
{ |
|
cancel.doClick(); |
|
} |
|
}); |
|
|
|
//delimiter.setText(fmInstance.delimiter); |
|
delimiter.addActionListener(al); |
|
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); |
|
title = new JLabel("Enter Delimiter "); |
|
title.setHorizontalTextPosition(title.CENTER); |
|
titlePanel.add(title); |
|
buttonPanel.add(ok); |
|
buttonPanel.add(cancel); |
|
content.add(titlePanel); |
|
content.add(Box.createRigidArea(new java.awt.Dimension(0, 15))); |
|
|
|
content.add(new JLabel("")); |
|
content.add(delimiterPanel); |
|
content.add(buttonPanel); |
|
content.add(Box.createRigidArea(new java.awt.Dimension(0, 15))); |
|
|
|
delimiterPanel.add(new JLabel("Delimiter: ")); |
|
delimiterPanel.add(delimiter); |
|
getContentPane().add(titlePanel, "North"); |
|
getContentPane().add(content, "Center"); |
|
ok.addActionListener(al); |
|
cancel.addActionListener(new ActionListener() |
|
{ |
|
public void actionPerformed(ActionEvent e) |
|
{ |
|
fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
|
fmInstance.setEnabled(true); |
|
setVisible(false); |
|
// thread.stop(); |
|
} |
|
|
|
}); |
|
pack(); |
|
setLocationRelativeTo(fmInstance); |
|
} |
|
public String parseDelimiter(Object o) |
|
{ |
|
String str = o.toString(); |
|
StringBuffer sbuff = new StringBuffer(); |
|
int length = str.length(); |
|
for(int i = 0;i<length;++i) |
|
{ |
|
|
|
if(str.charAt(i)=='\\') |
|
{ |
|
System.out.println(str.charAt(i)); |
|
if (str.charAt(i + 1) == 'r') |
|
{ |
|
sbuff.append("\r"); |
|
} |
|
if (str.charAt(i + 1) == 't') |
|
{ |
|
sbuff.append("\t"); |
|
} |
|
if (str.charAt(i + 1) == 'n') |
|
{ |
|
sbuff.append("\n"); |
|
} |
|
if (str.charAt(i + 1) == '\\') |
|
{ |
|
sbuff.append("\\"); |
|
} |
|
|
|
if(i<length-1) ++i; |
|
|
|
} else sbuff.append(str.charAt(i)); |
|
} |
|
|
|
return sbuff.toString(); |
|
} |
|
} |
|
|
|
|
public static class PasswordDialog extends JDialog |
public static class PasswordDialog extends JDialog |
{ |
{ |
JLabel table = new JLabel(" "); |
JLabel table = new JLabel(" "); |