Browse Source

Renamed to conform new group id.

Prepared for maven publishing.
pull/15/head v1.2
weisj 5 years ago
parent
commit
6aaafbe975
  1. 1
      .gitignore
  2. 121
      build.gradle
  3. 2
      darklaf.iml
  4. 5
      gradle.properties
  5. 18
      src/jniplatform/cpp/JNIDecorations.cpp
  6. 77
      src/jniplatform/cpp/com_github_weisj_darklaf_platform_windows_JNIDecorations.h
  7. 77
      src/jniplatform/cpp/com_weis_darklaf_platform_windows_JNIDecorations.h
  8. 220
      src/main/java/com/github/weisj/darklaf/DarkLaf.java
  9. 2
      src/main/java/com/github/weisj/darklaf/DarkLafInfo.java
  10. 36
      src/main/java/com/github/weisj/darklaf/DarkMetalTheme.java
  11. 10
      src/main/java/com/github/weisj/darklaf/LafManager.java
  12. 2
      src/main/java/com/github/weisj/darklaf/color/DarkColorModel.java
  13. 2
      src/main/java/com/github/weisj/darklaf/color/DarkColorModelCMYK.java
  14. 2
      src/main/java/com/github/weisj/darklaf/color/DarkColorModelHSB.java
  15. 2
      src/main/java/com/github/weisj/darklaf/color/DarkColorModelHSL.java
  16. 4
      src/main/java/com/github/weisj/darklaf/components/ArrowButton.java
  17. 27
      src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java
  18. 41
      src/main/java/com/github/weisj/darklaf/components/ClosableTabbedPane.java
  19. 10
      src/main/java/com/github/weisj/darklaf/components/ColorPipetteBase.java
  20. 34
      src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java
  21. 2
      src/main/java/com/github/weisj/darklaf/components/Disposable.java
  22. 4
      src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java
  23. 2
      src/main/java/com/github/weisj/darklaf/components/SelectableTreeNode.java
  24. 2
      src/main/java/com/github/weisj/darklaf/components/ShadowButton.java
  25. 45
      src/main/java/com/github/weisj/darklaf/components/TabEvent.java
  26. 36
      src/main/java/com/github/weisj/darklaf/components/TabListener.java
  27. 44
      src/main/java/com/github/weisj/darklaf/components/TabPropertyChangeEvent.java
  28. 27
      src/main/java/com/github/weisj/darklaf/components/alignment/Alignment.java
  29. 2
      src/main/java/com/github/weisj/darklaf/components/alignment/AlignmentHelper.java
  30. 2
      src/main/java/com/github/weisj/darklaf/components/alignment/AlignmentStrategy.java
  31. 29
      src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java
  32. 27
      src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java
  33. 25
      src/main/java/com/github/weisj/darklaf/components/border/MutableLineBorder.java
  34. 24
      src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java
  35. 28
      src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java
  36. 2
      src/main/java/com/github/weisj/darklaf/components/tabframe/PopupContainer.java
  37. 2
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabArea.java
  38. 4
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContent.java
  39. 28
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java
  40. 4
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFramePopup.java
  41. 4
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameTab.java
  42. 4
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameTabContainer.java
  43. 8
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameTabLabel.java
  44. 4
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameUI.java
  45. 12
      src/main/java/com/github/weisj/darklaf/components/tabframe/TabbedPopup.java
  46. 10
      src/main/java/com/github/weisj/darklaf/components/tabframe/ToggleSplitPane.java
  47. 2
      src/main/java/com/github/weisj/darklaf/components/text/SearchEvent.java
  48. 2
      src/main/java/com/github/weisj/darklaf/components/text/SearchListener.java
  49. 2
      src/main/java/com/github/weisj/darklaf/components/text/SearchTextField.java
  50. 2
      src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java
  51. 49
      src/main/java/com/github/weisj/darklaf/components/tooltip/DarkToolTip.java
  52. 258
      src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java
  53. 2
      src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipListener.java
  54. 2
      src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipStyle.java
  55. 4
      src/main/java/com/github/weisj/darklaf/components/tooltip/TooltipAwareButton.java
  56. 4
      src/main/java/com/github/weisj/darklaf/components/tooltip/TooltipAwareToggleButton.java
  57. 25
      src/main/java/com/github/weisj/darklaf/components/tristate/TristateButtonModel.java
  58. 29
      src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBox.java
  59. 44
      src/main/java/com/github/weisj/darklaf/components/tristate/TristateState.java
  60. 2
      src/main/java/com/github/weisj/darklaf/components/uiresource/Insets2D.java
  61. 2
      src/main/java/com/github/weisj/darklaf/components/uiresource/JLabelUIResource.java
  62. 2
      src/main/java/com/github/weisj/darklaf/components/uiresource/JPanelUIResource.java
  63. 2
      src/main/java/com/github/weisj/darklaf/components/uiresource/UIResourceWrapper.java
  64. 41
      src/main/java/com/github/weisj/darklaf/decorators/AncestorAdapter.java
  65. 27
      src/main/java/com/github/weisj/darklaf/decorators/CellRenderer.java
  66. 2
      src/main/java/com/github/weisj/darklaf/decorators/HoverListener.java
  67. 2
      src/main/java/com/github/weisj/darklaf/decorators/MouseResponder.java
  68. 2
      src/main/java/com/github/weisj/darklaf/decorators/PlainAction.java
  69. 2
      src/main/java/com/github/weisj/darklaf/decorators/PopupMenuAdapter.java
  70. 2
      src/main/java/com/github/weisj/darklaf/icons/DarkSVGIcon.java
  71. 2
      src/main/java/com/github/weisj/darklaf/icons/EmptyIcon.java
  72. 25
      src/main/java/com/github/weisj/darklaf/icons/IconColorMapper.java
  73. 2
      src/main/java/com/github/weisj/darklaf/icons/IconLoader.java
  74. 2
      src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java
  75. 2
      src/main/java/com/github/weisj/darklaf/icons/LazyImageIcon.java
  76. 4
      src/main/java/com/github/weisj/darklaf/icons/RotatableIcon.java
  77. 57
      src/main/java/com/github/weisj/darklaf/icons/ThemedSVGIcon.java
  78. 34
      src/main/java/com/github/weisj/darklaf/icons/UIAwareIcon.java
  79. 2
      src/main/java/com/github/weisj/darklaf/log/LogFormatter.java
  80. 25
      src/main/java/com/github/weisj/darklaf/platform/NativeUtil.java
  81. 31
      src/main/java/com/github/weisj/darklaf/platform/windows/JNIDecorations.java
  82. 22
      src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java
  83. 67
      src/main/java/com/github/weisj/darklaf/theme/IntelliJTheme.java
  84. 4
      src/main/java/com/github/weisj/darklaf/theme/SolarizedDarkTheme.java
  85. 4
      src/main/java/com/github/weisj/darklaf/theme/SolarizedLightTheme.java
  86. 33
      src/main/java/com/github/weisj/darklaf/theme/Theme.java
  87. 2
      src/main/java/com/github/weisj/darklaf/theme/UnsupportedThemeException.java
  88. 6
      src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  89. 108
      src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  90. 34
      src/main/java/com/github/weisj/darklaf/ui/button/DarkToggleButtonUI.java
  91. 2
      src/main/java/com/github/weisj/darklaf/ui/cell/CellEditorToggleButton.java
  92. 37
      src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellBorder.java
  93. 10
      src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java
  94. 73
      src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxBorder.java
  95. 33
      src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxMenuItemUI.java
  96. 10
      src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxUI.java
  97. 6
      src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPipette.java
  98. 25
      src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPreviewComponent.java
  99. 4
      src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorValueFormatter.java
  100. 8
      src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheel.java
  101. Some files were not shown because too many files have changed in this diff Show More

1
.gitignore vendored

@ -43,3 +43,4 @@ venv/
# Windows # Windows
Thumbs.db Thumbs.db
/.recommenders/ /.recommenders/
/key.gpg

121
build.gradle

