use of com.jcraft.jcterm.Terminal.SFTP in project narchy by automenta.
the class JCTermSwingFrame method getJMenuBar.
public JMenuBar getJMenuBar() {
JMenuBar mb = new JMenuBar();
JMenu m;
JMenuItem mi;
m = new JMenu("File");
mi = new JMenuItem("Open SHELL Session...");
mi.addActionListener(this);
mi.setActionCommand("Open SHELL Session...");
m.add(mi);
mi = new JMenuItem("Open SFTP Session...");
mi.addActionListener(this);
mi.setActionCommand("Open SFTP Session...");
m.add(mi);
mi = new JMenuItem("Quit");
mi.addActionListener(this);
mi.setActionCommand("Quit");
m.add(mi);
mb.add(m);
m = new JMenu("Proxy");
mi = new JMenuItem("HTTP...");
mi.addActionListener(this);
mi.setActionCommand("HTTP...");
m.add(mi);
mi = new JMenuItem("SOCKS5...");
mi.addActionListener(this);
mi.setActionCommand("SOCKS5...");
m.add(mi);
mb.add(m);
m = new JMenu("PortForwarding");
mi = new JMenuItem("Local Port...");
mi.addActionListener(this);
mi.setActionCommand("Local Port...");
m.add(mi);
mi = new JMenuItem("Remote Port...");
mi.addActionListener(this);
mi.setActionCommand("Remote Port...");
m.add(mi);
mi = new JMenuItem("X11 Forwarding...");
mi.addActionListener(this);
mi.setActionCommand("X11 Forwarding...");
m.add(mi);
mb.add(m);
m = new JMenu("Etc");
mi = new JMenuItem("AntiAliasing");
mi.addActionListener(this);
mi.setActionCommand("AntiAliasing");
m.add(mi);
mi = new JMenuItem("Compression...");
mi.addActionListener(this);
mi.setActionCommand("Compression...");
m.add(mi);
JMenu mcolor = new JMenu("Color");
final ActionListener mcolor_action = e -> setFgBg(e.getActionCommand());
mcolor.addMenuListener(new MenuListener() {
public void menuSelected(MenuEvent me) {
JMenu jm = (JMenu) me.getSource();
String[] fg_bg = JCTermSwing.getCR().load(configName).fg_bg;
for (int i = 0; i < fg_bg.length; i++) {
String[] tmp = fg_bg[i].split(":");
JMenuItem mi = new JMenuItem("ABC");
mi.setForeground(JCTermSwing.toColor(tmp[0]));
mi.setBackground(JCTermSwing.toColor(tmp[1]));
mi.setActionCommand(fg_bg[i]);
mi.addActionListener(mcolor_action);
jm.add(mi);
}
}
public void menuDeselected(MenuEvent me) {
JMenu jm = (JMenu) me.getSource();
jm.removeAll();
}
public void menuCanceled(MenuEvent arg) {
}
});
m.add(mcolor);
JMenu mfsize = new JMenu("Font size");
final ActionListener mfsize_action = e -> {
String _font_size = e.getActionCommand();
try {
setFontSize(Integer.parseInt(_font_size));
} catch (NumberFormatException nfe) {
}
};
mfsize.addMenuListener(new MenuListener() {
public void menuSelected(MenuEvent me) {
JMenuItem mi;
JMenu jm = (JMenu) me.getSource();
int font_size = JCTermSwing.getCR().load(configName).font_size;
mi = new JMenuItem("Smaller (" + (font_size - 1) + ')');
mi.setActionCommand("" + (font_size - 1));
mi.addActionListener(mfsize_action);
jm.add(mi);
mi = new JMenuItem("Larger (" + (font_size + 1) + ')');
mi.setActionCommand("" + (font_size + 1));
mi.addActionListener(mfsize_action);
jm.add(mi);
}
public void menuDeselected(MenuEvent me) {
JMenu jm = (JMenu) me.getSource();
jm.removeAll();
}
public void menuCanceled(MenuEvent arg) {
}
});
m.add(mfsize);
mb.add(m);
m = new JMenu("Help");
mi = new JMenuItem("About...");
mi.addActionListener(this);
mi.setActionCommand("About...");
m.add(mi);
mb.add(m);
return mb;
}
Aggregations