You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OptionsDialog.java 66KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright (C) 2011-2019 Brian P. Hinz
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  17. * USA.
  18. */
  19. package com.tigervnc.vncviewer;
  20. import java.awt.*;
  21. import java.awt.event.*;
  22. import java.io.File;
  23. import java.lang.reflect.*;
  24. import java.text.Format;
  25. import java.text.NumberFormat;
  26. import javax.swing.*;
  27. import javax.swing.border.*;
  28. import javax.swing.filechooser.*;
  29. import javax.swing.UIManager.*;
  30. import javax.swing.text.*;
  31. import java.util.*;
  32. import java.util.List;
  33. import java.util.Map.Entry;
  34. import java.util.prefs.*;
  35. import com.tigervnc.rfb.*;
  36. import static java.awt.GridBagConstraints.BOTH;
  37. import static java.awt.GridBagConstraints.CENTER;
  38. import static java.awt.GridBagConstraints.HORIZONTAL;
  39. import static java.awt.GridBagConstraints.LINE_END;
  40. import static java.awt.GridBagConstraints.LINE_START;
  41. import static java.awt.GridBagConstraints.PAGE_START;
  42. import static java.awt.GridBagConstraints.NONE;
  43. import static java.awt.GridBagConstraints.RELATIVE;
  44. import static java.awt.GridBagConstraints.REMAINDER;
  45. import static java.awt.GridBagConstraints.VERTICAL;
  46. import static com.tigervnc.vncviewer.Parameters.*;
  47. class OptionsDialog extends Dialog {
  48. private class IntegerDocument extends PlainDocument {
  49. private int limit;
  50. public IntegerDocument(int max) {
  51. super();
  52. limit = max;
  53. }
  54. public void insertString(int offset, String str, AttributeSet a)
  55. throws BadLocationException {
  56. if (str == null || !str.matches("^[0-9]+$")) return;
  57. if ((getLength() + str.length()) > limit)
  58. Toolkit.getDefaultToolkit().beep();
  59. else
  60. super.insertString(offset, str, a);
  61. }
  62. }
  63. private class IntegerTextField extends JFormattedTextField {
  64. public IntegerTextField(int digits) {
  65. super();
  66. setDocument(new IntegerDocument(digits));
  67. Font f = getFont();
  68. String template = String.format("%0"+digits+"d", 0);
  69. int w = getFontMetrics(f).stringWidth(template) +
  70. getMargin().left + getMargin().right +
  71. getInsets().left + getInsets().right;
  72. int h = getPreferredSize().height;
  73. setPreferredSize(new Dimension(w, h));
  74. }
  75. @Override
  76. protected void processFocusEvent(final FocusEvent e) {
  77. if (e.isTemporary())
  78. return;
  79. if (e.getID() == FocusEvent.FOCUS_LOST)
  80. if (getText() == null || getText().isEmpty())
  81. setValue(null);
  82. super.processFocusEvent(e);
  83. }
  84. }
  85. private static Map<Object, String> callbacks = new HashMap<Object, String>();
  86. /* Compression */
  87. JCheckBox autoselectCheckbox;
  88. ButtonGroup encodingGroup;
  89. JRadioButton tightButton;
  90. JRadioButton zrleButton;
  91. JRadioButton hextileButton;
  92. JRadioButton rawButton;
  93. ButtonGroup colorlevelGroup;
  94. JRadioButton fullcolorButton;
  95. JRadioButton mediumcolorButton;
  96. JRadioButton lowcolorButton;
  97. JRadioButton verylowcolorButton;
  98. JCheckBox compressionCheckbox;
  99. JCheckBox jpegCheckbox;
  100. JComboBox compressionInput;
  101. JComboBox jpegInput;
  102. /* Security */
  103. JCheckBox encNoneCheckbox;
  104. JCheckBox encTLSCheckbox;
  105. JCheckBox encX509Checkbox;
  106. JTextField caInput;
  107. JTextField crlInput;
  108. JButton caChooser;
  109. JButton crlChooser;
  110. JCheckBox authNoneCheckbox;
  111. JCheckBox authVncCheckbox;
  112. JCheckBox authPlainCheckbox;
  113. JCheckBox authIdentCheckbox;
  114. JCheckBox sendLocalUsernameCheckbox;
  115. /* Input */
  116. JCheckBox viewOnlyCheckbox;
  117. JCheckBox acceptClipboardCheckbox;
  118. JCheckBox sendClipboardCheckbox;
  119. JComboBox menuKeyChoice;
  120. /* Screen */
  121. JCheckBox desktopSizeCheckbox;
  122. JTextField desktopWidthInput;
  123. JTextField desktopHeightInput;
  124. ButtonGroup sizingGroup;
  125. JRadioButton remoteResizeButton;
  126. JRadioButton remoteScaleButton;
  127. JComboBox scalingFactorInput;
  128. JCheckBox fullScreenCheckbox;
  129. JCheckBox fullScreenAllMonitorsCheckbox;
  130. /* Misc. */
  131. JCheckBox sharedCheckbox;
  132. JCheckBox dotWhenNoCursorCheckbox;
  133. JCheckBox acceptBellCheckbox;
  134. /* SSH */
  135. JCheckBox tunnelCheckbox;
  136. JCheckBox viaCheckbox;
  137. JTextField viaUserInput;
  138. JTextField viaHostInput;
  139. JTextField viaPortInput;
  140. JCheckBox extSSHCheckbox;
  141. JTextField sshClientInput;
  142. JButton sshClientChooser;
  143. JRadioButton sshArgsDefaultButton;
  144. JRadioButton sshArgsCustomButton;
  145. JTextField sshArgsInput;
  146. JTextField sshConfigInput;
  147. JTextField sshKeyFileInput;
  148. JButton sshConfigChooser;
  149. JButton sshKeyFileChooser;
  150. @SuppressWarnings({"rawtypes","unchecked"})
  151. public OptionsDialog() {
  152. super(true);
  153. setTitle("VNC Viewer Options");
  154. setResizable(false);
  155. getContentPane().setLayout(
  156. new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
  157. JTabbedPane tabPane = new JTabbedPane();
  158. tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  159. encodingGroup = new ButtonGroup();
  160. colorlevelGroup = new ButtonGroup();
  161. // tabPane
  162. tabPane.addTab("Compression", createCompressionPanel());
  163. tabPane.addTab("Security", createSecurityPanel());
  164. tabPane.addTab("Input", createInputPanel());
  165. tabPane.addTab("Screen", createScreenPanel());
  166. tabPane.addTab("Misc", createMiscPanel());
  167. tabPane.addTab("SSH", createSshPanel());
  168. tabPane.setBorder(BorderFactory.createEmptyBorder());
  169. // Resize the tabPane if necessary to prevent scrolling
  170. int minWidth = 0;
  171. Object tpi = UIManager.get("TabbedPane:TabbedPaneTabArea.contentMargins");
  172. if (tpi != null)
  173. minWidth += ((Insets)tpi).left + ((Insets)tpi).right;
  174. for (int i = 0; i < tabPane.getTabCount(); i++)
  175. minWidth += tabPane.getBoundsAt(i).width;
  176. int minHeight = tabPane.getPreferredSize().height;
  177. if (tabPane.getPreferredSize().width < minWidth)
  178. tabPane.setPreferredSize(new Dimension(minWidth, minHeight));
  179. // button pane
  180. JButton okButton = new JButton("OK \u21B5");
  181. okButton.addActionListener(new ActionListener() {
  182. public void actionPerformed(ActionEvent e) {
  183. storeOptions();
  184. endDialog();
  185. }
  186. });
  187. JButton cancelButton = new JButton("Cancel");
  188. cancelButton.addActionListener(new ActionListener() {
  189. public void actionPerformed(ActionEvent e) {
  190. endDialog();
  191. }
  192. });
  193. JPanel buttonPane = new JPanel(new GridLayout(1, 5, 10, 10));
  194. buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5));
  195. buttonPane.add(Box.createRigidArea(new Dimension()));
  196. buttonPane.add(Box.createRigidArea(new Dimension()));
  197. buttonPane.add(Box.createRigidArea(new Dimension()));
  198. buttonPane.add(cancelButton);
  199. buttonPane.add(okButton);
  200. this.add(tabPane);
  201. this.add(buttonPane);
  202. addListeners(this);
  203. pack();
  204. }
  205. public static void showDialog(Container c) {
  206. OptionsDialog dialog = new OptionsDialog();
  207. dialog.show(c);
  208. }
  209. public void show(Container c) {
  210. loadOptions();
  211. super.showDialog(c);
  212. }
  213. public static void addCallback(String cb, Object obj)
  214. {
  215. callbacks.put(obj, cb);
  216. }
  217. public static void removeCallback(Object obj)
  218. {
  219. callbacks.remove(obj);
  220. }
  221. public void endDialog() {
  222. super.endDialog();
  223. // Making a new dialog is so cheap that it's not worth keeping
  224. this.dispose();
  225. }
  226. private void loadOptions()
  227. {
  228. /* Compression */
  229. autoselectCheckbox.setSelected(autoSelect.getValue());
  230. int encNum = Encodings.encodingNum(preferredEncoding.getValueStr());
  231. switch (encNum) {
  232. case Encodings.encodingTight:
  233. tightButton.setSelected(true);
  234. break;
  235. case Encodings.encodingZRLE:
  236. zrleButton.setSelected(true);
  237. break;
  238. case Encodings.encodingHextile:
  239. hextileButton.setSelected(true);
  240. break;
  241. case Encodings.encodingRaw:
  242. rawButton.setSelected(true);
  243. break;
  244. }
  245. if (fullColor.getValue())
  246. fullcolorButton.setSelected(true);
  247. else {
  248. switch (lowColorLevel.getValue()) {
  249. case 0:
  250. verylowcolorButton.setSelected(true);
  251. break;
  252. case 1:
  253. lowcolorButton.setSelected(true);
  254. break;
  255. case 2:
  256. mediumcolorButton.setSelected(true);
  257. break;
  258. }
  259. }
  260. int digit = 0;
  261. compressionCheckbox.setSelected(customCompressLevel.getValue());
  262. jpegCheckbox.setSelected(!noJpeg.getValue());
  263. digit = 0 + compressLevel.getValue();
  264. compressionInput.setSelectedItem(digit);
  265. digit = 0 + qualityLevel.getValue();
  266. jpegInput.setSelectedItem(digit);
  267. handleAutoselect();
  268. handleCompression();
  269. handleJpeg();
  270. /* Security */
  271. Security security = new Security(SecurityClient.secTypes);
  272. List<Integer> secTypes;
  273. Iterator<Integer> iter;
  274. List<Integer> secTypesExt;
  275. Iterator<Integer> iterExt;
  276. encNoneCheckbox.setSelected(false);
  277. encTLSCheckbox.setSelected(false);
  278. encX509Checkbox.setSelected(false);
  279. authNoneCheckbox.setSelected(false);
  280. authVncCheckbox.setSelected(false);
  281. authPlainCheckbox.setSelected(false);
  282. authIdentCheckbox.setSelected(false);
  283. sendLocalUsernameCheckbox.setSelected(sendLocalUsername.getValue());
  284. secTypes = security.GetEnabledSecTypes();
  285. for (iter = secTypes.iterator(); iter.hasNext(); ) {
  286. switch ((Integer)iter.next()) {
  287. case Security.secTypeNone:
  288. encNoneCheckbox.setSelected(true);
  289. authNoneCheckbox.setSelected(true);
  290. break;
  291. case Security.secTypeVncAuth:
  292. encNoneCheckbox.setSelected(true);
  293. authVncCheckbox.setSelected(true);
  294. break;
  295. }
  296. }
  297. secTypesExt = security.GetEnabledExtSecTypes();
  298. for (iterExt = secTypesExt.iterator(); iterExt.hasNext(); ) {
  299. switch ((Integer)iterExt.next()) {
  300. case Security.secTypePlain:
  301. encNoneCheckbox.setSelected(true);
  302. authPlainCheckbox.setSelected(true);
  303. break;
  304. case Security.secTypeIdent:
  305. encNoneCheckbox.setSelected(true);
  306. authIdentCheckbox.setSelected(true);
  307. break;
  308. case Security.secTypeTLSNone:
  309. encTLSCheckbox.setSelected(true);
  310. authNoneCheckbox.setSelected(true);
  311. break;
  312. case Security.secTypeTLSVnc:
  313. encTLSCheckbox.setSelected(true);
  314. authVncCheckbox.setSelected(true);
  315. break;
  316. case Security.secTypeTLSPlain:
  317. encTLSCheckbox.setSelected(true);
  318. authPlainCheckbox.setSelected(true);
  319. break;
  320. case Security.secTypeTLSIdent:
  321. encTLSCheckbox.setSelected(true);
  322. authIdentCheckbox.setSelected(true);
  323. break;
  324. case Security.secTypeX509None:
  325. encX509Checkbox.setSelected(true);
  326. authNoneCheckbox.setSelected(true);
  327. break;
  328. case Security.secTypeX509Vnc:
  329. encX509Checkbox.setSelected(true);
  330. authVncCheckbox.setSelected(true);
  331. break;
  332. case Security.secTypeX509Plain:
  333. encX509Checkbox.setSelected(true);
  334. authPlainCheckbox.setSelected(true);
  335. break;
  336. case Security.secTypeX509Ident:
  337. encX509Checkbox.setSelected(true);
  338. authIdentCheckbox.setSelected(true);
  339. break;
  340. }
  341. }
  342. File caFile = new File(CSecurityTLS.X509CA.getValueStr());
  343. if (caFile.exists() && caFile.canRead())
  344. caInput.setText(caFile.getAbsolutePath());
  345. File crlFile = new File(CSecurityTLS.X509CRL.getValueStr());
  346. if (crlFile.exists() && crlFile.canRead())
  347. crlInput.setText(crlFile.getAbsolutePath());
  348. handleX509();
  349. handleSendLocalUsername();
  350. /* Input */
  351. viewOnlyCheckbox.setSelected(viewOnly.getValue());
  352. acceptClipboardCheckbox.setSelected(acceptClipboard.getValue());
  353. sendClipboardCheckbox.setSelected(sendClipboard.getValue());
  354. menuKeyChoice.setSelectedIndex(0);
  355. String menuKeyStr = menuKey.getValueStr();
  356. for (int i = 0; i < menuKeyChoice.getItemCount(); i++)
  357. if (menuKeyStr.equals(menuKeyChoice.getItemAt(i)))
  358. menuKeyChoice.setSelectedIndex(i);
  359. /* Screen */
  360. String width, height;
  361. if (desktopSize.getValueStr().isEmpty() ||
  362. desktopSize.getValueStr().split("x").length != 2) {
  363. desktopSizeCheckbox.setSelected(false);
  364. desktopWidthInput.setText("1024");
  365. desktopHeightInput.setText("768");
  366. } else {
  367. desktopSizeCheckbox.setSelected(true);
  368. width = desktopSize.getValueStr().split("x")[0];
  369. desktopWidthInput.setText(width);
  370. height = desktopSize.getValueStr().split("x")[1];
  371. desktopHeightInput.setText(height);
  372. }
  373. if (remoteResize.getValue())
  374. remoteResizeButton.setSelected(true);
  375. else
  376. remoteScaleButton.setSelected(true);
  377. fullScreenCheckbox.setSelected(fullScreen.getValue());
  378. fullScreenAllMonitorsCheckbox.setSelected(fullScreenAllMonitors.getValue());
  379. scalingFactorInput.setSelectedItem("100%");
  380. String scaleStr = scalingFactor.getValueStr();
  381. if (scaleStr.matches("^[0-9]+$"))
  382. scaleStr = scaleStr.concat("%");
  383. if (scaleStr.matches("^FixedRatio$"))
  384. scaleStr = new String("Fixed Aspect Ratio");
  385. for (int i = 0; i < scalingFactorInput.getItemCount(); i++)
  386. if (scaleStr.equals(scalingFactorInput.getItemAt(i)))
  387. scalingFactorInput.setSelectedIndex(i);
  388. handleDesktopSize();
  389. /* Misc. */
  390. sharedCheckbox.setSelected(shared.getValue());
  391. dotWhenNoCursorCheckbox.setSelected(dotWhenNoCursor.getValue());
  392. acceptBellCheckbox.setSelected(acceptBell.getValue());
  393. /* SSH */
  394. File f;
  395. tunnelCheckbox.setSelected(tunnel.getValue() || !via.getValueStr().isEmpty());
  396. viaCheckbox.setSelected(!via.getValueStr().isEmpty());
  397. if (viaCheckbox.isSelected()) {
  398. viaUserInput.setText(Tunnel.getSshUser());
  399. viaHostInput.setText(Tunnel.getSshHost());
  400. viaPortInput.setText(Integer.toString(Tunnel.getSshPort()));
  401. }
  402. extSSHCheckbox.setSelected(extSSH.getValue());
  403. f = new File(extSSHClient.getValueStr());
  404. if (f.exists() && f.isFile() && f.canExecute())
  405. sshClientInput.setText(f.getAbsolutePath());
  406. if (extSSHArgs.getValueStr().isEmpty()) {
  407. sshArgsDefaultButton.setSelected(true);
  408. } else {
  409. sshArgsCustomButton.setSelected(true);
  410. sshArgsInput.setText(extSSHArgs.getValueStr());
  411. }
  412. f = new File(sshKeyFile.getValueStr());
  413. if (f.exists() && f.isFile() && f.canRead())
  414. sshKeyFileInput.setText(f.getAbsolutePath());
  415. f = new File(sshConfig.getValueStr());
  416. if (f.exists() && f.isFile() && f.canRead())
  417. sshConfigInput.setText(f.getAbsolutePath());
  418. handleTunnel();
  419. handleVia();
  420. handleExtSSH();
  421. handleRfbState();
  422. }
  423. private void storeOptions() {
  424. /* Compression */
  425. autoSelect.setParam(autoselectCheckbox.isSelected());
  426. if (tightButton.isSelected())
  427. preferredEncoding.setParam(Encodings.encodingName(Encodings.encodingTight));
  428. else if (zrleButton.isSelected())
  429. preferredEncoding.setParam(Encodings.encodingName(Encodings.encodingZRLE));
  430. else if (hextileButton.isSelected())
  431. preferredEncoding.setParam(Encodings.encodingName(Encodings.encodingHextile));
  432. else if (rawButton.isSelected())
  433. preferredEncoding.setParam(Encodings.encodingName(Encodings.encodingRaw));
  434. fullColor.setParam(fullcolorButton.isSelected());
  435. if (verylowcolorButton.isSelected())
  436. lowColorLevel.setParam(0);
  437. else if (lowcolorButton.isSelected())
  438. lowColorLevel.setParam(1);
  439. else if (mediumcolorButton.isSelected())
  440. lowColorLevel.setParam(2);
  441. customCompressLevel.setParam(compressionCheckbox.isSelected());
  442. noJpeg.setParam(!jpegCheckbox.isSelected());
  443. compressLevel.setParam((Integer)compressionInput.getSelectedItem());
  444. qualityLevel.setParam((Integer)jpegInput.getSelectedItem());
  445. /* Security */
  446. Security security = new Security();
  447. /* Process security types which don't use encryption */
  448. if (encNoneCheckbox.isSelected()) {
  449. if (authNoneCheckbox.isSelected())
  450. security.EnableSecType(Security.secTypeNone);
  451. if (authVncCheckbox.isSelected())
  452. security.EnableSecType(Security.secTypeVncAuth);
  453. if (authPlainCheckbox.isSelected())
  454. security.EnableSecType(Security.secTypePlain);
  455. if (authIdentCheckbox.isSelected())
  456. security.EnableSecType(Security.secTypeIdent);
  457. }
  458. /* Process security types which use TLS encryption */
  459. if (encTLSCheckbox.isSelected()) {
  460. if (authNoneCheckbox.isSelected())
  461. security.EnableSecType(Security.secTypeTLSNone);
  462. if (authVncCheckbox.isSelected())
  463. security.EnableSecType(Security.secTypeTLSVnc);
  464. if (authPlainCheckbox.isSelected())
  465. security.EnableSecType(Security.secTypeTLSPlain);
  466. if (authIdentCheckbox.isSelected())
  467. security.EnableSecType(Security.secTypeTLSIdent);
  468. }
  469. /* Process security types which use X509 encryption */
  470. if (encX509Checkbox.isSelected()) {
  471. if (authNoneCheckbox.isSelected())
  472. security.EnableSecType(Security.secTypeX509None);
  473. if (authVncCheckbox.isSelected())
  474. security.EnableSecType(Security.secTypeX509Vnc);
  475. if (authPlainCheckbox.isSelected())
  476. security.EnableSecType(Security.secTypeX509Plain);
  477. if (authIdentCheckbox.isSelected())
  478. security.EnableSecType(Security.secTypeX509Ident);
  479. }
  480. if (authIdentCheckbox.isSelected() ||
  481. authPlainCheckbox.isSelected()) {
  482. sendLocalUsername.setParam(sendLocalUsernameCheckbox.isSelected());
  483. }
  484. SecurityClient.secTypes.setParam(security.ToString());
  485. File caFile = new File(caInput.getText());
  486. if (caFile.exists() && caFile.canRead())
  487. CSecurityTLS.X509CA.setParam(caFile.getAbsolutePath());
  488. File crlFile = new File(crlInput.getText());
  489. if (crlFile.exists() && crlFile.canRead())
  490. CSecurityTLS.X509CRL.setParam(crlFile.getAbsolutePath());
  491. /* Input */
  492. viewOnly.setParam(viewOnlyCheckbox.isSelected());
  493. acceptClipboard.setParam(acceptClipboardCheckbox.isSelected());
  494. sendClipboard.setParam(sendClipboardCheckbox.isSelected());
  495. String menuKeyStr =
  496. MenuKey.getMenuKeySymbols()[menuKeyChoice.getSelectedIndex()].name;
  497. menuKey.setParam(menuKeyStr);
  498. /* Screen */
  499. if (desktopSizeCheckbox.isSelected() &&
  500. !desktopWidthInput.getText().isEmpty() &&
  501. !desktopHeightInput.getText().isEmpty()) {
  502. String width = desktopWidthInput.getText();
  503. String height = desktopHeightInput.getText();
  504. desktopSize.setParam(width.concat("x").concat(height));
  505. } else {
  506. desktopSize.setParam("");
  507. }
  508. remoteResize.setParam(remoteResizeButton.isSelected());
  509. fullScreen.setParam(fullScreenCheckbox.isSelected());
  510. fullScreenAllMonitors.setParam(fullScreenAllMonitorsCheckbox.isSelected());
  511. String scaleStr =
  512. ((String)scalingFactorInput.getSelectedItem()).replace("%", "");
  513. scaleStr.replace("Fixed Aspect Ratio", "FixedRatio");
  514. scalingFactor.setParam(scaleStr);
  515. /* Misc. */
  516. shared.setParam(sharedCheckbox.isSelected());
  517. dotWhenNoCursor.setParam(dotWhenNoCursorCheckbox.isSelected());
  518. acceptBell.setParam(acceptBellCheckbox.isSelected());
  519. /* SSH */
  520. tunnel.setParam(tunnelCheckbox.isSelected());
  521. if (viaCheckbox.isSelected() &&
  522. !viaUserInput.getText().isEmpty() &&
  523. !viaHostInput.getText().isEmpty() &&
  524. !viaPortInput.getText().isEmpty()) {
  525. String sshUser = viaUserInput.getText();
  526. String sshHost = viaHostInput.getText();
  527. String sshPort = viaPortInput.getText();
  528. String viaStr = sshUser.concat("@").concat(sshHost).concat(":").concat(sshPort);
  529. via.setParam(viaStr);
  530. } else {
  531. via.setParam("");
  532. }
  533. extSSH.setParam(extSSHCheckbox.isSelected());
  534. if (!sshClientInput.getText().isEmpty())
  535. extSSHClient.setParam(sshClientInput.getText());
  536. if (sshArgsCustomButton.isSelected() &&
  537. !sshArgsInput.getText().isEmpty()) {
  538. extSSHArgs.setParam(sshArgsInput.getText());
  539. } else {
  540. extSSHArgs.setParam(new String());
  541. }
  542. if (!sshConfigInput.getText().isEmpty())
  543. sshConfig.setParam(sshConfigInput.getText());
  544. if (!sshKeyFileInput.getText().isEmpty())
  545. sshKeyFile.setParam(sshKeyFileInput.getText());
  546. try {
  547. for (Map.Entry<Object, String> iter : callbacks.entrySet()) {
  548. Object obj = iter.getKey();
  549. Method cb = obj.getClass().getMethod(iter.getValue(), new Class[]{});
  550. if (cb == null)
  551. vlog.info(obj.getClass().getName());
  552. cb.invoke(obj);
  553. }
  554. } catch (NoSuchMethodException e) {
  555. vlog.error("NoSuchMethodException: "+e.getMessage());
  556. } catch (IllegalAccessException e) {
  557. vlog.error("IllegalAccessException: "+e.getMessage());
  558. } catch (InvocationTargetException e) {
  559. vlog.error("InvocationTargetException: "+e.getMessage());
  560. }
  561. }
  562. private JPanel createCompressionPanel() {
  563. JPanel FormatPanel = new JPanel();
  564. FormatPanel.setLayout(new BoxLayout(FormatPanel,
  565. BoxLayout.PAGE_AXIS));
  566. FormatPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  567. JPanel autoSelectPane = new JPanel();
  568. autoSelectPane.setLayout(new BoxLayout(autoSelectPane,
  569. BoxLayout.LINE_AXIS));
  570. autoSelectPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
  571. autoselectCheckbox = new JCheckBox("Auto Select");
  572. autoselectCheckbox.addItemListener(new ItemListener() {
  573. public void itemStateChanged(ItemEvent e) {
  574. handleAutoselect();
  575. }
  576. });
  577. autoSelectPane.add(autoselectCheckbox);
  578. autoSelectPane.add(Box.createHorizontalGlue());
  579. JPanel encodingPanel = new JPanel(new GridLayout(4, 1));
  580. encodingPanel.setBorder(BorderFactory.createTitledBorder("Preferred encoding"));
  581. tightButton = new GroupedJRadioButton("Tight", encodingGroup, encodingPanel);
  582. zrleButton = new GroupedJRadioButton("ZRLE", encodingGroup, encodingPanel);
  583. hextileButton = new GroupedJRadioButton("Hextile", encodingGroup, encodingPanel);
  584. rawButton = new GroupedJRadioButton("Raw", encodingGroup, encodingPanel);
  585. JPanel colorPanel = new JPanel(new GridLayout(4, 1));
  586. colorPanel.setBorder(BorderFactory.createTitledBorder("Color level"));
  587. fullcolorButton = new GroupedJRadioButton("Full", colorlevelGroup, colorPanel);
  588. mediumcolorButton = new GroupedJRadioButton("Medium", colorlevelGroup, colorPanel);
  589. lowcolorButton = new GroupedJRadioButton("Low", colorlevelGroup, colorPanel);
  590. verylowcolorButton = new GroupedJRadioButton("Very low", colorlevelGroup, colorPanel);
  591. JPanel encodingPane = new JPanel(new GridLayout(1, 2, 5, 0));
  592. encodingPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
  593. encodingPane.add(encodingPanel);
  594. encodingPane.add(colorPanel);
  595. JPanel tightPanel = new JPanel(new GridBagLayout());
  596. compressionCheckbox = new JCheckBox("Custom Compression Level");
  597. compressionCheckbox.addItemListener(new ItemListener() {
  598. public void itemStateChanged(ItemEvent e) {
  599. handleCompression();
  600. }
  601. });
  602. Object[] compressionLevels = { 1, 2, 3, 4, 5, 6 };
  603. compressionInput = new MyJComboBox(compressionLevels);
  604. ((MyJComboBox)compressionInput).setDocument(new IntegerDocument(1));
  605. compressionInput.setPrototypeDisplayValue("0.");
  606. compressionInput.setEditable(true);
  607. JLabel compressionLabel =
  608. new JLabel("Level (1=fast, 9=best)");
  609. jpegCheckbox = new JCheckBox("Allow JPEG Compression");
  610. jpegCheckbox.addItemListener(new ItemListener() {
  611. public void itemStateChanged(ItemEvent e) {
  612. handleJpeg();
  613. }
  614. });
  615. Object[] qualityLevels = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  616. jpegInput = new MyJComboBox(qualityLevels);
  617. jpegInput.setPrototypeDisplayValue("0.");
  618. JLabel qualityLabel = new JLabel("Quality (0=poor, 9=best)");
  619. tightPanel.add(compressionCheckbox,
  620. new GridBagConstraints(0, 0,
  621. REMAINDER, 1,
  622. LIGHT, LIGHT,
  623. LINE_START, NONE,
  624. new Insets(0, 0, 0, 0),
  625. NONE, NONE));
  626. int indent = getButtonLabelInset(compressionCheckbox);
  627. tightPanel.add(compressionInput,
  628. new GridBagConstraints(0, 1,
  629. 1, 1,
  630. LIGHT, LIGHT,
  631. LINE_START, NONE,
  632. new Insets(0, indent, 0, 0),
  633. NONE, NONE));
  634. tightPanel.add(compressionLabel,
  635. new GridBagConstraints(1, 1,
  636. 1, 1,
  637. HEAVY, LIGHT,
  638. LINE_START, HORIZONTAL,
  639. new Insets(0, 5, 0, 0),
  640. NONE, NONE));
  641. tightPanel.add(jpegCheckbox,
  642. new GridBagConstraints(0, 2,
  643. REMAINDER, 1,
  644. LIGHT, LIGHT,
  645. LINE_START, NONE,
  646. new Insets(5, 0, 0, 0),
  647. NONE, NONE));
  648. indent = getButtonLabelInset(jpegCheckbox);
  649. tightPanel.add(jpegInput,
  650. new GridBagConstraints(0, 3,
  651. 1, 1,
  652. LIGHT, LIGHT,
  653. LINE_START, NONE,
  654. new Insets(0, indent, 0, 0),
  655. NONE, NONE));
  656. tightPanel.add(qualityLabel,
  657. new GridBagConstraints(1, 3,
  658. 1, 1,
  659. HEAVY, NONE,
  660. LINE_START, HORIZONTAL,
  661. new Insets(0, 5, 0, 0),
  662. NONE, NONE));
  663. tightPanel.add(Box.createRigidArea(new Dimension(5,0)),
  664. new GridBagConstraints(0, 4,
  665. REMAINDER, REMAINDER,
  666. HEAVY, HEAVY,
  667. LINE_START, BOTH,
  668. new Insets(0, 0, 0, 0),
  669. NONE, NONE));
  670. FormatPanel.add(autoSelectPane);
  671. FormatPanel.add(encodingPane);
  672. FormatPanel.add(tightPanel);
  673. return FormatPanel;
  674. }
  675. private JPanel createSecurityPanel() {
  676. JPanel SecPanel = new JPanel();
  677. SecPanel.setLayout(new BoxLayout(SecPanel,
  678. BoxLayout.PAGE_AXIS));
  679. SecPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  680. JPanel vencryptPane = new JPanel();
  681. vencryptPane.setLayout(new BoxLayout(vencryptPane,
  682. BoxLayout.LINE_AXIS));
  683. vencryptPane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
  684. JPanel encrPanel = new JPanel(new GridBagLayout());
  685. encrPanel.setBorder(BorderFactory.createTitledBorder("Encryption"));
  686. encNoneCheckbox = new JCheckBox("None");
  687. encTLSCheckbox = new JCheckBox("Anonymous TLS");
  688. encX509Checkbox = new JCheckBox("TLS with X.509 certificates");
  689. encX509Checkbox.addItemListener(new ItemListener() {
  690. public void itemStateChanged(ItemEvent e) {
  691. handleX509();
  692. }
  693. });
  694. JLabel caLabel = new JLabel("X.509 CA Certificate");
  695. caInput = new JTextField();
  696. caChooser = new JButton("Browse");
  697. caChooser.addActionListener(new ActionListener() {
  698. public void actionPerformed(ActionEvent e) {
  699. JComponent c = ((JButton)e.getSource()).getRootPane();
  700. File dflt = new File(CSecurityTLS.X509CA.getValueStr());
  701. FileNameExtensionFilter filter =
  702. new FileNameExtensionFilter("X.509 certificate", "crt", "cer", "pem");
  703. File f = showChooser("Path to X509 CA certificate", dflt, c, filter);
  704. if (f != null && f.exists() && f.canRead())
  705. caInput.setText(f.getAbsolutePath());
  706. }
  707. });
  708. JLabel crlLabel = new JLabel("X.509 CRL file");
  709. crlInput = new JTextField();
  710. crlChooser = new JButton("Browse");
  711. crlChooser.addActionListener(new ActionListener() {
  712. public void actionPerformed(ActionEvent e) {
  713. JComponent c = ((JButton)e.getSource()).getRootPane();
  714. File dflt = new File(CSecurityTLS.X509CRL.getValueStr());
  715. FileNameExtensionFilter filter =
  716. new FileNameExtensionFilter("X.509 CRL", "crl");
  717. File f = showChooser("Path to X509 CRL file", dflt, c, filter);
  718. if (f != null && f.exists() && f.canRead())
  719. crlInput.setText(f.getAbsolutePath());
  720. }
  721. });
  722. encrPanel.add(encNoneCheckbox,
  723. new GridBagConstraints(0, 0,
  724. REMAINDER, 1,
  725. HEAVY, LIGHT,
  726. LINE_START, NONE,
  727. new Insets(0, 0, 4, 0),
  728. NONE, NONE));
  729. encrPanel.add(encTLSCheckbox,
  730. new GridBagConstraints(0, 1,
  731. REMAINDER, 1,
  732. HEAVY, LIGHT,
  733. LINE_START, NONE,
  734. new Insets(0, 0, 4, 0),
  735. NONE, NONE));
  736. encrPanel.add(encX509Checkbox,
  737. new GridBagConstraints(0, 2,
  738. 3, 1,
  739. HEAVY, LIGHT,
  740. LINE_START, NONE,
  741. new Insets(0, 0, 0, 0),
  742. NONE, NONE));
  743. int indent = getButtonLabelInset(encX509Checkbox);
  744. encrPanel.add(caLabel,
  745. new GridBagConstraints(0, 3,
  746. 1, 1,
  747. LIGHT, LIGHT,
  748. LINE_END, NONE,
  749. new Insets(0, indent, 5, 0),
  750. 0, 0));
  751. encrPanel.add(caInput,
  752. new GridBagConstraints(1, 3,
  753. 1, 1,
  754. HEAVY, LIGHT,
  755. LINE_START, HORIZONTAL,
  756. new Insets(0, 5, 5, 0),
  757. 0, 0));
  758. encrPanel.add(caChooser,
  759. new GridBagConstraints(2, 3,
  760. 1, 1,
  761. LIGHT, LIGHT,
  762. LINE_START, VERTICAL,
  763. new Insets(0, 5, 5, 0),
  764. 0, 0));
  765. encrPanel.add(crlLabel,
  766. new GridBagConstraints(0, 4,
  767. 1, 1,
  768. LIGHT, LIGHT,
  769. LINE_END, NONE,
  770. new Insets(0, indent, 0, 0),
  771. 0, 0));
  772. encrPanel.add(crlInput,
  773. new GridBagConstraints(1, 4,
  774. 1, 1,
  775. HEAVY, LIGHT,
  776. LINE_START, HORIZONTAL,
  777. new Insets(0, 5, 0, 0),
  778. 0, 0));
  779. encrPanel.add(crlChooser,
  780. new GridBagConstraints(2, 4,
  781. 1, 1,
  782. LIGHT, LIGHT,
  783. LINE_START, VERTICAL,
  784. new Insets(0, 5, 0, 0),
  785. 0, 0));
  786. JPanel authPanel = new JPanel(new GridBagLayout());
  787. authPanel.setBorder(BorderFactory.createTitledBorder("Authentication"));
  788. authNoneCheckbox = new JCheckBox("None");
  789. authVncCheckbox = new JCheckBox("Standard VNC");
  790. authPlainCheckbox = new JCheckBox("Plaintext");
  791. authPlainCheckbox.addItemListener(new ItemListener() {
  792. public void itemStateChanged(ItemEvent e) {
  793. handleSendLocalUsername();
  794. }
  795. });
  796. authIdentCheckbox = new JCheckBox("Ident");
  797. authIdentCheckbox.addItemListener(new ItemListener() {
  798. public void itemStateChanged(ItemEvent e) {
  799. handleSendLocalUsername();
  800. }
  801. });
  802. sendLocalUsernameCheckbox = new JCheckBox("Send Local Username");
  803. authPanel.add(authNoneCheckbox,
  804. new GridBagConstraints(0, 0,
  805. REMAINDER, 1,
  806. LIGHT, LIGHT,
  807. LINE_START, NONE,
  808. new Insets(0, 0, 4, 0),
  809. NONE, NONE));
  810. authPanel.add(authVncCheckbox,
  811. new GridBagConstraints(0, 1,
  812. REMAINDER, 1,
  813. LIGHT, LIGHT,
  814. LINE_START, NONE,
  815. new Insets(0, 0, 4, 0),
  816. NONE, NONE));
  817. authPanel.add(authPlainCheckbox,
  818. new GridBagConstraints(0, 2,
  819. 1, 1,
  820. LIGHT, LIGHT,
  821. LINE_START, NONE,
  822. new Insets(0, 0, 2, 0),
  823. NONE, NONE));
  824. authPanel.add(authIdentCheckbox,
  825. new GridBagConstraints(0, 3,
  826. 1, 1,
  827. LIGHT, LIGHT,
  828. LINE_START, NONE,
  829. new Insets(2, 0, 0, 0),
  830. NONE, NONE));
  831. authPanel.add(sendLocalUsernameCheckbox,
  832. new GridBagConstraints(1, 2,
  833. 1, 2,
  834. HEAVY, LIGHT,
  835. LINE_START, NONE,
  836. new Insets(2, 20, 2, 0),
  837. NONE, NONE));
  838. SecPanel.add(vencryptPane,
  839. new GridBagConstraints(0, 0,
  840. REMAINDER, 1,
  841. LIGHT, LIGHT,
  842. LINE_START, HORIZONTAL,
  843. new Insets(0, 0, 4, 0),
  844. NONE, NONE));
  845. SecPanel.add(encrPanel,
  846. new GridBagConstraints(0, 1,
  847. REMAINDER, 1,
  848. LIGHT, LIGHT,
  849. LINE_START, HORIZONTAL,
  850. new Insets(0, 0, 4, 0),
  851. NONE, NONE));
  852. SecPanel.add(authPanel,
  853. new GridBagConstraints(0, 2,
  854. REMAINDER, 1,
  855. LIGHT, LIGHT,
  856. LINE_START, HORIZONTAL,
  857. new Insets(0, 0, 4, 0),
  858. NONE, NONE));
  859. SecPanel.add(Box.createRigidArea(new Dimension(0,0)),
  860. new GridBagConstraints(0, RELATIVE,
  861. REMAINDER, REMAINDER,
  862. HEAVY, HEAVY,
  863. LINE_START, BOTH,
  864. new Insets(0, 0, 0, 0),
  865. NONE, NONE));
  866. return SecPanel;
  867. }
  868. private JPanel createInputPanel() {
  869. JPanel inputPanel = new JPanel(new GridBagLayout());
  870. inputPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  871. viewOnlyCheckbox = new JCheckBox("View only (ignore mouse and keyboard)");
  872. acceptClipboardCheckbox = new JCheckBox("Accept clipboard from server");
  873. sendClipboardCheckbox = new JCheckBox("Send clipboard to server");
  874. JLabel menuKeyLabel = new JLabel("Menu key");
  875. String[] menuKeys = new String[MenuKey.getMenuKeySymbolCount()];
  876. //menuKeys[0] = "None";
  877. for (int i = 0; i < MenuKey.getMenuKeySymbolCount(); i++)
  878. menuKeys[i] = MenuKey.getKeyText(MenuKey.getMenuKeySymbols()[i]);
  879. menuKeyChoice = new JComboBox(menuKeys);
  880. inputPanel.add(viewOnlyCheckbox,
  881. new GridBagConstraints(0, 0,
  882. REMAINDER, 1,
  883. HEAVY, LIGHT,
  884. LINE_START, NONE,
  885. new Insets(0, 0, 4, 0),
  886. NONE, NONE));
  887. inputPanel.add(acceptClipboardCheckbox,
  888. new GridBagConstraints(0, 1,
  889. REMAINDER, 1,
  890. HEAVY, LIGHT,
  891. LINE_START, NONE,
  892. new Insets(0, 0, 4, 0),
  893. NONE, NONE));
  894. inputPanel.add(sendClipboardCheckbox,
  895. new GridBagConstraints(0, 2,
  896. REMAINDER, 1,
  897. HEAVY, LIGHT,
  898. LINE_START, NONE,
  899. new Insets(0, 0, 4, 0),
  900. NONE, NONE));
  901. inputPanel.add(menuKeyLabel,
  902. new GridBagConstraints(0, 3,
  903. 1, 1,
  904. LIGHT, LIGHT,
  905. LINE_START, NONE,
  906. new Insets(0, 0, 0, 0),
  907. NONE, NONE));
  908. inputPanel.add(menuKeyChoice,
  909. new GridBagConstraints(1, 3,
  910. 1, 1,
  911. HEAVY, LIGHT,
  912. LINE_START, NONE,
  913. new Insets(0, 5, 0, 0),
  914. NONE, NONE));
  915. inputPanel.add(Box.createRigidArea(new Dimension(5, 0)),
  916. new GridBagConstraints(0, 4,
  917. REMAINDER, REMAINDER,
  918. HEAVY, HEAVY,
  919. LINE_START, BOTH,
  920. new Insets(0, 0, 0, 0),
  921. NONE, NONE));
  922. return inputPanel;
  923. }
  924. private JPanel createScreenPanel() {
  925. JPanel ScreenPanel = new JPanel(new GridBagLayout());
  926. ScreenPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  927. JPanel SizingPanel = new JPanel(new GridBagLayout());
  928. SizingPanel.setBorder(BorderFactory.createTitledBorder("Desktop Sizing"));
  929. desktopSizeCheckbox = new JCheckBox("Resize remote session on connect");
  930. desktopSizeCheckbox.addItemListener(new ItemListener() {
  931. public void itemStateChanged(ItemEvent e) {
  932. handleDesktopSize();
  933. }
  934. });
  935. desktopWidthInput = new IntegerTextField(5);
  936. desktopHeightInput = new IntegerTextField(5);
  937. JPanel desktopSizePanel =
  938. new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
  939. desktopSizePanel.add(desktopWidthInput);
  940. desktopSizePanel.add(new JLabel(" x "));
  941. desktopSizePanel.add(desktopHeightInput);
  942. sizingGroup = new ButtonGroup();
  943. remoteResizeButton =
  944. new JRadioButton("Resize remote session to the local window");
  945. sizingGroup.add(remoteResizeButton);
  946. remoteScaleButton =
  947. new JRadioButton("Scale remote session to the local window");
  948. sizingGroup.add(remoteScaleButton);
  949. remoteResizeButton.addItemListener(new ItemListener() {
  950. public void itemStateChanged(ItemEvent e) {
  951. handleRemoteResize();
  952. }
  953. });
  954. JLabel scalingFactorLabel = new JLabel("Scaling Factor");
  955. Object[] scalingFactors = {
  956. "Auto", "Fixed Aspect Ratio", "50%", "75%", "95%", "100%", "105%",
  957. "125%", "150%", "175%", "200%", "250%", "300%", "350%", "400%" };
  958. scalingFactorInput = new MyJComboBox(scalingFactors);
  959. scalingFactorInput.setEditable(true);
  960. fullScreenCheckbox = new JCheckBox("Full-screen mode");
  961. fullScreenAllMonitorsCheckbox =
  962. new JCheckBox("Enable full-screen mode over all monitors");
  963. SizingPanel.add(desktopSizeCheckbox,
  964. new GridBagConstraints(0, 0,
  965. REMAINDER, 1,
  966. LIGHT, LIGHT,
  967. LINE_START, NONE,
  968. new Insets(0, 0, 0, 0),
  969. NONE, NONE));
  970. int indent = getButtonLabelInset(desktopSizeCheckbox);
  971. SizingPanel.add(desktopSizePanel,
  972. new GridBagConstraints(0, 1,
  973. REMAINDER, 1,
  974. LIGHT, LIGHT,
  975. LINE_START, NONE,
  976. new Insets(0, indent, 0, 0),
  977. NONE, NONE));
  978. SizingPanel.add(remoteResizeButton,
  979. new GridBagConstraints(0, 2,
  980. REMAINDER, 1,
  981. LIGHT, LIGHT,
  982. LINE_START, NONE,
  983. new Insets(0, 0, 4, 0),
  984. NONE, NONE));
  985. SizingPanel.add(remoteScaleButton,
  986. new GridBagConstraints(0, 3,
  987. REMAINDER, 1,
  988. LIGHT, LIGHT,
  989. LINE_START, NONE,
  990. new Insets(0, 0, 4, 0),
  991. NONE, NONE));
  992. indent = getButtonLabelInset(remoteScaleButton);
  993. SizingPanel.add(scalingFactorLabel,
  994. new GridBagConstraints(0, 4,
  995. 1, 1,
  996. LIGHT, LIGHT,
  997. LINE_START, NONE,
  998. new Insets(0, indent, 4, 0),
  999. NONE, NONE));
  1000. SizingPanel.add(scalingFactorInput,
  1001. new GridBagConstraints(1, 4,
  1002. 1, 1,
  1003. HEAVY, LIGHT,
  1004. LINE_START, NONE,
  1005. new Insets(0, 5, 4, 0),
  1006. NONE, NONE));
  1007. ScreenPanel.add(SizingPanel,
  1008. new GridBagConstraints(0, 0,
  1009. REMAINDER, 1,
  1010. LIGHT, LIGHT,
  1011. LINE_START, HORIZONTAL,
  1012. new Insets(0, 0, 4, 0),
  1013. NONE, NONE));
  1014. ScreenPanel.add(fullScreenCheckbox,
  1015. new GridBagConstraints(0, 1,
  1016. REMAINDER, 1,
  1017. LIGHT, LIGHT,
  1018. LINE_START, NONE,
  1019. new Insets(0, 0, 4, 0),
  1020. NONE, NONE));
  1021. indent = getButtonLabelInset(fullScreenCheckbox);
  1022. ScreenPanel.add(fullScreenAllMonitorsCheckbox,
  1023. new GridBagConstraints(0, 2,
  1024. REMAINDER, 1,
  1025. LIGHT, LIGHT,
  1026. LINE_START, NONE,
  1027. new Insets(0, indent, 4, 0),
  1028. NONE, NONE));
  1029. ScreenPanel.add(Box.createRigidArea(new Dimension(5, 0)),
  1030. new GridBagConstraints(0, 3,
  1031. REMAINDER, REMAINDER,
  1032. HEAVY, HEAVY,
  1033. LINE_START, BOTH,
  1034. new Insets(0, 0, 0, 0),
  1035. NONE, NONE));
  1036. return ScreenPanel;
  1037. }
  1038. private JPanel createMiscPanel() {
  1039. JPanel MiscPanel = new JPanel(new GridBagLayout());
  1040. MiscPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  1041. sharedCheckbox =
  1042. new JCheckBox("Shared (don't disconnect other viewers)");
  1043. dotWhenNoCursorCheckbox = new JCheckBox("Show dot when no cursor");
  1044. acceptBellCheckbox = new JCheckBox("Beep when requested by the server");
  1045. MiscPanel.add(sharedCheckbox,
  1046. new GridBagConstraints(0, 0,
  1047. 1, 1,
  1048. LIGHT, LIGHT,
  1049. LINE_START, NONE,
  1050. new Insets(0, 0, 4, 0),
  1051. NONE, NONE));
  1052. MiscPanel.add(dotWhenNoCursorCheckbox,
  1053. new GridBagConstraints(0, 1,
  1054. 1, 1,
  1055. LIGHT, LIGHT,
  1056. LINE_START, NONE,
  1057. new Insets(0, 0, 4, 0),
  1058. NONE, NONE));
  1059. MiscPanel.add(acceptBellCheckbox,
  1060. new GridBagConstraints(0, 2,
  1061. 1, 1,
  1062. LIGHT, LIGHT,
  1063. LINE_START, NONE,
  1064. new Insets(0, 0, 4, 0),
  1065. NONE, NONE));
  1066. MiscPanel.add(Box.createRigidArea(new Dimension(5, 0)),
  1067. new GridBagConstraints(0, 3,
  1068. REMAINDER, REMAINDER,
  1069. HEAVY, HEAVY,
  1070. LINE_START, BOTH,
  1071. new Insets(0, 0, 0, 0),
  1072. NONE, NONE));
  1073. return MiscPanel;
  1074. }
  1075. private JPanel createSshPanel() {
  1076. JPanel sshPanel = new JPanel(new GridBagLayout());
  1077. sshPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  1078. ButtonGroup sshArgsGroup = new ButtonGroup();
  1079. tunnelCheckbox = new JCheckBox("Tunnel VNC over SSH");
  1080. tunnelCheckbox.addItemListener(new ItemListener() {
  1081. public void itemStateChanged(ItemEvent e) {
  1082. handleTunnel();
  1083. }
  1084. });
  1085. JPanel tunnelPanel = new JPanel(new GridBagLayout());
  1086. viaCheckbox = new JCheckBox("Use SSH gateway");
  1087. viaCheckbox.addItemListener(new ItemListener() {
  1088. public void itemStateChanged(ItemEvent e) {
  1089. handleVia();
  1090. }
  1091. });
  1092. JLabel sshUserLabel = new JLabel("Username");
  1093. viaUserInput = new JTextField();
  1094. JLabel sshUserAtLabel = new JLabel("@");
  1095. JLabel sshHostLabel = new JLabel("Hostname (or IP address)");
  1096. viaHostInput = new JTextField("");
  1097. JLabel sshPortLabel = new JLabel("Port");
  1098. viaPortInput = new IntegerTextField(5);
  1099. extSSHCheckbox = new JCheckBox("Use external SSH client");
  1100. extSSHCheckbox.addItemListener(new ItemListener() {
  1101. public void itemStateChanged(ItemEvent e) {
  1102. handleExtSSH();
  1103. }
  1104. });
  1105. sshClientInput = new JTextField();
  1106. sshClientChooser = new JButton("Browse");
  1107. sshClientChooser.addActionListener(new ActionListener() {
  1108. public void actionPerformed(ActionEvent e) {
  1109. JComponent c = ((JButton)e.getSource()).getRootPane();
  1110. File dflt = new File(extSSHClient.getValueStr());
  1111. File f = showChooser("Path to external SSH client", dflt, c);
  1112. if (f != null && f.exists() && f.isFile() && f.canExecute())
  1113. sshClientInput.setText(f.getAbsolutePath());
  1114. }
  1115. });
  1116. JLabel sshConfigLabel = new JLabel("SSH config file");
  1117. sshConfigInput = new JTextField();
  1118. sshConfigChooser = new JButton("Browse");
  1119. sshConfigChooser.addActionListener(new ActionListener() {
  1120. public void actionPerformed(ActionEvent e) {
  1121. JComponent c = ((JButton)e.getSource()).getRootPane();
  1122. File dflt = new File(sshConfig.getValueStr());
  1123. File f = showChooser("Path to OpenSSH client config file", dflt, c);
  1124. if (f != null && f.exists() && f.isFile() && f.canRead())
  1125. sshConfigInput.setText(f.getAbsolutePath());
  1126. }
  1127. });
  1128. JLabel sshKeyFileLabel = new JLabel("SSH identity file");
  1129. sshKeyFileInput = new JTextField();
  1130. sshKeyFileChooser = new JButton("Browse");
  1131. sshKeyFileChooser.addActionListener(new ActionListener() {
  1132. public void actionPerformed(ActionEvent e) {
  1133. JComponent c = ((JButton)e.getSource()).getRootPane();
  1134. File f = showChooser("Path to SSH key file", null, c);
  1135. if (f != null && f.exists() && f.isFile() && f.canRead())
  1136. sshKeyFileInput.setText(f.getAbsolutePath());
  1137. }
  1138. });
  1139. JPanel sshArgsPanel = new JPanel(new GridBagLayout());
  1140. JLabel sshArgsLabel = new JLabel("Arguments:");
  1141. sshArgsDefaultButton = new GroupedJRadioButton("Default", sshArgsGroup, sshArgsPanel);
  1142. sshArgsDefaultButton.addActionListener(new ActionListener() {
  1143. public void actionPerformed(ActionEvent e) {
  1144. sshArgsInput.setEnabled(sshArgsCustomButton.isSelected());
  1145. }
  1146. });
  1147. sshArgsCustomButton = new GroupedJRadioButton("Custom", sshArgsGroup, sshArgsPanel);
  1148. sshArgsCustomButton.addActionListener(new ActionListener() {
  1149. public void actionPerformed(ActionEvent e) {
  1150. sshArgsInput.setEnabled(sshArgsCustomButton.isSelected());
  1151. }
  1152. });
  1153. sshArgsInput = new JTextField();
  1154. JPanel gatewayPanel = new JPanel(new GridBagLayout());
  1155. gatewayPanel.add(viaCheckbox,
  1156. new GridBagConstraints(0, 0,
  1157. REMAINDER, 1,
  1158. LIGHT, LIGHT,
  1159. LINE_START, NONE,
  1160. new Insets(0, 0, 4, 0),
  1161. NONE, NONE));
  1162. int indent = getButtonLabelInset(viaCheckbox);
  1163. gatewayPanel.add(sshUserLabel,
  1164. new GridBagConstraints(0, 1,
  1165. 1, 1,
  1166. LIGHT, LIGHT,
  1167. LINE_START, HORIZONTAL,
  1168. new Insets(0, indent, 4, 0),
  1169. NONE, NONE));
  1170. gatewayPanel.add(sshHostLabel,
  1171. new GridBagConstraints(2, 1,
  1172. 1, 1,
  1173. HEAVY, LIGHT,
  1174. LINE_START, HORIZONTAL,
  1175. new Insets(0, 0, 4, 0),
  1176. NONE, NONE));
  1177. gatewayPanel.add(sshPortLabel,
  1178. new GridBagConstraints(3, 1,
  1179. 1, 1,
  1180. LIGHT, LIGHT,
  1181. LINE_START, HORIZONTAL,
  1182. new Insets(0, 5, 4, 0),
  1183. NONE, NONE));
  1184. gatewayPanel.add(viaUserInput,
  1185. new GridBagConstraints(0, 2,
  1186. 1, 1,
  1187. LIGHT, LIGHT,
  1188. LINE_START, HORIZONTAL,
  1189. new Insets(0, indent, 0, 0),
  1190. NONE, NONE));
  1191. gatewayPanel.add(sshUserAtLabel,
  1192. new GridBagConstraints(1, 2,
  1193. 1, 1,
  1194. LIGHT, LIGHT,
  1195. LINE_START, HORIZONTAL,
  1196. new Insets(0, 2, 0, 2),
  1197. NONE, NONE));
  1198. gatewayPanel.add(viaHostInput,
  1199. new GridBagConstraints(2, 2,
  1200. 1, 1,
  1201. HEAVY, LIGHT,
  1202. LINE_START, HORIZONTAL,
  1203. new Insets(0, 0, 0, 0),
  1204. NONE, NONE));
  1205. gatewayPanel.add(viaPortInput,
  1206. new GridBagConstraints(3, 2,
  1207. 1, 1,
  1208. LIGHT, LIGHT,
  1209. LINE_START, HORIZONTAL,
  1210. new Insets(0, 5, 0, 0),
  1211. NONE, NONE));
  1212. JPanel clientPanel = new JPanel(new GridBagLayout());
  1213. clientPanel.add(extSSHCheckbox,
  1214. new GridBagConstraints(0, 0,
  1215. 1, 1,
  1216. LIGHT, LIGHT,
  1217. LINE_START, NONE,
  1218. new Insets(0, 0, 0, 0),
  1219. NONE, NONE));
  1220. clientPanel.add(sshClientInput,
  1221. new GridBagConstraints(1, 0,
  1222. 1, 1,
  1223. HEAVY, LIGHT,
  1224. LINE_START, HORIZONTAL,
  1225. new Insets(0, 5, 0, 0),
  1226. NONE, NONE));
  1227. clientPanel.add(sshClientChooser,
  1228. new GridBagConstraints(2, 0,
  1229. 1, 1,
  1230. LIGHT, LIGHT,
  1231. LINE_START, NONE,
  1232. new Insets(0, 5, 0, 0),
  1233. NONE, NONE));
  1234. sshArgsPanel.add(sshArgsLabel,
  1235. new GridBagConstraints(0, 1,
  1236. 1, 1,
  1237. LIGHT, LIGHT,
  1238. LINE_START, NONE,
  1239. new Insets(0, 0, 0, 0),
  1240. NONE, NONE));
  1241. sshArgsPanel.add(sshArgsDefaultButton,
  1242. new GridBagConstraints(1, 1,
  1243. 1, 1,
  1244. LIGHT, LIGHT,
  1245. LINE_START, NONE,
  1246. new Insets(0, 5, 0, 0),
  1247. NONE, NONE));
  1248. sshArgsPanel.add(sshArgsCustomButton,
  1249. new GridBagConstraints(2, 1,
  1250. 1, 1,
  1251. LIGHT, LIGHT,
  1252. LINE_START, NONE,
  1253. new Insets(0, 5, 0, 0),
  1254. NONE, NONE));
  1255. sshArgsPanel.add(sshArgsInput,
  1256. new GridBagConstraints(3, 1,
  1257. 1, 1,
  1258. HEAVY, LIGHT,
  1259. LINE_START, HORIZONTAL,
  1260. new Insets(0, 5, 0, 0),
  1261. NONE, NONE));
  1262. indent = getButtonLabelInset(extSSHCheckbox);
  1263. clientPanel.add(sshArgsPanel,
  1264. new GridBagConstraints(0, 1,
  1265. REMAINDER, 1,
  1266. LIGHT, LIGHT,
  1267. LINE_START, HORIZONTAL,
  1268. new Insets(4, indent, 0, 0),
  1269. NONE, NONE));
  1270. JPanel opensshPanel = new JPanel(new GridBagLayout());
  1271. TitledBorder border =
  1272. BorderFactory.createTitledBorder("Embedded SSH client configuration");
  1273. opensshPanel.setBorder(border);
  1274. opensshPanel.add(sshConfigLabel,
  1275. new GridBagConstraints(0, 0,
  1276. 1, 1,
  1277. LIGHT, LIGHT,
  1278. LINE_START, NONE,
  1279. new Insets(0, 0, 5, 0),
  1280. NONE, NONE));
  1281. opensshPanel.add(sshConfigInput,
  1282. new GridBagConstraints(1, 0,
  1283. 1, 1,
  1284. HEAVY, LIGHT,
  1285. LINE_START, HORIZONTAL,
  1286. new Insets(0, 5, 5, 0),
  1287. NONE, NONE));
  1288. opensshPanel.add(sshConfigChooser,
  1289. new GridBagConstraints(2, 0,
  1290. 1, 1,
  1291. LIGHT, LIGHT,
  1292. LINE_START, VERTICAL,
  1293. new Insets(0, 5, 5, 0),
  1294. NONE, NONE));
  1295. opensshPanel.add(sshKeyFileLabel,
  1296. new GridBagConstraints(0, 1,
  1297. 1, 1,
  1298. LIGHT, LIGHT,
  1299. LINE_START, NONE,
  1300. new Insets(0, 0, 0, 0),
  1301. NONE, NONE));
  1302. opensshPanel.add(sshKeyFileInput,
  1303. new GridBagConstraints(1, 1,
  1304. 1, 1,
  1305. HEAVY, LIGHT,
  1306. LINE_START, HORIZONTAL,
  1307. new Insets(0, 5, 0, 0),
  1308. NONE, NONE));
  1309. opensshPanel.add(sshKeyFileChooser,
  1310. new GridBagConstraints(2, 1,
  1311. 1, 1,
  1312. LIGHT, LIGHT,
  1313. LINE_START, VERTICAL,
  1314. new Insets(0, 5, 0, 0),
  1315. NONE, NONE));
  1316. tunnelPanel.add(gatewayPanel,
  1317. new GridBagConstraints(0, 0,
  1318. REMAINDER, 1,
  1319. HEAVY, LIGHT,
  1320. LINE_START, HORIZONTAL,
  1321. new Insets(0, 0, 4, 0),
  1322. NONE, NONE));
  1323. tunnelPanel.add(clientPanel,
  1324. new GridBagConstraints(0, 1,
  1325. REMAINDER, 1,
  1326. HEAVY, LIGHT,
  1327. LINE_START, HORIZONTAL,
  1328. new Insets(0, 0, 4, 0),
  1329. NONE, NONE));
  1330. tunnelPanel.add(opensshPanel,
  1331. new GridBagConstraints(0, 2,
  1332. REMAINDER, 1,
  1333. HEAVY, LIGHT,
  1334. LINE_START, HORIZONTAL,
  1335. new Insets(0, 0, 0, 0),
  1336. NONE, NONE));
  1337. sshPanel.add(tunnelCheckbox,
  1338. new GridBagConstraints(0, 0,
  1339. REMAINDER, 1,
  1340. LIGHT, LIGHT,
  1341. LINE_START, NONE,
  1342. new Insets(0, 0, 4, 0),
  1343. NONE, NONE));
  1344. indent = getButtonLabelInset(tunnelCheckbox);
  1345. sshPanel.add(tunnelPanel,
  1346. new GridBagConstraints(0, 2,
  1347. REMAINDER, 1,
  1348. LIGHT, LIGHT,
  1349. LINE_START, HORIZONTAL,
  1350. new Insets(0, indent, 4, 0),
  1351. NONE, NONE));
  1352. sshPanel.add(Box.createRigidArea(new Dimension(5, 0)),
  1353. new GridBagConstraints(0, RELATIVE,
  1354. REMAINDER, REMAINDER,
  1355. HEAVY, HEAVY,
  1356. LINE_START, BOTH,
  1357. new Insets(0, 0, 0, 0),
  1358. NONE, NONE));
  1359. return sshPanel;
  1360. }
  1361. private void handleAutoselect()
  1362. {
  1363. ButtonGroup[] groups = { encodingGroup, colorlevelGroup };
  1364. for (ButtonGroup grp : groups) {
  1365. Enumeration<AbstractButton> elems = grp.getElements();
  1366. while (elems.hasMoreElements())
  1367. elems.nextElement().setEnabled(!autoselectCheckbox.isSelected());
  1368. }
  1369. // JPEG setting is also affected by autoselection
  1370. jpegCheckbox.setEnabled(!autoselectCheckbox.isSelected());
  1371. handleJpeg();
  1372. }
  1373. private void handleCompression()
  1374. {
  1375. compressionInput.setEnabled(compressionCheckbox.isSelected());
  1376. }
  1377. private void handleJpeg()
  1378. {
  1379. if (jpegCheckbox.isSelected() &&
  1380. !autoselectCheckbox.isSelected())
  1381. jpegInput.setEnabled(true);
  1382. else
  1383. jpegInput.setEnabled(false);
  1384. }
  1385. private void handleX509()
  1386. {
  1387. caInput.setEnabled(encX509Checkbox.isSelected());
  1388. caChooser.setEnabled(encX509Checkbox.isSelected());
  1389. crlInput.setEnabled(encX509Checkbox.isSelected());
  1390. crlChooser.setEnabled(encX509Checkbox.isSelected());
  1391. }
  1392. private void handleSendLocalUsername()
  1393. {
  1394. boolean value = authIdentCheckbox.isSelected() ||
  1395. authPlainCheckbox.isSelected();
  1396. sendLocalUsernameCheckbox.setEnabled(value);
  1397. }
  1398. private void handleDesktopSize()
  1399. {
  1400. desktopWidthInput.setEnabled(desktopSizeCheckbox.isSelected());
  1401. desktopHeightInput.setEnabled(desktopSizeCheckbox.isSelected());
  1402. }
  1403. private void handleRemoteResize()
  1404. {
  1405. scalingFactorInput.setEnabled(!remoteResizeButton.isSelected());
  1406. }
  1407. private void handleTunnel()
  1408. {
  1409. viaCheckbox.setEnabled(tunnelCheckbox.isSelected());
  1410. extSSHCheckbox.setEnabled(tunnelCheckbox.isSelected());
  1411. if (tunnelCheckbox.isSelected()) {
  1412. JComponent[] components = { viaUserInput, viaHostInput, viaPortInput };
  1413. for (JComponent c : components)
  1414. c.setEnabled(viaCheckbox.isSelected());
  1415. sshClientInput.setEnabled(extSSHCheckbox.isSelected());
  1416. sshClientChooser.setEnabled(extSSHCheckbox.isSelected());
  1417. sshArgsDefaultButton.setEnabled(extSSHCheckbox.isSelected());
  1418. sshArgsCustomButton.setEnabled(extSSHCheckbox.isSelected());
  1419. sshArgsInput.setEnabled(extSSHCheckbox.isSelected());
  1420. sshConfigInput.setEnabled(!extSSHCheckbox.isSelected());
  1421. sshConfigChooser.setEnabled(!extSSHCheckbox.isSelected());
  1422. sshKeyFileInput.setEnabled(!extSSHCheckbox.isSelected());
  1423. sshKeyFileChooser.setEnabled(!extSSHCheckbox.isSelected());
  1424. } else {
  1425. JComponent[] components = {
  1426. viaUserInput, viaHostInput, viaPortInput, sshClientInput,
  1427. sshClientChooser, sshArgsDefaultButton, sshArgsCustomButton,
  1428. sshArgsInput, sshConfigInput, sshConfigChooser, sshKeyFileInput,
  1429. sshKeyFileChooser, };
  1430. for (JComponent c : components)
  1431. c.setEnabled(false);
  1432. }
  1433. }
  1434. private void handleVia()
  1435. {
  1436. if (tunnelCheckbox.isSelected()) {
  1437. viaUserInput.setEnabled(viaCheckbox.isSelected());
  1438. viaHostInput.setEnabled(viaCheckbox.isSelected());
  1439. viaPortInput.setEnabled(viaCheckbox.isSelected());
  1440. }
  1441. }
  1442. private void handleExtSSH()
  1443. {
  1444. if (tunnelCheckbox.isSelected()) {
  1445. sshClientInput.setEnabled(extSSHCheckbox.isSelected());
  1446. sshClientChooser.setEnabled(extSSHCheckbox.isSelected());
  1447. sshArgsDefaultButton.setEnabled(extSSHCheckbox.isSelected());
  1448. sshArgsCustomButton.setEnabled(extSSHCheckbox.isSelected());
  1449. sshConfigInput.setEnabled(!extSSHCheckbox.isSelected());
  1450. sshConfigChooser.setEnabled(!extSSHCheckbox.isSelected());
  1451. sshKeyFileInput.setEnabled(!extSSHCheckbox.isSelected());
  1452. sshKeyFileChooser.setEnabled(!extSSHCheckbox.isSelected());
  1453. if (sshArgsCustomButton.isSelected())
  1454. sshArgsInput.setEnabled(extSSHCheckbox.isSelected());
  1455. else
  1456. sshArgsInput.setEnabled(false);
  1457. }
  1458. }
  1459. private void handleRfbState()
  1460. {
  1461. CConn cc = VncViewer.cc;
  1462. if (cc != null && cc.state() == CConnection.stateEnum.RFBSTATE_NORMAL) {
  1463. JComponent[] components = {
  1464. encNoneCheckbox, encTLSCheckbox, encX509Checkbox, authNoneCheckbox,
  1465. authVncCheckbox, authVncCheckbox, authIdentCheckbox, authPlainCheckbox,
  1466. sendLocalUsernameCheckbox, caInput, caChooser, crlInput, crlChooser,
  1467. sharedCheckbox, tunnelCheckbox, viaCheckbox, viaUserInput, viaHostInput,
  1468. viaPortInput, extSSHCheckbox, sshClientInput, sshClientChooser,
  1469. sshArgsDefaultButton, sshArgsCustomButton, sshArgsInput, sshConfigInput,
  1470. sshKeyFileInput, sshConfigChooser, sshKeyFileChooser,
  1471. };
  1472. for (JComponent c : components)
  1473. c.setEnabled(false);
  1474. }
  1475. }
  1476. static LogWriter vlog = new LogWriter("OptionsDialog");
  1477. }