Skip to content

Commit

Permalink
Fix compiler error introduced when cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkiii committed Sep 30, 2014
1 parent 8fbf643 commit 475fa8e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ Example with callback:
// Callback code
})
.build());

What the result looks like
========
![Example](http://i.imgur.com/TM5PjL6.png)
4 changes: 2 additions & 2 deletions src/main/java/org/nikkii/alertify4j/Alertify.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Alertify showAlert(final AlertifyConfig config) {
int baseY = screen.height;

for (AlertifyWindow window : windows) {
baseY -= window.getHeight() + 10;
baseY -= window.getActualHeight() + 10;
}

if (baseY < 0) {
Expand Down Expand Up @@ -269,7 +269,7 @@ private void consolidateWindows() {

int newY = screen.height;
for (AlertifyWindow w : windows) {
newY -= w.getHeight() + 10; // 10px spacing
newY -= w.getActualHeight() + 10; // 10px spacing
if (w.getY() != newY) {
moveWindow(w, newY);
}
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/org/nikkii/alertify4j/ui/AlertifyWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*/
public class AlertifyWindow extends JWindow {

private int actualWidth;
private int actualHeight;

/**
* Flag for whether we're 'hidden'.
*/
Expand Down Expand Up @@ -59,8 +62,8 @@ public AlertifyWindow(AlertifyTheme theme, AlertifyType type, JLabel label) {

Dimension contentSize = content.getPreferredSize();

int actualWidth = Math.max(contentSize.width, 300);
int actualHeight = Math.max(contentSize.height, 64);
actualWidth = Math.max(contentSize.width, 300);
actualHeight = Math.max(contentSize.height, 64);

setAlwaysOnTop(true);
setPreferredSize(new Dimension(actualWidth, actualHeight));
Expand Down Expand Up @@ -102,4 +105,13 @@ public boolean isHidden() {
public void setCloseFuture(ScheduledFuture<?> closeFuture) {
this.closeFuture = closeFuture;
}


public int getActualWidth() {
return actualWidth;
}

public int getActualHeight() {
return actualHeight;
}
}

0 comments on commit 475fa8e

Please sign in to comment.