-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
740 additions
and
10 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package view; | ||
|
||
import javax.swing.*; | ||
import javax.swing.plaf.FontUIResource; | ||
import java.awt.*; | ||
|
||
/** | ||
* Created by Alex on 02/04/2016. | ||
*/ | ||
public class DPIController { | ||
private static int DEFAULT_DPI = 96; | ||
|
||
private static int DPI = java.awt.Toolkit.getDefaultToolkit().getScreenResolution(); | ||
|
||
public static int getDefaultDPI() { | ||
return DEFAULT_DPI; | ||
} | ||
|
||
public static void setDefaultDPI(int i) { | ||
DEFAULT_DPI = i; | ||
} | ||
|
||
public static int getDpi() { | ||
return DPI; | ||
} | ||
|
||
public static int scaleToDPI(int input) { | ||
|
||
int factor = DPI / DEFAULT_DPI; | ||
|
||
return factor * input; | ||
} | ||
|
||
public static Dimension scaleToDPI(Dimension input) { | ||
|
||
int factor = DPI / DEFAULT_DPI; | ||
|
||
return new Dimension(factor * input.width, factor * input.height); | ||
} | ||
|
||
public static void scaleFontsToDPI() { | ||
|
||
java.util.Enumeration keys = UIManager.getDefaults().keys(); | ||
while (keys.hasMoreElements()) { | ||
Object key = keys.nextElement(); | ||
Object value = UIManager.get (key); | ||
if (value != null && value instanceof javax.swing.plaf.FontUIResource) { | ||
Font f = ((FontUIResource) value); | ||
UIManager.put(key, f.deriveFont(scaleToDPI(f.getSize())*1f)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/view/CryptFileFilter.java → src/view/dialogs/CryptFileFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package view; | ||
package view.dialogs; | ||
|
||
import javax.swing.filechooser.FileFilter; | ||
import java.io.File; | ||
|
7 changes: 4 additions & 3 deletions
7
src/view/DialogBuilder.java → src/view/dialogs/DialogBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package view; | ||
package view.dialogs; | ||
|
||
|
||
import javax.swing.*; | ||
import java.io.File; | ||
|
Oops, something went wrong.