@ -4,6 +4,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '5.1.0' id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'java' id 'java'
id 'maven-publish' id 'maven-publish'
id 'signing'
id 'idea' id 'idea'
id 'cpp' id 'cpp'
} }
@ -25,26 +26,61 @@ dependencies {
testCompile 'org.swinglabs:swingx:1.6.1' testCompile 'org.swinglabs:swingx:1.6.1'
} }
group = 'com.weis'
version = '1.3'
task sourceJar(type: Jar, dependsOn: classes) { task sourceJar(type: Jar, dependsOn: classes) {
classifier 'sources' classifier 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
} }
artifacts {
archives jar
archives sourceJar
}
signing {
sign configurations.archives
}
publishing { publishing {
publications { publications {
maven(MavenPublication) { mavenJava(MavenPublication) {
customizePom(pom)
groupId = 'com.github.weisj'
artifactId 'darklaf'
version = '1.3'
from components.java from components.java
artifact tasks.sourceJar
// create the sign pom artifact
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
}
artifact(sourceJar) {
classifier = 'sources'
}
// create the signed artifacts
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
}
} }
} }
repositories { repositories {
maven { maven {
name 'deploy'
url deployRepoUrl url deployRepoUrl
credentials { credentials {
username = deployRepoUsername username = deployRepoUsername
@ -54,26 +90,81 @@ publishing {
} }
} }
println "Building on OS: " + System.properties['os.name'] def customizePom(pom) {
println "Using JDK: " + System.properties['java.home'] pom.withXml {
def root = asNode()
model { // eliminate test-scoped dependencies (no need in maven central POMs)
platforms { root.dependencies.removeAll { dep ->
x86 { dep.scope == "test"
architecture 'x86'
} }
x64 {
architecture 'x86_64' // add all items necessary for maven central publication
root.children().last() + {
resolveStrategy = DELEGATE_FIRST
description 'A themeable Look and Feel for java swing.'
name 'Darklaf'
url 'https://github.com/mautini/schemaorg-java'
organization {
name 'com.github.weisj'
url 'https://github.com/weisj'
}
issueManagement {
system 'GitHub'
url 'https://github.com/weisJ/darklaf/issues'
}
licenses {
license {
name 'MIT'
url 'https://github.com/weisJ/darklaf/blob/master/licence/LICENSE'
distribution 'repo'
}
}
scm {
url 'https://github.com/weisJ/darklaf'
connection 'scm:git:git://github.com/weisJ/darklaf.git'
developerConnection 'scm:git:ssh://git@github.com:weisj/darklaf.git'
}
developers {
developer {
name 'Jannis Weis'
}
}
} }
} }
} }
model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}
tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}
println "Building on OS: " + System.properties['os.name']
println "Using JDK: " + System.properties['java.home']
compileJava { compileJava {
sourceCompatibility = 11 sourceCompatibility = 11
targetCompatibility = 11 targetCompatibility = 11
} }
model { model {
platforms {
x86 {
architecture 'x86'
}
x64 {
architecture 'x86_64'
}
}
components { components {
jniplatform(NativeLibrarySpec) { jniplatform(NativeLibrarySpec) {
targetPlatform "x86" targetPlatform "x86"

2
darklaf.iml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="darklaf" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.weis" external.system.module.version="1.3" type="JAVA_MODULE" version="4"> <module external.linked.project.id="darklaf" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11" inherit-compiler-output="true"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11" inherit-compiler-output="true">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/.gradle" />

5
gradle.properties

@ -1,5 +0,0 @@
org.gradle.warning.mode = all
externalVersion = 1.0-SNAPSHOT
deployRepoUrl = https://my-repo.com/maven-snapshots
deployRepoUsername = your-username
deployRepoPassword = your-password

18
src/jniplatform/cpp/JNIDecorations.cpp

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include "JNIDecorations.h"; #include "JNIDecorations.h";
#include "com_weis_darklaf_platform_windows_JNIDecorations.h" #include "com_github_weisj_darklaf_platform_windows_JNIDecorations.h"
#include <dwmapi.h> #include <dwmapi.h>
#include <iostream> #include <iostream>
#include <map> #include <map>
@ -120,7 +120,7 @@ LRESULT CALLBACK WindowWrapper::WindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_setResizable(JNIEnv *env, jclass obj, jlong hwnd, jboolean res) JJava_com_github_weisj_darklaf_platform_windows_JNIDecorations_setResizable(JNIEnv *env, jclass obj, jlong hwnd, jboolean res)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
auto wrap = wrapper_map[handle]; auto wrap = wrapper_map[handle];
@ -131,7 +131,7 @@ Java_com_weis_darklaf_platform_windows_JNIDecorations_setResizable(JNIEnv *env,
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_updateValues(JNIEnv *env, jclass obj, jlong hwnd, Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_updateValues(JNIEnv *env, jclass obj, jlong hwnd,
jint l, jint r, jint h) jint l, jint r, jint h)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
@ -145,7 +145,7 @@ Java_com_weis_darklaf_platform_windows_JNIDecorations_updateValues(JNIEnv *env,
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_setBackground(JNIEnv *env, jclass obj, jlong hwnd, jint r, jint g, jint b) Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_setBackground(JNIEnv *env, jclass obj, jlong hwnd, jint r, jint g, jint b)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
auto wrap = wrapper_map[handle]; auto wrap = wrapper_map[handle];
@ -156,7 +156,7 @@ Java_com_weis_darklaf_platform_windows_JNIDecorations_setBackground(JNIEnv *env,
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_installDecorations(JNIEnv *env, jclass obj, jlong hwnd) Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_installDecorations(JNIEnv *env, jclass obj, jlong hwnd)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
@ -184,7 +184,7 @@ Java_com_weis_darklaf_platform_windows_JNIDecorations_installDecorations(JNIEnv
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_uninstallDecorations(JNIEnv *env, jclass obj, jlong hwnd) Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_uninstallDecorations(JNIEnv *env, jclass obj, jlong hwnd)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
auto wrap = wrapper_map[handle]; auto wrap = wrapper_map[handle];
@ -199,21 +199,21 @@ Java_com_weis_darklaf_platform_windows_JNIDecorations_uninstallDecorations(JNIEn
//Window functions. //Window functions.
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_minimize(JNIEnv *env, jclass obj, jlong hwnd) Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_minimize(JNIEnv *env, jclass obj, jlong hwnd)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
ShowWindow(handle, SW_MINIMIZE); ShowWindow(handle, SW_MINIMIZE);
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_maximize(JNIEnv *env, jclass obj, jlong hwnd) Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_maximize(JNIEnv *env, jclass obj, jlong hwnd)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
ShowWindow(handle, SW_MAXIMIZE); ShowWindow(handle, SW_MAXIMIZE);
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weis_darklaf_platform_windows_JNIDecorations_restore(JNIEnv *env, jclass obj, jlong hwnd) Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_restore(JNIEnv *env, jclass obj, jlong hwnd)
{ {
HWND handle = reinterpret_cast<HWND>(hwnd); HWND handle = reinterpret_cast<HWND>(hwnd);
ShowWindow(handle, SW_RESTORE); ShowWindow(handle, SW_RESTORE);

77
src/jniplatform/cpp/com_github_weisj_darklaf_platform_windows_JNIDecorations.h

@ -0,0 +1,77 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_github_weisj_darklaf_platform_windows_JNIDecorations */
#ifndef _Included_com_github_weisj_darklaf_platform_windows_JNIDecorations
#define _Included_com_github_weisj_darklaf_platform_windows_JNIDecorations
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: updateValues
* Signature: (JIII)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_updateValues
(JNIEnv *, jclass, jlong, jint, jint, jint);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: setResizable
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_setResizable
(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: setBackground
* Signature: (JIII)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_setBackground
(JNIEnv *, jclass, jlong, jint, jint, jint);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: minimize
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_minimize
(JNIEnv *, jclass, jlong);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: maximize
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_maximize
(JNIEnv *, jclass, jlong);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: restore
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_restore
(JNIEnv *, jclass, jlong);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: installDecorations
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_installDecorations
(JNIEnv *, jclass, jlong);
/*
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations
* Method: uninstallDecorations
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_uninstallDecorations
(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
}
#endif
#endif

77
src/jniplatform/cpp/com_weis_darklaf_platform_windows_JNIDecorations.h

@ -1,77 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_weis_darklaf_platform_windows_JNIDecorations */
#ifndef _Included_com_weis_darklaf_platform_windows_JNIDecorations
#define _Included_com_weis_darklaf_platform_windows_JNIDecorations
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: updateValues
* Signature: (JIII)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_updateValues
(JNIEnv *, jclass, jlong, jint, jint, jint);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: setResizable
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_setResizable
(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: setBackground
* Signature: (JIII)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_setBackground
(JNIEnv *, jclass, jlong, jint, jint, jint);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: minimize
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_minimize
(JNIEnv *, jclass, jlong);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: maximize
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_maximize
(JNIEnv *, jclass, jlong);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: restore
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_restore
(JNIEnv *, jclass, jlong);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: installDecorations
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_installDecorations
(JNIEnv *, jclass, jlong);
/*
* Class: com_weis_darklaf_platform_windows_JNIDecorations
* Method: uninstallDecorations
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_weis_darklaf_platform_windows_JNIDecorations_uninstallDecorations
(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
}
#endif
#endif

220
src/main/java/com/weis/darklaf/DarkLaf.java → src/main/java/com/github/weisj/darklaf/DarkLaf.java

@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf; package com.github.weisj.darklaf;
import com.weis.darklaf.platform.windows.JNIDecorations; import com.github.weisj.darklaf.platform.windows.JNIDecorations;
import com.weis.darklaf.theme.Theme; import com.github.weisj.darklaf.theme.Theme;
import com.weis.darklaf.ui.menu.DarkPopupMenuUI; import com.github.weisj.darklaf.ui.menu.DarkPopupMenuUI;
import com.weis.darklaf.util.PropertyLoader; import com.github.weisj.darklaf.util.PropertyLoader;
import com.weis.darklaf.util.SystemInfo; import com.github.weisj.darklaf.util.SystemInfo;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import sun.awt.AppContext; import sun.awt.AppContext;
@ -94,12 +94,6 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
} }
} }
@NotNull
@Override
public String getName() {
return NAME;
}
@Override @Override
public UIDefaults getDefaults() { public UIDefaults getDefaults() {
try { try {
@ -129,6 +123,12 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
return super.getDefaults(); return super.getDefaults();
} }
@NotNull
@Override
public String getName() {
return NAME;
}
@SuppressWarnings({"HardCodedStringLiteral"}) @SuppressWarnings({"HardCodedStringLiteral"})
private static void initInputMapDefaults(@NotNull final UIDefaults defaults) { private static void initInputMapDefaults(@NotNull final UIDefaults defaults) {
// Make ENTER work in JTrees // Make ENTER work in JTrees
@ -167,12 +167,6 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
} }
} }
@NotNull
@Override
public String getID() {
return getName();
}
private void loadThemeDefaults(@NotNull final UIDefaults defaults) { private void loadThemeDefaults(@NotNull final UIDefaults defaults) {
var uiProps = new Properties(); var uiProps = new Properties();
final Theme currentTheme = LafManager.getTheme(); final Theme currentTheme = LafManager.getTheme();
@ -188,82 +182,6 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
setDecorationsEnabled(currentTheme.useCustomDecorations()); setDecorationsEnabled(currentTheme.useCustomDecorations());
} }
private static void patchComboBox(@NotNull final UIDefaults metalDefaults, @NotNull final UIDefaults defaults) {
defaults.remove("ComboBox.ancestorInputMap");
defaults.remove("ComboBox.actionMap");
defaults.put("ComboBox.ancestorInputMap", metalDefaults.get("ComboBox.ancestorInputMap"));
defaults.put("ComboBox.actionMap", metalDefaults.get("ComboBox.actionMap"));
}
@NotNull
@Override
public String getDescription() {
return "Dark Look and feel based on Darcula-LAF";
}
private static void installCutCopyPasteShortcuts(@NotNull final InputMap inputMap,
final boolean useSimpleActionKeys) {
final String copyActionKey = useSimpleActionKeys ? "copy" : DefaultEditorKit.copyAction;
final String pasteActionKey = useSimpleActionKeys ? "paste" : DefaultEditorKit.pasteAction;
final String cutActionKey = useSimpleActionKeys ? "cut" : DefaultEditorKit.cutAction;
// Ctrl+Ins, Shift+Ins, Shift+Del
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.CTRL_DOWN_MASK), copyActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.SHIFT_DOWN_MASK), pasteActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, InputEvent.SHIFT_DOWN_MASK), cutActionKey);
// Ctrl+C, Ctrl+V, Ctrl+X
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK), copyActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK), pasteActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction);
}
private void installGlobals(@NotNull final Properties uiProps, final UIDefaults defaults) {
final HashMap<String, Object> globalSettings = new HashMap<>();
final String prefix = "global.";
for (final Object key : uiProps.keySet()) {
if (key instanceof String && ((String) key).startsWith(prefix)) {
globalSettings.put(((String) key).substring(prefix.length()), uiProps.get(key));
}
}
for (final Object key : defaults.keySet()) {
if (key instanceof String && ((String) key).contains(".")) {
final String s = (String) key;
final String globalKey = s.substring(s.lastIndexOf('.') + 1);
if (globalSettings.containsKey(globalKey)) {
defaults.put(key, globalSettings.get(globalKey));
}
}
}
}
@Override
public boolean isNativeLookAndFeel() {
return true;
}
@Override
public void initialize() {
call("initialize");
PropertyLoader.reset();
UIManager.addPropertyChangeListener(this);
}
@Override
public void uninitialize() {
call("uninitialize");
AppContext context = AppContext.getAppContext();
synchronized (DarkPopupMenuUI.MOUSE_GRABBER_KEY) {
Object grabber = context.get(DarkPopupMenuUI.MOUSE_GRABBER_KEY);
if (grabber != null) {
((DarkPopupMenuUI.MouseGrabber) grabber).uninstall();
}
}
}
@Override
public boolean isSupportedLookAndFeel() {
return true;
}
@SuppressWarnings({"HardCodedStringLiteral"}) @SuppressWarnings({"HardCodedStringLiteral"})
private void initIdeaDefaults(@NotNull final UIDefaults defaults) { private void initIdeaDefaults(@NotNull final UIDefaults defaults) {
defaults.put("Table.ancestorInputMap", new UIDefaults.LazyInputMap( defaults.put("Table.ancestorInputMap", new UIDefaults.LazyInputMap(
@ -320,43 +238,93 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
})); }));
} }
@NotNull
@Override @Override
protected void initClassDefaults(final UIDefaults defaults) { public String getID() {
callInit("initClassDefaults", defaults); return getName();
} }
@Override private static void patchComboBox(@NotNull final UIDefaults metalDefaults, @NotNull final UIDefaults defaults) {
protected void initSystemColorDefaults(final UIDefaults defaults) { defaults.remove("ComboBox.ancestorInputMap");
callInit("initSystemColorDefaults", defaults); defaults.remove("ComboBox.actionMap");
defaults.put("ComboBox.ancestorInputMap", metalDefaults.get("ComboBox.ancestorInputMap"));
defaults.put("ComboBox.actionMap", metalDefaults.get("ComboBox.actionMap"));
} }
public void initComponentDefaults(final UIDefaults defaults) { private static void installCutCopyPasteShortcuts(@NotNull final InputMap inputMap,
callInit("initComponentDefaults", defaults); final boolean useSimpleActionKeys) {
final String copyActionKey = useSimpleActionKeys ? "copy" : DefaultEditorKit.copyAction;
final String pasteActionKey = useSimpleActionKeys ? "paste" : DefaultEditorKit.pasteAction;
final String cutActionKey = useSimpleActionKeys ? "cut" : DefaultEditorKit.cutAction;
// Ctrl+Ins, Shift+Ins, Shift+Del
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.CTRL_DOWN_MASK), copyActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.SHIFT_DOWN_MASK), pasteActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, InputEvent.SHIFT_DOWN_MASK), cutActionKey);
// Ctrl+C, Ctrl+V, Ctrl+X
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK), copyActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK), pasteActionKey);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction);
} }
@Override private void installGlobals(@NotNull final Properties uiProps, final UIDefaults defaults) {
public boolean getSupportsWindowDecorations() { final HashMap<String, Object> globalSettings = new HashMap<>();
return LafManager.getTheme().useCustomDecorations() final String prefix = "global.";
&& JNIDecorations.isCustomDecorationSupported(); for (final Object key : uiProps.keySet()) {
} if (key instanceof String && ((String) key).startsWith(prefix)) {
globalSettings.put(((String) key).substring(prefix.length()), uiProps.get(key));
}
}
@Override for (final Object key : defaults.keySet()) {
public void propertyChange(@NotNull final PropertyChangeEvent evt) { if (key instanceof String && ((String) key).contains(".")) {
if ("lookAndFeel".equals(evt.getPropertyName())) { final String s = (String) key;
if (UIManager.getLookAndFeel() == this) { final String globalKey = s.substring(s.lastIndexOf('.') + 1);
PropertyLoader.finish(); if (globalSettings.containsKey(globalKey)) {
defaults.put(key, globalSettings.get(globalKey));
}
} }
UIManager.removePropertyChangeListener(this);
} }
} }
@NotNull
@Override
public String getDescription() {
return "Dark Look and feel based on Darcula-LAF";
}
@Override
public void initialize() {
call("initialize");
PropertyLoader.reset();
UIManager.addPropertyChangeListener(this);
}
@Override
public void uninitialize() {
call("uninitialize");
AppContext context = AppContext.getAppContext();
synchronized (DarkPopupMenuUI.MOUSE_GRABBER_KEY) {
Object grabber = context.get(DarkPopupMenuUI.MOUSE_GRABBER_KEY);
if (grabber != null) {
((DarkPopupMenuUI.MouseGrabber) grabber).uninstall();
}
}
}
@Override
protected void initClassDefaults(final UIDefaults defaults) {
callInit("initClassDefaults", defaults);
}
@Override
public boolean isNativeLookAndFeel() {
return true;
}
@Override
protected void initSystemColorDefaults(final UIDefaults defaults) {
callInit("initSystemColorDefaults", defaults);
}
@Override @Override
protected void loadSystemColors(final UIDefaults defaults, final String[] systemColors, protected void loadSystemColors(final UIDefaults defaults, final String[] systemColors,
@ -371,7 +339,14 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
} }
} }
public void initComponentDefaults(final UIDefaults defaults) {
callInit("initComponentDefaults", defaults);
}
@Override
public boolean isSupportedLookAndFeel() {
return true;
}
private void callInit(@NotNull final String method, final UIDefaults defaults) { private void callInit(@NotNull final String method, final UIDefaults defaults) {
try { try {
@ -393,5 +368,22 @@ public class DarkLaf extends BasicLookAndFeel implements PropertyChangeListener
} }
} }
@Override
public void propertyChange(@NotNull final PropertyChangeEvent evt) {
if ("lookAndFeel".equals(evt.getPropertyName())) {
if (UIManager.getLookAndFeel() == this) {
PropertyLoader.finish();
}
UIManager.removePropertyChangeListener(this);
}
}
@Override
public boolean getSupportsWindowDecorations() {
return LafManager.getTheme().useCustomDecorations()
&& JNIDecorations.isCustomDecorationSupported();
}
} }

2
src/main/java/com/weis/darklaf/DarkLafInfo.java → src/main/java/com/github/weisj/darklaf/DarkLafInfo.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf; package com.github.weisj.darklaf;
import javax.swing.*; import javax.swing.*;

36
src/main/java/com/github/weisj/darklaf/DarkMetalTheme.java

@ -0,0 +1,36 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf;
import javax.swing.plaf.metal.DefaultMetalTheme;
/**
* @author Jannis Weis
*/
public class DarkMetalTheme extends DefaultMetalTheme {
public String getName() {
return "Darcula theme";
}
}

10
src/main/java/com/weis/darklaf/LafManager.java → src/main/java/com/github/weisj/darklaf/LafManager.java

@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf; package com.github.weisj.darklaf;
import com.weis.darklaf.theme.DarculaTheme; import com.github.weisj.darklaf.theme.DarculaTheme;
import com.weis.darklaf.theme.IntelliJTheme; import com.github.weisj.darklaf.theme.IntelliJTheme;
import com.weis.darklaf.theme.Theme; import com.github.weisj.darklaf.theme.Theme;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@ -62,7 +62,7 @@ public final class LafManager {
LogManager.getLogManager().reset(); LogManager.getLogManager().reset();
} else { } else {
try (InputStream inputStream = DarkLaf.class.getClassLoader() try (InputStream inputStream = DarkLaf.class.getClassLoader()
.getResourceAsStream("com/weis/darklaf/log/logging.properties")) { .getResourceAsStream("com/github/weisj/darklaf/log/logging.properties")) {
if (inputStream != null) { if (inputStream != null) {
LogManager.getLogManager().readConfiguration(inputStream); LogManager.getLogManager().readConfiguration(inputStream);
} }

2
src/main/java/com/weis/darklaf/color/DarkColorModel.java → src/main/java/com/github/weisj/darklaf/color/DarkColorModel.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.color; package com.github.weisj.darklaf.color;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

2
src/main/java/com/weis/darklaf/color/DarkColorModelCMYK.java → src/main/java/com/github/weisj/darklaf/color/DarkColorModelCMYK.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.color; package com.github.weisj.darklaf.color;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

2
src/main/java/com/weis/darklaf/color/DarkColorModelHSB.java → src/main/java/com/github/weisj/darklaf/color/DarkColorModelHSB.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.color; package com.github.weisj.darklaf.color;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

2
src/main/java/com/weis/darklaf/color/DarkColorModelHSL.java → src/main/java/com/github/weisj/darklaf/color/DarkColorModelHSL.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.color; package com.github.weisj.darklaf.color;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

4
src/main/java/com/weis/darklaf/components/ArrowButton.java → src/main/java/com/github/weisj/darklaf/components/ArrowButton.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components; package com.github.weisj.darklaf.components;
import com.weis.darklaf.icons.UIAwareIcon; import com.github.weisj.darklaf.icons.UIAwareIcon;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

27
src/main/java/com/weis/darklaf/components/ClosableTabComponent.java → src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java

@ -1,6 +1,29 @@
package com.weis.darklaf.components; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components;
import com.weis.darklaf.ui.tabbedpane.DarkTabbedPaneUI; import com.github.weisj.darklaf.ui.tabbedpane.DarkTabbedPaneUI;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

41
src/main/java/com/weis/darklaf/components/ClosableTabbedPane.java → src/main/java/com/github/weisj/darklaf/components/ClosableTabbedPane.java

@ -1,4 +1,27 @@
package com.weis.darklaf.components; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -23,14 +46,6 @@ public class ClosableTabbedPane extends JTabbedPane {
notifyTabListeners(new TabEvent(this, TabEvent.TAB_OPENED, "tabOpened", index)); notifyTabListeners(new TabEvent(this, TabEvent.TAB_OPENED, "tabOpened", index));
} }
@Override
public void setTabComponentAt(final int index, final Component component) {
if (component instanceof ClosableTabComponent) {
((ClosableTabComponent) component).setTabbedPane(this);
}
super.setTabComponentAt(index, component);
}
@Override @Override
public void removeTabAt(final int index) { public void removeTabAt(final int index) {
checkIndex(index); checkIndex(index);
@ -42,6 +57,14 @@ public class ClosableTabbedPane extends JTabbedPane {
super.removeTabAt(index); super.removeTabAt(index);
} }
@Override
public void setTabComponentAt(final int index, final Component component) {
if (component instanceof ClosableTabComponent) {
((ClosableTabComponent) component).setTabbedPane(this);
}
super.setTabComponentAt(index, component);
}
private void checkIndex(final int index) { private void checkIndex(final int index) {
int tabCount = getTabCount(); int tabCount = getTabCount();
if (index < 0 || index >= tabCount) { if (index < 0 || index >= tabCount) {

10
src/main/java/com/weis/darklaf/components/ColorPipetteBase.java → src/main/java/com/github/weisj/darklaf/components/ColorPipetteBase.java

@ -1,4 +1,3 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
/* /*
* MIT License * MIT License
* *
@ -22,12 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components;
package com.github.weisj.darklaf.components;
import com.weis.darklaf.ui.colorchooser.ColorListener;
import com.weis.darklaf.ui.colorchooser.ColorPipette; import com.github.weisj.darklaf.ui.colorchooser.ColorListener;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.ui.colorchooser.ColorPipette;
import com.github.weisj.darklaf.util.DarkUIUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

34
src/main/java/com/weis/darklaf/components/DefaultColorPipette.java → src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java

@ -1,9 +1,31 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. /*
package com.weis.darklaf.components; * MIT License
*
import com.weis.darklaf.ui.colorchooser.ColorListener; * Copyright (c) 2019 Jannis Weis
import com.weis.darklaf.util.GraphicsUtil; *
import com.weis.darklaf.util.TimerUtil; * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components;
import com.github.weisj.darklaf.ui.colorchooser.ColorListener;
import com.github.weisj.darklaf.util.GraphicsUtil;
import com.github.weisj.darklaf.util.TimerUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;

2
src/main/java/com/weis/darklaf/components/Disposable.java → src/main/java/com/github/weisj/darklaf/components/Disposable.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components; package com.github.weisj.darklaf.components;
public interface Disposable { public interface Disposable {

4
src/main/java/com/weis/darklaf/components/JXPopupMenu.java → src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components; package com.github.weisj.darklaf.components;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import org.jdesktop.jxlayer.JXLayer; import org.jdesktop.jxlayer.JXLayer;
import org.pbjar.jxlayer.plaf.ext.TransformUI; import org.pbjar.jxlayer.plaf.ext.TransformUI;

2
src/main/java/com/weis/darklaf/components/SelectableTreeNode.java → src/main/java/com/github/weisj/darklaf/components/SelectableTreeNode.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components; package com.github.weisj.darklaf.components;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;

2
src/main/java/com/weis/darklaf/components/ShadowButton.java → src/main/java/com/github/weisj/darklaf/components/ShadowButton.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components; package com.github.weisj.darklaf.components;
import javax.swing.*; import javax.swing.*;

45
src/main/java/com/github/weisj/darklaf/components/TabEvent.java

@ -0,0 +1,45 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components;
import java.awt.event.ActionEvent;
/**
* @author Jannis Weis
*/
public class TabEvent extends ActionEvent {
public static final int TAB_OPENED = 0;
public static final int TAB_CLOSED = 1;
private final int tabIndex;
public TabEvent(final Object source, final int id, final String command, final int tabIndex) {
super(source, id, command);
this.tabIndex = tabIndex;
}
public int getTabIndex() {
return tabIndex;
}
}

36
src/main/java/com/github/weisj/darklaf/components/TabListener.java

@ -0,0 +1,36 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components;
import java.util.EventListener;
/**
* @author Jannis Weis
*/
public interface TabListener extends EventListener {
void tabOpened(TabEvent e);
void tabClosed(TabEvent e);
}

44
src/main/java/com/github/weisj/darklaf/components/TabPropertyChangeEvent.java

@ -0,0 +1,44 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components;
import java.beans.PropertyChangeEvent;
/**
* @author Jannis Weis
*/
public class TabPropertyChangeEvent extends PropertyChangeEvent {
private final int index;
public TabPropertyChangeEvent(final Object source, final String propertyName,
final Object oldValue, final Object newValue, final int index) {
super(source, propertyName, oldValue, newValue);
this.index = index;
}
public int getIndex() {
return index;
}
}

27
src/main/java/com/weis/darklaf/components/alignment/Alignment.java → src/main/java/com/github/weisj/darklaf/components/alignment/Alignment.java

@ -1,4 +1,27 @@
package com.weis.darklaf.components.alignment; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.alignment;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -6,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
import java.awt.*; import java.awt.*;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import static com.weis.darklaf.components.alignment.AlignmentHelper.*; import static com.github.weisj.darklaf.components.alignment.AlignmentHelper.*;
/** /**
* @author Jannis Weis * @author Jannis Weis

2
src/main/java/com/weis/darklaf/components/alignment/AlignmentHelper.java → src/main/java/com/github/weisj/darklaf/components/alignment/AlignmentHelper.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.alignment; package com.github.weisj.darklaf.components.alignment;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

2
src/main/java/com/weis/darklaf/components/alignment/AlignmentStrategy.java → src/main/java/com/github/weisj/darklaf/components/alignment/AlignmentStrategy.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.alignment; package com.github.weisj.darklaf.components.alignment;
import java.awt.*; import java.awt.*;

29
src/main/java/com/weis/darklaf/components/border/BubbleBorder.java → src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java

@ -1,7 +1,30 @@
package com.weis.darklaf.components.border; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.border;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import com.weis.darklaf.util.GraphicsUtil; import com.github.weisj.darklaf.util.GraphicsUtil;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

27
src/main/java/com/weis/darklaf/components/border/DropShadowBorder.java → src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java

@ -1,7 +1,30 @@
package com.weis.darklaf.components.border; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.border;
import com.weis.darklaf.util.ImageUtil; import com.github.weisj.darklaf.util.ImageUtil;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

25
src/main/java/com/weis/darklaf/components/border/MutableLineBorder.java → src/main/java/com/github/weisj/darklaf/components/border/MutableLineBorder.java

@ -1,4 +1,27 @@
package com.weis.darklaf.components.border; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.border;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

24
src/main/java/com/weis/darklaf/components/tabframe/JTabFrame.java → src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java

@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import com.weis.darklaf.ui.tabframe.TabFrameTransferHandler; import com.github.weisj.darklaf.ui.tabframe.TabFrameTransferHandler;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -860,6 +860,15 @@ public class JTabFrame extends JComponent {
this.transferIndex = index; this.transferIndex = index;
} }
/**
* Get the content pane.
*
* @return the content pane.
*/
public TabFrameContent getContentPane() {
return content;
}
/** /**
* Returns whether the given tab is selected. * Returns whether the given tab is selected.
* *
@ -872,15 +881,6 @@ public class JTabFrame extends JComponent {
return selectedIndices[a.ordinal()] == index; return selectedIndices[a.ordinal()] == index;
} }
/**
* Get the content pane.
*
* @return the content pane.
*/
public TabFrameContent getContentPane() {
return content;
}
/** /**
* Notify that a transfer has ended. * Notify that a transfer has ended.
*/ */

28
src/main/java/com/weis/darklaf/components/tabframe/PanelPopup.java → src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import javax.swing.*; import javax.swing.*;
@ -165,18 +165,6 @@ public class PanelPopup extends JPanel implements TabFramePopup {
firePropertyChange("alignment", old, alignment); firePropertyChange("alignment", old, alignment);
} }
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(final int index) {
int old = this.index;
this.index = index;
firePropertyChange("index", old, index);
}
@Override @Override
public void open() { public void open() {
if (parent != null && getAlignment() != null && getIndex() >= 0 if (parent != null && getAlignment() != null && getIndex() >= 0
@ -212,4 +200,16 @@ public class PanelPopup extends JPanel implements TabFramePopup {
this.icon = icon; this.icon = icon;
firePropertyChange("icon", old, icon); firePropertyChange("icon", old, icon);
} }
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(final int index) {
int old = this.index;
this.index = index;
firePropertyChange("index", old, index);
}
} }

2
src/main/java/com/weis/darklaf/components/tabframe/PopupContainer.java → src/main/java/com/github/weisj/darklaf/components/tabframe/PopupContainer.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;

2
src/main/java/com/weis/darklaf/components/tabframe/TabArea.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabArea.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

4
src/main/java/com/weis/darklaf/components/tabframe/TabFrameContent.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContent.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import java.awt.*; import java.awt.*;

28
src/main/java/com/weis/darklaf/components/tabframe/TabFrameContentPane.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java

@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import com.weis.darklaf.decorators.AncestorAdapter; import com.github.weisj.darklaf.decorators.AncestorAdapter;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -375,17 +375,6 @@ public class TabFrameContentPane extends JPanel implements TabFrameContent {
return enabled; return enabled;
} }
/**
* Get the popup component at the position.
*
* @param a the position.
* @return the popup component at position.
*/
@NotNull
public Component getPopupComponent(@NotNull final Alignment a) {
return getContainer(a).getPopup();
}
@Override @Override
public PopupContainer getContainer(@NotNull final Alignment alignment) { public PopupContainer getContainer(@NotNull final Alignment alignment) {
PopupContainer popupComponent; PopupContainer popupComponent;
@ -420,6 +409,17 @@ public class TabFrameContentPane extends JPanel implements TabFrameContent {
return popupComponent; return popupComponent;
} }
/**
* Get the popup component at the position.
*
* @param a the position.
* @return the popup component at position.
*/
@NotNull
public Component getPopupComponent(@NotNull final Alignment a) {
return getContainer(a).getPopup();
}
protected static class LayoutProportions { protected static class LayoutProportions {
protected final double splitRestore; protected final double splitRestore;
protected final double splitterPeerDisable; protected final double splitterPeerDisable;

4
src/main/java/com/weis/darklaf/components/tabframe/TabFramePopup.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFramePopup.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

4
src/main/java/com/weis/darklaf/components/tabframe/TabFrameTab.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameTab.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import java.awt.*; import java.awt.*;

4
src/main/java/com/weis/darklaf/components/tabframe/TabFrameTabContainer.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameTabContainer.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

8
src/main/java/com/weis/darklaf/components/tabframe/TabFrameTabLabel.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameTabLabel.java

@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import com.weis.darklaf.icons.EmptyIcon; import com.github.weisj.darklaf.icons.EmptyIcon;
import com.weis.darklaf.ui.tabframe.DarkTabFrameTabLabelUI; import com.github.weisj.darklaf.ui.tabframe.DarkTabFrameTabLabelUI;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

4
src/main/java/com/weis/darklaf/components/tabframe/TabFrameUI.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameUI.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.*; import java.awt.*;

12
src/main/java/com/weis/darklaf/components/tabframe/TabbedPopup.java → src/main/java/com/github/weisj/darklaf/components/tabframe/TabbedPopup.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -103,6 +103,11 @@ public class TabbedPopup extends PanelPopup {
return tabbedPane; return tabbedPane;
} }
@Override
public String getUIClassID() {
return "TabFrameTabbedPopupUI";
}
/** /**
* Gets the currently selected component from the TabbedPane. {@see {@link #getTabbedPane()}}. * Gets the currently selected component from the TabbedPane. {@see {@link #getTabbedPane()}}.
* *
@ -112,11 +117,6 @@ public class TabbedPopup extends PanelPopup {
return tabbedPane.getSelectedComponent(); return tabbedPane.getSelectedComponent();
} }
@Override
public String getUIClassID() {
return "TabFrameTabbedPopupUI";
}
/** /**
* Adds the component to the tabbed pane if it isn't already added. This method exists to conform the interface * Adds the component to the tabbed pane if it isn't already added. This method exists to conform the interface
* methods. It is preferred to directly add to the TabbedPane obtained by {@link #getTabbedPane()}. * methods. It is preferred to directly add to the TabbedPane obtained by {@link #getTabbedPane()}.

10
src/main/java/com/weis/darklaf/components/tabframe/ToggleSplitPane.java → src/main/java/com/github/weisj/darklaf/components/tabframe/ToggleSplitPane.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tabframe; package com.github.weisj.darklaf.components.tabframe;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.basic.BasicSplitPaneUI; import javax.swing.plaf.basic.BasicSplitPaneUI;
@ -110,18 +110,18 @@ public class ToggleSplitPane extends JSplitPane {
} }
@Override @Override
public int getDividerLocation() { public int getLastDividerLocation() {
if (resizable) { if (resizable) {
return super.getDividerLocation(); return super.getLastDividerLocation();
} else { } else {
return disabledMax == disabledPos ? getMaximumDividerLocation() : disabledPos; return disabledMax == disabledPos ? getMaximumDividerLocation() : disabledPos;
} }
} }
@Override @Override
public int getLastDividerLocation() { public int getDividerLocation() {
if (resizable) { if (resizable) {
return super.getLastDividerLocation(); return super.getDividerLocation();
} else { } else {
return disabledMax == disabledPos ? getMaximumDividerLocation() : disabledPos; return disabledMax == disabledPos ? getMaximumDividerLocation() : disabledPos;
} }

2
src/main/java/com/weis/darklaf/components/text/SearchEvent.java → src/main/java/com/github/weisj/darklaf/components/text/SearchEvent.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.text; package com.github.weisj.darklaf.components.text;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

2
src/main/java/com/weis/darklaf/components/text/SearchListener.java → src/main/java/com/github/weisj/darklaf/components/text/SearchListener.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.text; package com.github.weisj.darklaf.components.text;
import java.util.EventListener; import java.util.EventListener;

2
src/main/java/com/weis/darklaf/components/text/SearchTextField.java → src/main/java/com/github/weisj/darklaf/components/text/SearchTextField.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.text; package com.github.weisj.darklaf.components.text;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.Document; import javax.swing.text.Document;

2
src/main/java/com/weis/darklaf/components/text/SearchTextFieldWithHistory.java → src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.text; package com.github.weisj.darklaf.components.text;
import javax.swing.text.Document; import javax.swing.text.Document;
import java.util.List; import java.util.List;

49
src/main/java/com/weis/darklaf/components/tooltip/DarkToolTip.java → src/main/java/com/github/weisj/darklaf/components/tooltip/DarkToolTip.java

@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tooltip; package com.github.weisj.darklaf.components.tooltip;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import com.weis.darklaf.decorators.AncestorAdapter; import com.github.weisj.darklaf.decorators.AncestorAdapter;
import com.weis.darklaf.ui.tooltip.DarkTooltipBorder; import com.github.weisj.darklaf.ui.tooltip.DarkTooltipBorder;
import com.weis.darklaf.util.Animator; import com.github.weisj.darklaf.util.Animator;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
@ -110,12 +110,20 @@ public class DarkToolTip extends JToolTip implements PropertyChangeListener {
super.paint(g); super.paint(g);
config.restore(); config.restore();
} }
@Override @Override
public void setBorder(final Border border) { public void setBorder(final Border border) {
if (!(border instanceof DarkTooltipBorder)) return; if (!(border instanceof DarkTooltipBorder)) return;
super.setBorder(border); super.setBorder(border);
} }
@Override
public void removeNotify() {
super.removeNotify();
notifyToolTipListeners(ToolTipEvent.HIDDEN);
lastHidden = System.currentTimeMillis();
}
@Override @Override
public String getTipText() { public String getTipText() {
var text = super.getTipText(); var text = super.getTipText();
@ -126,10 +134,17 @@ public class DarkToolTip extends JToolTip implements PropertyChangeListener {
} }
@Override @Override
public void removeNotify() { public void propertyChange(@NotNull final PropertyChangeEvent evt) {
super.removeNotify(); if ("tiptext".equals(evt.getPropertyName())) {
notifyToolTipListeners(ToolTipEvent.HIDDEN); setPreferredSize(getUI().getPreferredSize(this));
lastHidden = System.currentTimeMillis(); if (!Objects.equals(evt.getNewValue(), evt.getOldValue())) {
notifyToolTipListeners(ToolTipEvent.TEXT);
}
}
}
public void setStyle(final ToolTipStyle style) {
putClientProperty("JToolTip.style", style);
} }
private enum ToolTipEvent { private enum ToolTipEvent {
@ -175,19 +190,5 @@ public class DarkToolTip extends JToolTip implements PropertyChangeListener {
} }
} }
@Override
public void propertyChange(@NotNull final PropertyChangeEvent evt) {
if ("tiptext".equals(evt.getPropertyName())) {
setPreferredSize(getUI().getPreferredSize(this));
if (!Objects.equals(evt.getNewValue(), evt.getOldValue())) {
notifyToolTipListeners(ToolTipEvent.TEXT);
}
}
}
public void setStyle(final ToolTipStyle style) {
putClientProperty("JToolTip.style", style);
}
} }

258
src/main/java/com/weis/darklaf/components/tooltip/ToolTipContext.java → src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java

@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tooltip; package com.github.weisj.darklaf.components.tooltip;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import com.weis.darklaf.components.alignment.AlignmentStrategy; import com.github.weisj.darklaf.components.alignment.AlignmentStrategy;
import com.weis.darklaf.ui.tooltip.DarkTooltipBorder; import com.github.weisj.darklaf.ui.tooltip.DarkTooltipBorder;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -125,95 +125,6 @@ public class ToolTipContext implements ToolTipListener {
setToolTipRectSupplier(toolTipRectSupplier); setToolTipRectSupplier(toolTipRectSupplier);
} }
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
*/
@Contract("null, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment) {
this(c, alignment, null, null, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param centerAlignment {@link #setCenterAlignment(Alignment)}
*/
@Contract("null, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final Alignment centerAlignment) {
this(c, alignment, centerAlignment, null, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignInside {@link #setAlignInside(boolean)}
*/
@Contract("null, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final boolean alignInside) {
this(c, alignment, null, null, alignInside, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param centerAlignment {@link #setCenterAlignment(Alignment)}
* @param alignInside {@link #setAlignInside(boolean)}
*/
@Contract("null, _, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final Alignment centerAlignment,
final boolean alignInside) {
this(c, alignment, centerAlignment, null, alignInside, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
*/
@Contract("null, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final AlignmentStrategy alignmentStrategy) {
this(c, alignment, null, alignmentStrategy, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param centerAlignment {@link #setCenterAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
*/
@Contract("null, _, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final Alignment centerAlignment,
final AlignmentStrategy alignmentStrategy) {
this(c, alignment, centerAlignment, alignmentStrategy, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
* @param alignInside {@link #setAlignInside(boolean)}
*/
@Contract("null, _, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final AlignmentStrategy alignmentStrategy,
final boolean alignInside) {
this(c, alignment, null, alignmentStrategy, alignInside, null);
}
/** /**
* Set the style of the tooltip. * Set the style of the tooltip.
* *
@ -230,16 +141,6 @@ public class ToolTipContext implements ToolTipListener {
return this; return this;
} }
private void updateToolTip() {
if (toolTip != null) {
toolTip.setAlignment(alignment == Alignment.CENTER
? centerAlignment.opposite()
: alignInside ? alignment : alignment.opposite());
toolTip.setInsets(insets);
toolTip.setStyle(style);
}
}
/** /**
* Sets whether the position should be recalculated each time after the popup has been shown. This may be useful if * Sets whether the position should be recalculated each time after the popup has been shown. This may be useful if
* the tooltip should follow the mouse. * the tooltip should follow the mouse.
@ -254,6 +155,24 @@ public class ToolTipContext implements ToolTipListener {
return this; return this;
} }
/**
* Sets whether the tooltip should be closed if the mouse has left the area set by {@link #setInsideArea(Area).}
* <p>
* Default is false.
*
* @param hideOnExit true if tooltip should hide.
* @return this.
*/
public ToolTipContext setHideOnExit(final boolean hideOnExit) {
this.hideOnExit = hideOnExit;
if (hideOnExit) {
c.addMouseListener(mouseListener);
} else {
c.removeMouseListener(mouseListener);
}
return this;
}
/** /**
* Sets whether the component should be aligned inside or outside the supplied rectangle if the curent alignment is * Sets whether the component should be aligned inside or outside the supplied rectangle if the curent alignment is
* not {@link Alignment#CENTER}. * not {@link Alignment#CENTER}.
@ -338,6 +257,105 @@ public class ToolTipContext implements ToolTipListener {
return this; return this;
} }
private void updateToolTip() {
if (toolTip != null) {
toolTip.setAlignment(alignment == Alignment.CENTER
? centerAlignment.opposite()
: alignInside ? alignment : alignment.opposite());
toolTip.setInsets(insets);
toolTip.setStyle(style);
}
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
*/
@Contract("null, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment) {
this(c, alignment, null, null, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param centerAlignment {@link #setCenterAlignment(Alignment)}
*/
@Contract("null, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final Alignment centerAlignment) {
this(c, alignment, centerAlignment, null, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignInside {@link #setAlignInside(boolean)}
*/
@Contract("null, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final boolean alignInside) {
this(c, alignment, null, null, alignInside, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param centerAlignment {@link #setCenterAlignment(Alignment)}
* @param alignInside {@link #setAlignInside(boolean)}
*/
@Contract("null, _, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final Alignment centerAlignment,
final boolean alignInside) {
this(c, alignment, centerAlignment, null, alignInside, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
*/
@Contract("null, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final AlignmentStrategy alignmentStrategy) {
this(c, alignment, null, alignmentStrategy, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param centerAlignment {@link #setCenterAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
*/
@Contract("null, _, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final Alignment centerAlignment,
final AlignmentStrategy alignmentStrategy) {
this(c, alignment, centerAlignment, alignmentStrategy, true, null);
}
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param c the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
* @param alignInside {@link #setAlignInside(boolean)}
*/
@Contract("null, _, _, _ -> fail")
public ToolTipContext(final JComponent c, final Alignment alignment, final AlignmentStrategy alignmentStrategy,
final boolean alignInside) {
this(c, alignment, null, alignmentStrategy, alignInside, null);
}
/** /**
* Set the area to check if the tooltip should hide. If the mouse is outside of the area the the tooltip hides if * Set the area to check if the tooltip should hide. If the mouse is outside of the area the the tooltip hides if
* {@link #setHideOnExit(boolean)} is true. * {@link #setHideOnExit(boolean)} is true.
@ -451,11 +469,6 @@ public class ToolTipContext implements ToolTipListener {
return dim; return dim;
} }
private Point alignInside(final Dimension dim, final Rectangle rect) {
Point p = alignment.alignInside(dim, rect);
return adjustPoint(p, alignment, dim, false);
}
@Nullable @Nullable
private Point alignCenter(final Dimension dim, @NotNull final Rectangle rect) { private Point alignCenter(final Dimension dim, @NotNull final Rectangle rect) {
rect.x += rect.width / 2; rect.x += rect.width / 2;
@ -467,15 +480,16 @@ public class ToolTipContext implements ToolTipListener {
return p; return p;
} }
private Point alignInside(final Dimension dim, final Rectangle rect) {
Point p = alignment.alignInside(dim, rect);
return adjustPoint(p, alignment, dim, false);
}
private Point alignOutside(final Dimension dim, final Rectangle rect) { private Point alignOutside(final Dimension dim, final Rectangle rect) {
Point p = alignment.alignOutside(dim, rect); Point p = alignment.alignOutside(dim, rect);
return adjustPoint(p, alignment, dim, true); return adjustPoint(p, alignment, dim, true);
} }
public void removeToolTip() {
setHideOnExit(false);
}
@Contract("_, _, _, _ -> param1") @Contract("_, _, _, _ -> param1")
private Point adjustPoint(final Point p, final Alignment align, final Dimension dim, final boolean outside) { private Point adjustPoint(final Point p, final Alignment align, final Dimension dim, final boolean outside) {
int factor = outside ? 1 : -1; int factor = outside ? 1 : -1;
@ -487,22 +501,8 @@ public class ToolTipContext implements ToolTipListener {
return p; return p;
} }
/** public void removeToolTip() {
* Sets whether the tooltip should be closed if the mouse has left the area set by {@link #setInsideArea(Area).} setHideOnExit(false);
* <p>
* Default is false.
*
* @param hideOnExit true if tooltip should hide.
* @return this.
*/
public ToolTipContext setHideOnExit(final boolean hideOnExit) {
this.hideOnExit = hideOnExit;
if (hideOnExit) {
c.addMouseListener(mouseListener);
} else {
c.removeMouseListener(mouseListener);
}
return this;
} }
@Override @Override

2
src/main/java/com/weis/darklaf/components/tooltip/ToolTipListener.java → src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipListener.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tooltip; package com.github.weisj.darklaf.components.tooltip;
import javax.swing.*; import javax.swing.*;
import java.util.EventListener; import java.util.EventListener;

2
src/main/java/com/weis/darklaf/components/tooltip/ToolTipStyle.java → src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipStyle.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tooltip; package com.github.weisj.darklaf.components.tooltip;
public enum ToolTipStyle { public enum ToolTipStyle {
BALLOON, BALLOON,

4
src/main/java/com/weis/darklaf/components/tooltip/TooltipAwareButton.java → src/main/java/com/github/weisj/darklaf/components/tooltip/TooltipAwareButton.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tooltip; package com.github.weisj.darklaf.components.tooltip;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

4
src/main/java/com/weis/darklaf/components/tooltip/TooltipAwareToggleButton.java → src/main/java/com/github/weisj/darklaf/components/tooltip/TooltipAwareToggleButton.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.tooltip; package com.github.weisj.darklaf.components.tooltip;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

25
src/main/java/com/weis/darklaf/components/tristate/TristateButtonModel.java → src/main/java/com/github/weisj/darklaf/components/tristate/TristateButtonModel.java

@ -1,4 +1,27 @@
package com.weis.darklaf.components.tristate; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.tristate;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;

29
src/main/java/com/weis/darklaf/components/tristate/TristateCheckBox.java → src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBox.java

@ -1,6 +1,29 @@
package com.weis.darklaf.components.tristate; /*
* MIT License
import com.weis.darklaf.DarkLaf; *
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.tristate;
import com.github.weisj.darklaf.DarkLaf;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

44
src/main/java/com/github/weisj/darklaf/components/tristate/TristateState.java

@ -0,0 +1,44 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.components.tristate;
public enum TristateState {
SELECTED {
public TristateState next() {
return INDETERMINATE;
}
},
INDETERMINATE {
public TristateState next() {
return DESELECTED;
}
},
DESELECTED {
public TristateState next() {
return SELECTED;
}
};
public abstract TristateState next();
}

2
src/main/java/com/weis/darklaf/components/uiresource/Insets2D.java → src/main/java/com/github/weisj/darklaf/components/uiresource/Insets2D.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.uiresource; package com.github.weisj.darklaf.components.uiresource;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

2
src/main/java/com/weis/darklaf/components/uiresource/JLabelUIResource.java → src/main/java/com/github/weisj/darklaf/components/uiresource/JLabelUIResource.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.uiresource; package com.github.weisj.darklaf.components.uiresource;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;

2
src/main/java/com/weis/darklaf/components/uiresource/JPanelUIResource.java → src/main/java/com/github/weisj/darklaf/components/uiresource/JPanelUIResource.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.uiresource; package com.github.weisj.darklaf.components.uiresource;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;

2
src/main/java/com/weis/darklaf/components/uiresource/UIResourceWrapper.java → src/main/java/com/github/weisj/darklaf/components/uiresource/UIResourceWrapper.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.components.uiresource; package com.github.weisj.darklaf.components.uiresource;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.*; import java.awt.*;

41
src/main/java/com/github/weisj/darklaf/decorators/AncestorAdapter.java

@ -0,0 +1,41 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.decorators;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
public class AncestorAdapter implements AncestorListener {
@Override
public void ancestorAdded(final AncestorEvent event) {
}
@Override
public void ancestorRemoved(final AncestorEvent event) {
}
@Override
public void ancestorMoved(final AncestorEvent event) {
}
}

27
src/main/java/com/github/weisj/darklaf/decorators/CellRenderer.java

@ -0,0 +1,27 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.decorators;
public interface CellRenderer {
}

2
src/main/java/com/weis/darklaf/decorators/HoverListener.java → src/main/java/com/github/weisj/darklaf/decorators/HoverListener.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.decorators; package com.github.weisj.darklaf.decorators;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;

2
src/main/java/com/weis/darklaf/decorators/MouseResponder.java → src/main/java/com/github/weisj/darklaf/decorators/MouseResponder.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.decorators; package com.github.weisj.darklaf.decorators;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;

2
src/main/java/com/weis/darklaf/decorators/PlainAction.java → src/main/java/com/github/weisj/darklaf/decorators/PlainAction.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.decorators; package com.github.weisj.darklaf.decorators;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

2
src/main/java/com/weis/darklaf/decorators/PopupMenuAdapter.java → src/main/java/com/github/weisj/darklaf/decorators/PopupMenuAdapter.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.decorators; package com.github.weisj.darklaf.decorators;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;

2
src/main/java/com/weis/darklaf/icons/DarkSVGIcon.java → src/main/java/com/github/weisj/darklaf/icons/DarkSVGIcon.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.icons; package com.github.weisj.darklaf.icons;
import com.kitfox.svg.app.beans.SVGIcon; import com.kitfox.svg.app.beans.SVGIcon;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;

2
src/main/java/com/weis/darklaf/icons/EmptyIcon.java → src/main/java/com/github/weisj/darklaf/icons/EmptyIcon.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.icons; package com.github.weisj.darklaf.icons;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

25
src/main/java/com/weis/darklaf/icons/IconColorMapper.java → src/main/java/com/github/weisj/darklaf/icons/IconColorMapper.java

@ -1,4 +1,27 @@
package com.weis.darklaf.icons; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.icons;
import com.kitfox.svg.Defs; import com.kitfox.svg.Defs;
import com.kitfox.svg.LinearGradient; import com.kitfox.svg.LinearGradient;

2
src/main/java/com/weis/darklaf/icons/IconLoader.java → src/main/java/com/github/weisj/darklaf/icons/IconLoader.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.icons; package com.github.weisj.darklaf.icons;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

2
src/main/java/com/weis/darklaf/icons/LazyIcon.java → src/main/java/com/github/weisj/darklaf/icons/LazyIcon.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.icons; package com.github.weisj.darklaf.icons;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;

2
src/main/java/com/weis/darklaf/icons/LazyImageIcon.java → src/main/java/com/github/weisj/darklaf/icons/LazyImageIcon.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.icons; package com.github.weisj.darklaf.icons;
import javax.swing.*; import javax.swing.*;

4
src/main/java/com/weis/darklaf/icons/RotatableIcon.java → src/main/java/com/github/weisj/darklaf/icons/RotatableIcon.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.icons; package com.github.weisj.darklaf.icons;
import com.weis.darklaf.components.alignment.Alignment; import com.github.weisj.darklaf.components.alignment.Alignment;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import javax.swing.*; import javax.swing.*;

57
src/main/java/com/github/weisj/darklaf/icons/ThemedSVGIcon.java

@ -0,0 +1,57 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.icons;
import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.Theme;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.net.URI;
/**
* @author Jannis Weis
*/
public class ThemedSVGIcon extends DarkSVGIcon {
private Theme currentTheme;
public ThemedSVGIcon(@NotNull final URI uri, final int displayWidth, final int displayHeight) {
super(uri, displayWidth, displayHeight);
}
@Override
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
ensureTheme();
super.paintIcon(c, g, x, y);
}
private void ensureTheme() {
var theme = LafManager.getTheme();
if (currentTheme != theme) {
IconColorMapper.patchColors(getSVGIcon());
currentTheme = theme;
}
}
}

34
src/main/java/com/github/weisj/darklaf/icons/UIAwareIcon.java

@ -0,0 +1,34 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.icons;
import javax.swing.*;
/**
* @author Jannis Weis
*/
public interface UIAwareIcon extends Icon {
UIAwareIcon getDual();
}

2
src/main/java/com/weis/darklaf/log/LogFormatter.java → src/main/java/com/github/weisj/darklaf/log/LogFormatter.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.log; package com.github.weisj.darklaf.log;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

25
src/main/java/com/weis/darklaf/platform/NativeUtil.java → src/main/java/com/github/weisj/darklaf/platform/NativeUtil.java

@ -1,4 +1,27 @@
package com.weis.darklaf.platform; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.platform;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

31
src/main/java/com/weis/darklaf/platform/windows/JNIDecorations.java → src/main/java/com/github/weisj/darklaf/platform/windows/JNIDecorations.java

@ -1,10 +1,33 @@
package com.weis.darklaf.platform.windows; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.platform.windows;
import com.github.weisj.darklaf.DarkLaf;
import com.github.weisj.darklaf.platform.NativeUtil;
import com.github.weisj.darklaf.util.SystemInfo;
import com.sun.jna.Native; import com.sun.jna.Native;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.weis.darklaf.DarkLaf;
import com.weis.darklaf.platform.NativeUtil;
import com.weis.darklaf.util.SystemInfo;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import java.awt.*; import java.awt.*;

22
src/main/java/com/weis/darklaf/decorators/MouseMovementListener.java → src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java

@ -21,17 +21,27 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.decorators; package com.github.weisj.darklaf.theme;
import java.awt.event.MouseEvent; /**
import java.awt.event.MouseMotionListener; * @author Jannis Weis
*/
public class DarculaTheme extends Theme {
public interface MouseMovementListener extends MouseMotionListener { @Override
protected String getResourcePath() {
return "darcula/";
}
@Override @Override
default void mouseDragged(final MouseEvent e) { public String getName() {
return "darcula";
} }
@Override @Override
void mouseMoved(MouseEvent e); public boolean isDark() {
return true;
}
} }

67
src/main/java/com/github/weisj/darklaf/theme/IntelliJTheme.java

@ -0,0 +1,67 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.theme;
import com.github.weisj.darklaf.util.PropertyLoader;
import com.github.weisj.darklaf.util.SystemInfo;
import javax.swing.*;
import java.util.Properties;
/**
* @author Jannis Weis
*/
public class IntelliJTheme extends Theme {
@Override
public void loadPlatformProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadPlatformProperties(properties, currentDefaults);
if (SystemInfo.isMac) {
var name = getResourcePath() + getName() + "_mac.properties";
PropertyLoader.putProperties(load(name), properties, currentDefaults);
}
}
@Override
protected String getResourcePath() {
return "intellij/";
}
@Override
public boolean isDark() {
return false;
}
@Override
public String getName() {
return "intellij";
}
@Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults);
var name = getResourcePath() + getName() + "_ui.properties";
PropertyLoader.putProperties(load(name), properties, currentDefaults);
}
}

4
src/main/java/com/weis/darklaf/theme/SolarizedDarkTheme.java → src/main/java/com/github/weisj/darklaf/theme/SolarizedDarkTheme.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.theme; package com.github.weisj.darklaf.theme;
import com.weis.darklaf.util.PropertyLoader; import com.github.weisj.darklaf.util.PropertyLoader;
import javax.swing.*; import javax.swing.*;
import java.util.Properties; import java.util.Properties;

4
src/main/java/com/weis/darklaf/theme/SolarizedLightTheme.java → src/main/java/com/github/weisj/darklaf/theme/SolarizedLightTheme.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.theme; package com.github.weisj.darklaf.theme;
import com.weis.darklaf.util.PropertyLoader; import com.github.weisj.darklaf.util.PropertyLoader;
import javax.swing.*; import javax.swing.*;
import java.util.Properties; import java.util.Properties;

33
src/main/java/com/weis/darklaf/theme/Theme.java → src/main/java/com/github/weisj/darklaf/theme/Theme.java

@ -1,9 +1,32 @@
package com.weis.darklaf.theme; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.theme;
import com.weis.darklaf.DarkLaf; import com.github.weisj.darklaf.DarkLaf;
import com.weis.darklaf.DarkMetalTheme; import com.github.weisj.darklaf.DarkMetalTheme;
import com.weis.darklaf.util.PropertyLoader; import com.github.weisj.darklaf.util.PropertyLoader;
import com.weis.darklaf.util.SystemInfo; import com.github.weisj.darklaf.util.SystemInfo;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;

2
src/main/java/com/weis/darklaf/theme/UnsupportedThemeException.java → src/main/java/com/github/weisj/darklaf/theme/UnsupportedThemeException.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.theme; package com.github.weisj.darklaf.theme;
public class UnsupportedThemeException extends RuntimeException { public class UnsupportedThemeException extends RuntimeException {

6
src/main/java/com/weis/darklaf/ui/button/DarkButtonBorder.java → src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java

@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.button; package com.github.weisj.darklaf.ui.button;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

108
src/main/java/com/weis/darklaf/ui/button/DarkButtonUI.java → src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java

@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.button; package com.github.weisj.darklaf.ui.button;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import com.weis.darklaf.util.GraphicsUtil; import com.github.weisj.darklaf.util.GraphicsUtil;
import com.weis.darklaf.util.SystemInfo; import com.github.weisj.darklaf.util.SystemInfo;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
@ -100,10 +100,18 @@ public class DarkButtonUI extends BasicButtonUI {
squareArc = UIManager.getInt("Button.squareArc"); squareArc = UIManager.getInt("Button.squareArc");
} }
@Contract("null -> false") @Override
public static boolean isNoArc(final Component c) { public void paint(final Graphics g, final JComponent c) {
return c instanceof JButton GraphicsContext config = new GraphicsContext(g);
&& Boolean.TRUE.equals(((JButton) c).getClientProperty("JButton.noArc")); AbstractButton b = (AbstractButton) c;
paintButton(g, c);
String text = layout(b, c, SwingUtilities2.getFontMetrics(b, g),
b.getWidth(), b.getHeight());
paintIcon(g, b, c);
paintText(g, b, c, text);
config.restore();
} }
@Override @Override
@ -195,18 +203,20 @@ public class DarkButtonUI extends BasicButtonUI {
} }
} }
@Override protected void paintText(final Graphics g, final AbstractButton b, final JComponent c, final String text) {
public void paint(final Graphics g, final JComponent c) { var context = GraphicsUtil.setupAntialiasing(g);
GraphicsContext config = new GraphicsContext(g); if (isDefaultButton(b)) {
AbstractButton b = (AbstractButton) c; g.setFont(g.getFont().deriveFont(Font.BOLD));
paintButton(g, c); }
if (text != null && !text.equals("")) {
String text = layout(b, c, SwingUtilities2.getFontMetrics(b, g), View v = (View) c.getClientProperty(BasicHTML.propertyKey);
b.getWidth(), b.getHeight()); if (v != null) {
v.paint(g, textRect);
paintIcon(g, b, c); } else {
paintText(g, b, c, text); paintText(g, b, textRect, text);
config.restore(); }
}
context.restore();
} }
private boolean shouldDrawBackground(@NotNull final JComponent c) { private boolean shouldDrawBackground(@NotNull final JComponent c) {
@ -243,39 +253,6 @@ public class DarkButtonUI extends BasicButtonUI {
&& "fullShadow".equals(((JButton) c).getClientProperty("JButton.variant")); && "fullShadow".equals(((JButton) c).getClientProperty("JButton.variant"));
} }
protected void paintText(final Graphics g, final AbstractButton b, final JComponent c, final String text) {
var context = GraphicsUtil.setupAntialiasing(g);
if (isDefaultButton(b)) {
g.setFont(g.getFont().deriveFont(Font.BOLD));
}
if (text != null && !text.equals("")) {
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
} else {
paintText(g, b, textRect, text);
}
}
context.restore();
}
@Contract("null -> false")
public static boolean isSquare(final Component c) {
return c instanceof JButton && "square".equals(((JButton) c).getClientProperty("JButton.buttonType"));
}
@Contract("null -> false")
public static boolean chooseAlternativeArc(final Component c) {
return c instanceof JButton
&& Boolean.TRUE.equals(((JButton) c).getClientProperty("JButton.alternativeArc"));
}
@Contract("null -> false")
public static boolean isLabelButton(final Component c) {
return c instanceof JButton
&& "onlyLabel".equals(((JButton) c).getClientProperty("JButton.variant"));
}
protected Color getBackgroundColor(@NotNull final JComponent c) { protected Color getBackgroundColor(@NotNull final JComponent c) {
var defaultButton = isDefaultButton(c); var defaultButton = isDefaultButton(c);
var rollOver = (c instanceof JButton && (((JButton) c).isRolloverEnabled() var rollOver = (c instanceof JButton && (((JButton) c).isRolloverEnabled()
@ -304,6 +281,29 @@ public class DarkButtonUI extends BasicButtonUI {
} }
} }
@Contract("null -> false")
public static boolean isSquare(final Component c) {
return c instanceof JButton && "square".equals(((JButton) c).getClientProperty("JButton.buttonType"));
}
@Contract("null -> false")
public static boolean chooseAlternativeArc(final Component c) {
return c instanceof JButton
&& Boolean.TRUE.equals(((JButton) c).getClientProperty("JButton.alternativeArc"));
}
@Contract("null -> false")
public static boolean isLabelButton(final Component c) {
return c instanceof JButton
&& "onlyLabel".equals(((JButton) c).getClientProperty("JButton.variant"));
}
@Contract("null -> false")
public static boolean isNoArc(final Component c) {
return c instanceof JButton
&& Boolean.TRUE.equals(((JButton) c).getClientProperty("JButton.noArc"));
}
@Override @Override
public void update(final Graphics g, final JComponent c) { public void update(final Graphics g, final JComponent c) {
super.update(g, c); super.update(g, c);

34
src/main/java/com/weis/darklaf/ui/button/DarkToggleButtonUI.java → src/main/java/com/github/weisj/darklaf/ui/button/DarkToggleButtonUI.java

@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.button; package com.github.weisj.darklaf.ui.button;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import com.weis.darklaf.util.GraphicsUtil; import com.github.weisj.darklaf.util.GraphicsUtil;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
@ -152,15 +152,10 @@ public class DarkToggleButtonUI extends DarkButtonUI {
bounds.height, bounds.height).contains(x, y); bounds.height, bounds.height).contains(x, y);
} }
@NotNull @Contract("null -> false")
private Rectangle getSliderBounds(@NotNull final JComponent c) { private static boolean isSlider(final JComponent c) {
int x = borderSize; return c instanceof JToggleButton
int y = (c.getHeight() - sliderSize.height) / 2; && "slider".equals(c.getClientProperty("ToggleButton.variant"));
rect.x = x;
rect.y = y;
rect.width = sliderSize.width;
rect.height = sliderSize.height;
return rect;
} }
private void paintSlider(@NotNull final Graphics2D g, final AbstractButton c) { private void paintSlider(@NotNull final Graphics2D g, final AbstractButton c) {
@ -196,10 +191,15 @@ public class DarkToggleButtonUI extends DarkButtonUI {
config.restore(); config.restore();
} }
@Contract("null -> false") @NotNull
private static boolean isSlider(final JComponent c) { private Rectangle getSliderBounds(@NotNull final JComponent c) {
return c instanceof JToggleButton int x = borderSize;
&& "slider".equals(c.getClientProperty("ToggleButton.variant")); int y = (c.getHeight() - sliderSize.height) / 2;
rect.x = x;
rect.y = y;
rect.width = sliderSize.width;
rect.height = sliderSize.height;
return rect;
} }
protected Color getToggleBorderColor(@NotNull final AbstractButton b) { protected Color getToggleBorderColor(@NotNull final AbstractButton b) {

2
src/main/java/com/weis/darklaf/ui/cell/CellEditorToggleButton.java → src/main/java/com/github/weisj/darklaf/ui/cell/CellEditorToggleButton.java

@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.cell; package com.github.weisj.darklaf.ui.cell;
/** /**
* @author Jannis Weis * @author Jannis Weis

37
src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellBorder.java

@ -0,0 +1,37 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.ui.cell;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.UIResource;
/**
* @author Jannis Weis
*/
public class DarkCellBorder extends EmptyBorder implements UIResource {
public DarkCellBorder() {
super(2, 5, 2, 5);
}
}

10
src/main/java/com/weis/darklaf/ui/cell/DarkCellRendererToggleButton.java → src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java

@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.cell; package com.github.weisj.darklaf.ui.cell;
import com.weis.darklaf.components.SelectableTreeNode; import com.github.weisj.darklaf.components.SelectableTreeNode;
import com.weis.darklaf.decorators.CellRenderer; import com.github.weisj.darklaf.decorators.CellRenderer;
import com.weis.darklaf.ui.tree.DarkTreeCellRenderer; import com.github.weisj.darklaf.ui.tree.DarkTreeCellRenderer;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;

73
src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxBorder.java

@ -0,0 +1,73 @@
/*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.ui.checkbox;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.SystemInfo;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.UIResource;
import java.awt.*;
/**
* @author Jannis Weis
*/
public class DarkCheckBoxBorder implements Border, UIResource {
@Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y,
final int width, final int height) {
}
@Override
public Insets getBorderInsets(final Component c) {
if (isInCell(c)) {
return new Insets(0, 0, 0, 0);
}
final int a = SystemInfo.isMac ? 2 : 4;
return new InsetsUIResource(a, a, a, a);
}
protected boolean isInCell(final Component c) {
return isTreeCellEditor(c) || isTableCellEditor(c) || DarkUIUtil.isInCell(c);
}
protected boolean isTreeCellEditor(final Component c) {
return c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty("JToggleButton.isTreeCellEditor"));
}
protected boolean isTableCellEditor(final Component c) {
return c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty("JToggleButton.isTreeCellEditor"));
}
@Override
public boolean isBorderOpaque() {
return false;
}
}

33
src/main/java/com/weis/darklaf/ui/checkbox/DarkCheckBoxMenuItemUI.java → src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxMenuItemUI.java

@ -1,9 +1,32 @@
package com.weis.darklaf.ui.checkbox; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.ui.checkbox;
import com.weis.darklaf.decorators.MouseClickListener; import com.github.weisj.darklaf.decorators.MouseClickListener;
import com.weis.darklaf.ui.menu.DarkMenuItemUIBase; import com.github.weisj.darklaf.ui.menu.DarkMenuItemUIBase;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import com.weis.darklaf.util.GraphicsUtil; import com.github.weisj.darklaf.util.GraphicsUtil;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import sun.swing.MenuItemLayoutHelper; import sun.swing.MenuItemLayoutHelper;

10
src/main/java/com/weis/darklaf/ui/checkbox/DarkCheckBoxUI.java → src/main/java/com/github/weisj/darklaf/ui/checkbox/DarkCheckBoxUI.java

@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.checkbox; package com.github.weisj.darklaf.ui.checkbox;
import com.weis.darklaf.icons.EmptyIcon; import com.github.weisj.darklaf.icons.EmptyIcon;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import com.weis.darklaf.util.GraphicsUtil; import com.github.weisj.darklaf.util.GraphicsUtil;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;

6
src/main/java/com/weis/darklaf/ui/colorchooser/ColorPipette.java → src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPipette.java

@ -1,4 +1,3 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
/* /*
* MIT License * MIT License
* *
@ -22,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.colorchooser;
import com.weis.darklaf.components.Disposable; package com.github.weisj.darklaf.ui.colorchooser;
import com.github.weisj.darklaf.components.Disposable;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.awt.*; import java.awt.*;

25
src/main/java/com/weis/darklaf/ui/colorchooser/ColorPreviewComponent.java → src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPreviewComponent.java

@ -1,4 +1,27 @@
package com.weis.darklaf.ui.colorchooser; /*
* MIT License
*
* Copyright (c) 2019 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.ui.colorchooser;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

4
src/main/java/com/weis/darklaf/ui/colorchooser/ColorValueFormatter.java → src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorValueFormatter.java

@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.colorchooser; package com.github.weisj.darklaf.ui.colorchooser;
import com.weis.darklaf.color.DarkColorModel; import com.github.weisj.darklaf.color.DarkColorModel;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

8
src/main/java/com/weis/darklaf/ui/colorchooser/ColorWheel.java → src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheel.java

@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.weis.darklaf.ui.colorchooser; package com.github.weisj.darklaf.ui.colorchooser;
import com.weis.darklaf.util.ColorUtil; import com.github.weisj.darklaf.util.ColorUtil;
import com.weis.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.weis.darklaf.util.GraphicsContext; import com.github.weisj.darklaf.util.GraphicsContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save