提交 2cc1c0a1 编写于 作者: V VKARNAUK

6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning

Reviewed-by: rupashka, art
上级 121fc455
/* /*
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -644,6 +644,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel ...@@ -644,6 +644,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"released SPACE", "released" "released SPACE", "released"
}), }),
"Caret.width",
new DesktopProperty("win.caret.width", null),
"CheckBox.font", ControlFont, "CheckBox.font", ControlFont,
"CheckBox.interiorBackground", WindowBackgroundColor, "CheckBox.interiorBackground", WindowBackgroundColor,
"CheckBox.background", ControlBackgroundColor, "CheckBox.background", ControlBackgroundColor,
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1503,9 +1503,14 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou ...@@ -1503,9 +1503,14 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
if (caretWidth > -1) { if (caretWidth > -1) {
return caretWidth; return caretWidth;
} else {
Object property = UIManager.get("Caret.width");
if (property instanceof Integer) {
return ((Integer) property).intValue();
} else {
return 1;
}
} }
return 1;
} }
// --- serialization --------------------------------------------- // --- serialization ---------------------------------------------
......
/* /*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -70,6 +70,7 @@ void AwtDesktopProperties::GetWindowsParameters() { ...@@ -70,6 +70,7 @@ void AwtDesktopProperties::GetWindowsParameters() {
GetNonClientParameters(); GetNonClientParameters();
GetIconParameters(); GetIconParameters();
GetColorParameters(); GetColorParameters();
GetCaretParameters();
GetOtherParameters(); GetOtherParameters();
GetSoundEvents(); GetSoundEvents();
GetSystemProperties(); GetSystemProperties();
...@@ -636,6 +637,10 @@ void AwtDesktopProperties::GetSoundEvents() { ...@@ -636,6 +637,10 @@ void AwtDesktopProperties::GetSoundEvents() {
SetSoundProperty(TEXT("win.sound.start"), TEXT("SystemStart")); SetSoundProperty(TEXT("win.sound.start"), TEXT("SystemStart"));
} }
void AwtDesktopProperties::GetCaretParameters() {
SetIntegerProperty(TEXT("win.caret.width"), GetIntegerParameter(SPI_GETCARETWIDTH));
}
BOOL AwtDesktopProperties::GetBooleanParameter(UINT spi) { BOOL AwtDesktopProperties::GetBooleanParameter(UINT spi) {
BOOL flag; BOOL flag;
SystemParametersInfo(spi, 0, &flag, 0); SystemParametersInfo(spi, 0, &flag, 0);
......
/* /*
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -64,6 +64,7 @@ class AwtDesktopProperties { ...@@ -64,6 +64,7 @@ class AwtDesktopProperties {
void GetColorParameters(); void GetColorParameters();
void GetOtherParameters(); void GetOtherParameters();
void GetSoundEvents(); void GetSoundEvents();
void GetCaretParameters();
static BOOL GetBooleanParameter(UINT spi); static BOOL GetBooleanParameter(UINT spi);
static UINT GetIntegerParameter(UINT spi); static UINT GetIntegerParameter(UINT spi);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册