-
Notifications
You must be signed in to change notification settings - Fork 2
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
6 changed files
with
60 additions
and
32 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
java/concurrency/reactive-gui/src/main/java/it/unibo/oop/JFrameUtil.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package it.unibo.oop; | ||
|
||
import javax.swing.JFrame; | ||
import java.awt.Dimension; | ||
import java.awt.Toolkit; | ||
|
||
/** | ||
* Utility class for JFrame. | ||
*/ | ||
public final class JFrameUtil { | ||
|
||
private static final double WIDTH_PERC = 0.2; | ||
private static final double HEIGHT_PERC = 0.1; | ||
|
||
private JFrameUtil() { | ||
} | ||
|
||
/** | ||
* Dimensions a JFrame to a percentage of the screen size. | ||
* | ||
* @param target the JFrame to dimension | ||
*/ | ||
public static void dimensionJFrame(final JFrame target) { | ||
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); | ||
target.setSize((int) (screenSize.getWidth() * WIDTH_PERC), (int) (screenSize.getHeight() * HEIGHT_PERC)); | ||
target.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
} | ||
|
||
} |
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
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