This repository has been archived by the owner on Dec 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
aersamkull
committed
Jun 9, 2015
1 parent
afd3260
commit ae9b252
Showing
5 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
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,38 @@ | ||
package ch.fhnw.cantoneditor.views; | ||
|
||
import java.awt.Dimension; | ||
|
||
import javax.swing.Box; | ||
import javax.swing.BoxLayout; | ||
import javax.swing.JFrame; | ||
import javax.swing.JLabel; | ||
|
||
import ch.fhnw.cantoneditor.datautils.TranslationManager; | ||
import ch.fhnw.observation.ValueSubscribable; | ||
|
||
/** For displaying a fatal error */ | ||
public class ErrorWindow { | ||
private final ValueSubscribable<String> title; | ||
private final Exception exception; | ||
|
||
public ErrorWindow(ValueSubscribable<String> title, Exception exception) { | ||
this.title = title; | ||
this.exception = exception; | ||
} | ||
|
||
public void show() { | ||
JFrame frame = new JFrame(); | ||
TranslationManager.getInstance().translate("ErrorOccured", "An Error occured").bindTo(frame::setTitle); | ||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
|
||
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.PAGE_AXIS)); | ||
JLabel desc = new JLabel(); | ||
this.title.bindTo((s) -> desc.setText(s + ": ")); | ||
frame.getContentPane().add(desc); | ||
frame.getContentPane().add(Box.createVerticalStrut(20)); | ||
frame.getContentPane().add(new JLabel(this.exception.toString())); | ||
frame.setMinimumSize(new Dimension(350, 200)); | ||
frame.pack(); | ||
frame.setVisible(true); | ||
} | ||
} |
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