home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Choice;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Frame;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Label;
- import java.awt.Window;
-
- class optionsFrame extends Frame {
- static String[] names = new String[]{"Encoding", "Use CopyRect", "Mouse buttons 2 and 3", "Raw pixel drawing", "CopyRect", "Share desktop"};
- static String[][] values = new String[][]{{"Raw", "RRE", "CoRRE", "Hextile"}, {"Yes", "No"}, {"Normal", "Reversed"}, {"Fast", "Reliable"}, {"Fast", "Reliable"}, {"Yes", "No"}};
- final int encodingIndex;
- final int useCopyRectIndex = 1;
- final int mouseButtonIndex = 2;
- final int rawPixelDrawingIndex = 3;
- final int copyRectFastIndex = 4;
- final int shareDesktopIndex = 5;
- Label[] labels;
- Choice[] choices;
- Button dismiss;
- // $FF: renamed from: v vncviewer
- vncviewer field_0;
- int[] encodings;
- int nEncodings;
- boolean reverseMouseButtons2And3;
- boolean drawEachPixelForRawRects;
- boolean copyRectFast;
- boolean shareDesktop;
-
- optionsFrame(vncviewer var1) {
- super("VNC Options");
- this.labels = new Label[names.length];
- this.choices = new Choice[names.length];
- this.encodings = new int[10];
- this.field_0 = var1;
- GridBagLayout var2 = new GridBagLayout();
- ((Container)this).setLayout(var2);
- GridBagConstraints var3 = new GridBagConstraints();
- var3.fill = 1;
-
- for(int var4 = 0; var4 < names.length; ++var4) {
- this.labels[var4] = new Label(names[var4]);
- var3.gridwidth = 1;
- var2.setConstraints(this.labels[var4], var3);
- ((Container)this).add(this.labels[var4]);
- this.choices[var4] = new Choice();
- var3.gridwidth = 0;
- var2.setConstraints(this.choices[var4], var3);
- ((Container)this).add(this.choices[var4]);
-
- for(int var5 = 0; var5 < values[var4].length; ++var5) {
- this.choices[var4].addItem(values[var4][var5]);
- }
- }
-
- this.dismiss = new Button("Dismiss");
- var3.gridwidth = 0;
- var2.setConstraints(this.dismiss, var3);
- ((Container)this).add(this.dismiss);
- ((Window)this).pack();
- this.choices[0].select("Hextile");
- this.choices[1].select("Yes");
- this.choices[2].select("Normal");
- this.choices[3].select("Reliable");
- this.choices[4].select("Fast");
- this.choices[5].select("No");
-
- for(int var8 = 0; var8 < names.length; ++var8) {
- String var6 = this.field_0.readParameter(names[var8], false);
- if (var6 != null) {
- for(int var7 = 0; var7 < values[var8].length; ++var7) {
- if (var6.equalsIgnoreCase(values[var8][var7])) {
- this.choices[var8].select(var7);
- }
- }
- }
- }
-
- this.setEncodings();
- this.setOtherOptions();
- }
-
- void disableShareDesktop() {
- this.labels[5].disable();
- this.choices[5].disable();
- }
-
- void setEncodings() {
- this.nEncodings = 0;
- if (this.choices[1].getSelectedItem().equals("Yes")) {
- this.encodings[this.nEncodings++] = 1;
- }
-
- byte var1 = 0;
- if (this.choices[0].getSelectedItem().equals("RRE")) {
- var1 = 2;
- } else if (this.choices[0].getSelectedItem().equals("CoRRE")) {
- var1 = 4;
- } else if (this.choices[0].getSelectedItem().equals("Hextile")) {
- var1 = 5;
- }
-
- if (var1 == 0) {
- this.choices[3].select("Fast");
- this.drawEachPixelForRawRects = false;
- }
-
- this.encodings[this.nEncodings++] = var1;
- if (var1 != 2) {
- this.encodings[this.nEncodings++] = 2;
- }
-
- if (var1 != 4) {
- this.encodings[this.nEncodings++] = 4;
- }
-
- if (var1 != 5) {
- this.encodings[this.nEncodings++] = 5;
- }
-
- this.field_0.setEncodings();
- }
-
- void setOtherOptions() {
- this.reverseMouseButtons2And3 = this.choices[2].getSelectedItem().equals("Reversed");
- this.drawEachPixelForRawRects = this.choices[3].getSelectedItem().equals("Reliable");
- this.copyRectFast = this.choices[4].getSelectedItem().equals("Fast");
- this.shareDesktop = this.choices[5].getSelectedItem().equals("Yes");
- }
-
- public boolean action(Event var1, Object var2) {
- if (var1.target == this.dismiss) {
- ((Component)this).hide();
- return true;
- } else if (var1.target != this.choices[0] && var1.target != this.choices[1]) {
- if (var1.target != this.choices[2] && var1.target != this.choices[3] && var1.target != this.choices[4] && var1.target != this.choices[5]) {
- return false;
- } else {
- this.setOtherOptions();
- return true;
- }
- } else {
- this.setEncodings();
- return true;
- }
- }
- }
-