aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/CMakeLists.txt2
-rw-r--r--java/com/tigervnc/network/SocketDescriptor.java6
-rw-r--r--java/com/tigervnc/vncviewer/UserDialog.java63
3 files changed, 26 insertions, 45 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index b124fc5d..bafa5fc6 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.11)
project(tigervnc-java Java)
if(NOT VERSION)
- set(VERSION 1.10.80)
+ set(VERSION 1.11.80)
endif()
find_package(Java)
diff --git a/java/com/tigervnc/network/SocketDescriptor.java b/java/com/tigervnc/network/SocketDescriptor.java
index b4c99c74..42e785ec 100644
--- a/java/com/tigervnc/network/SocketDescriptor.java
+++ b/java/com/tigervnc/network/SocketDescriptor.java
@@ -68,9 +68,9 @@ public class SocketDescriptor implements FileDescriptor {
private static SelectorProvider DefaultSelectorProvider() {
// kqueue() selector provider on OS X is not working, fall back to select() for now
- String os = System.getProperty("os.name");
- if (os.startsWith("Mac OS X"))
- System.setProperty("java.nio.channels.spi.SelectorProvider","sun.nio.ch.PollSelectorProvider");
+ //String os = System.getProperty("os.name");
+ //if (os.startsWith("Mac OS X"))
+ // System.setProperty("java.nio.channels.spi.SelectorProvider","sun.nio.ch.PollSelectorProvider");
return SelectorProvider.provider();
}
diff --git a/java/com/tigervnc/vncviewer/UserDialog.java b/java/com/tigervnc/vncviewer/UserDialog.java
index f3ca726a..d35be48d 100644
--- a/java/com/tigervnc/vncviewer/UserDialog.java
+++ b/java/com/tigervnc/vncviewer/UserDialog.java
@@ -42,32 +42,6 @@ import static javax.swing.JOptionPane.*;
public class UserDialog implements UserPasswdGetter, UserMsgBox
{
- private class MyLayerUI extends LayerUI {
- // Using a JButton for the "?" icon yields the best look, but there
- // does not seem to be any reasonable way to disable a JButton without
- // also changing the color. This wrapper just intercepts any mouse
- // click events so that the button just looks like an icon.
- @Override
- public void eventDispatched(AWTEvent e, JLayer l) {
- if (e instanceof InputEvent)
- ((InputEvent) e).consume();
- }
-
- @Override
- public void installUI(JComponent c) {
- super.installUI(c);
- if (c instanceof JLayer) {
- JLayer<?> layer = (JLayer<?>)c;
- layer.setLayerEventMask(AWTEvent.MOUSE_EVENT_MASK);
- }
- }
-
- @Override
- protected void processMouseEvent(MouseEvent e, JLayer l) {
- super.processMouseEvent(e, l);
- }
- }
-
public final void getUserPasswd(boolean secure, StringBuffer user, StringBuffer password)
{
String passwordFileStr = passwordFile.getValue();
@@ -100,7 +74,6 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
JDialog win;
JLabel banner;
JTextField username = null;
- JLayer icon;
int y;
@@ -129,13 +102,18 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
y = 20 + 10;
- JButton iconb = new JButton("?");
- iconb.setVerticalAlignment(JLabel.CENTER);
- iconb.setFont(new Font("Times", Font.BOLD, 34));
- iconb.setForeground(Color.BLUE);
- LayerUI ui = new MyLayerUI();
- icon = new JLayer(iconb, ui);
+ JButton icon = new JButton("?");
+ icon.setVerticalAlignment(JLabel.CENTER);
+ icon.setFont(new Font("Times", Font.BOLD, 34));
+ icon.setForeground(Color.BLUE);
icon.setBounds(10, y, 50, 50);
+ // the following disables the "?" icon without changing the color
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ Painter painter = (Painter)defaults.get("Button[Enabled].backgroundPainter");
+ defaults.put("Button[Disabled].backgroundPainter", painter);
+ icon.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
+ icon.putClientProperty("Nimbus.Overrides", defaults);
+ icon.setEnabled(false);
msg.add(icon);
y += 5;
@@ -151,14 +129,16 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
y += 25 + 5;
}
- JLabel passwdLabel = new JLabel("Password:");
- passwdLabel.setBounds(70, y, msg.getSize().width-70-10, 20);
- msg.add(passwdLabel);
- y += 20 + 5;
final JPasswordField passwd = new JPasswordField(30);
- passwd.setBounds(70, y, msg.getSize().width-70-10, 25);
- msg.add(passwd);
- y += 25 + 5;
+ if (password != null) {
+ JLabel passwdLabel = new JLabel("Password:");
+ passwdLabel.setBounds(70, y, msg.getSize().width-70-10, 20);
+ msg.add(passwdLabel);
+ y += 20 + 5;
+ passwd.setBounds(70, y, msg.getSize().width-70-10, 25);
+ msg.add(passwd);
+ y += 25 + 5;
+ }
msg.setPreferredSize(new Dimension(410, y));
@@ -171,7 +151,8 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
options[0]){//default button title
@Override
public void selectInitialValue() {
- passwd.requestFocusInWindow();
+ if (password != null)
+ passwd.requestFocusInWindow();
}
};
pane.setBorder(new EmptyBorder(0,0,0,0));