@ -29,8 +29,10 @@ import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.util.mxCellRenderer ;
import com.mxgraph.util.mxCellRenderer ;
import com.mxgraph.util.mxConstants ;
import com.mxgraph.util.mxConstants ;
import dungeon.Dungeon ;
import dungeon.Dungeon ;
import java.awt.BorderLayout ;
import java.awt.CardLayout ;
import java.awt.CardLayout ;
import java.awt.Color ;
import java.awt.Color ;
import java.awt.Desktop ;
import java.awt.Toolkit ;
import java.awt.Toolkit ;
import java.io.File ;
import java.io.File ;
import java.io.FileWriter ;
import java.io.FileWriter ;
@ -51,7 +53,11 @@ import org.jgrapht.ext.GmlExporter;
import org.jgrapht.ext.JGraphXAdapter ;
import org.jgrapht.ext.JGraphXAdapter ;
import java.awt.image.BufferedImage ;
import java.awt.image.BufferedImage ;
import java.awt.Image ;
import java.awt.Image ;
import java.awt.Label ;
import java.net.URI ;
import java.net.URISyntaxException ;
import javax.swing.ImageIcon ;
import javax.swing.ImageIcon ;
import javax.swing.JFrame ;
/ * *
/ * *
*
*
@ -113,7 +119,9 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
jMenuImage = new javax . swing . JMenuItem ( ) ;
jMenuImage = new javax . swing . JMenuItem ( ) ;
jMenuClose = new javax . swing . JMenuItem ( ) ;
jMenuClose = new javax . swing . JMenuItem ( ) ;
jMenuHelp = new javax . swing . JMenu ( ) ;
jMenuHelp = new javax . swing . JMenu ( ) ;
jMenuItem1 = new javax . swing . JMenuItem ( ) ;
jMenuItemHelp = new javax . swing . JMenuItem ( ) ;
jMenuItemContact = new javax . swing . JMenuItem ( ) ;
jMenuItemGithub = new javax . swing . JMenuItem ( ) ;
jSeparator1 = new javax . swing . JPopupMenu . Separator ( ) ;
jSeparator1 = new javax . swing . JPopupMenu . Separator ( ) ;
jMenuItemAbout = new javax . swing . JMenuItem ( ) ;
jMenuItemAbout = new javax . swing . JMenuItem ( ) ;
@ -137,7 +145,7 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
jPanelSettings . setLayout ( new java . awt . GridLayout ( 4 , 2 ) ) ;
jPanelSettings . setLayout ( new java . awt . GridLayout ( 4 , 2 ) ) ;
jLabel4 . setHorizontalAlignment ( javax . swing . SwingConstants . CENTER ) ;
jLabel4 . setHorizontalAlignment ( javax . swing . SwingConstants . CENTER ) ;
jLabel4 . setText ( "Raum maximum ") ;
jLabel4 . setText ( "Raum anzahl ") ;
jPanelSettings . add ( jLabel4 ) ;
jPanelSettings . add ( jLabel4 ) ;
jSpinSize . setModel ( new javax . swing . SpinnerNumberModel ( 1 , 1 , null , 1 ) ) ;
jSpinSize . setModel ( new javax . swing . SpinnerNumberModel ( 1 , 1 , null , 1 ) ) ;
@ -146,7 +154,7 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
jPanelSettings . add ( jSpinSize ) ;
jPanelSettings . add ( jSpinSize ) ;
jPanelSettings . add ( filler1 ) ;
jPanelSettings . add ( filler1 ) ;
jCheckBoxExp . setText ( " Experimenteller Modus") ;
jCheckBoxExp . setText ( " <html>\n<b> Experimenteller Modus</b><br/>\nschränkt Raumzahl nicht direkt ein, sondern ändert die Zufallsfunktion so, dass ihr Erwartungswert der Raumanzahl entspricht ") ;
jCheckBoxExp . addActionListener ( new java . awt . event . ActionListener ( ) {
jCheckBoxExp . addActionListener ( new java . awt . event . ActionListener ( ) {
public void actionPerformed ( java . awt . event . ActionEvent evt ) {
public void actionPerformed ( java . awt . event . ActionEvent evt ) {
jCheckBoxExpActionPerformed ( evt ) ;
jCheckBoxExpActionPerformed ( evt ) ;
@ -265,9 +273,30 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
jMenuHelp . setText ( "Hilfe" ) ;
jMenuHelp . setText ( "Hilfe" ) ;
jMenuItem1 . setAccelerator ( javax . swing . KeyStroke . getKeyStroke ( java . awt . event . KeyEvent . VK_F1 , 0 ) ) ;
jMenuItemHelp . setAccelerator ( javax . swing . KeyStroke . getKeyStroke ( java . awt . event . KeyEvent . VK_F1 , 0 ) ) ;
jMenuItem1 . setText ( "Hilfe" ) ;
jMenuItemHelp . setText ( "Hilfe" ) ;
jMenuHelp . add ( jMenuItem1 ) ;
jMenuItemHelp . addActionListener ( new java . awt . event . ActionListener ( ) {
public void actionPerformed ( java . awt . event . ActionEvent evt ) {
jMenuItemHelpActionPerformed ( evt ) ;
}
} ) ;
jMenuHelp . add ( jMenuItemHelp ) ;
jMenuItemContact . setText ( "Kontakt" ) ;
jMenuItemContact . addActionListener ( new java . awt . event . ActionListener ( ) {
public void actionPerformed ( java . awt . event . ActionEvent evt ) {
jMenuItemContactActionPerformed ( evt ) ;
}
} ) ;
jMenuHelp . add ( jMenuItemContact ) ;
jMenuItemGithub . setText ( "Github" ) ;
jMenuItemGithub . addActionListener ( new java . awt . event . ActionListener ( ) {
public void actionPerformed ( java . awt . event . ActionEvent evt ) {
jMenuItemGithubActionPerformed ( evt ) ;
}
} ) ;
jMenuHelp . add ( jMenuItemGithub ) ;
jMenuHelp . add ( jSeparator1 ) ;
jMenuHelp . add ( jSeparator1 ) ;
jMenuItemAbout . setText ( "Über/Lizenz" ) ;
jMenuItemAbout . setText ( "Über/Lizenz" ) ;
@ -290,8 +319,20 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
} //GEN-LAST:event_jMenuCloseActionPerformed
} //GEN-LAST:event_jMenuCloseActionPerformed
private void jButtonGenerateActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jButtonGenerateActionPerformed
private void jButtonGenerateActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jButtonGenerateActionPerformed
mDungeon = new Dungeon ( ( int ) jSpinSize . getValue ( ) , SelectedNatural ( ) , SelectedMode ( ) ) ;
Dungeon . Mode mode = SelectedMode ( ) ;
Dungeon . Type type = SelectedNatural ( ) ;
int size = ( int ) jSpinSize . getValue ( ) ;
mDungeon = new Dungeon ( size , type ) ;
if ( false & & Dungeon . Experimental ( type ) ) {
JFrame frame = new JFrame ( "Debug" ) ;
frame . setDefaultCloseOperation ( JFrame . DISPOSE_ON_CLOSE ) ;
Label lab = new Label ( ) ;
lab . setText ( mDungeon . GetGreedyMap ( ) . toString ( ) ) ;
frame . getContentPane ( ) . add ( lab , BorderLayout . CENTER ) ;
frame . pack ( ) ;
frame . setVisible ( true ) ;
}
mDungeon . generate ( size , type , mode ) ;
mGraph = mDungeon . toGraph ( ) ;
mGraph = mDungeon . toGraph ( ) ;
JGraphXAdapter graphAdapter = new JGraphXAdapter ( mGraph ) ;
JGraphXAdapter graphAdapter = new JGraphXAdapter ( mGraph ) ;
mGraphComponent = new mxGraphComponent ( graphAdapter ) ;
mGraphComponent = new mxGraphComponent ( graphAdapter ) ;
@ -304,9 +345,9 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
jPanelDraw . add ( mGraphComponent ) ;
jPanelDraw . add ( mGraphComponent ) ;
jTextDescription . setText ( mDungeon . toString ( ) ) ;
jTextDescription . setText ( mDungeon . toString ( ) ) ;
jLabelStatus1 . setText ( "Max: " + jSpinSize. getValue ( ) ) ;
jLabelStatus1 . setText ( "Max: " + size ) ;
jLabelStatus2 . setText ( "Type: " + Selec tedNatural( ) . toString ( ) ) ;
jLabelStatus2 . setText ( "Type: " + typ e. toString ( ) ) ;
jLabelStatus3 . setText ( "Mode: " + SelectedMode( ) . toString ( ) ) ;
jLabelStatus3 . setText ( "Mode: " + mode . toString ( ) ) ;
jMenuSave . setEnabled ( true ) ;
jMenuSave . setEnabled ( true ) ;
jMenuNew . setEnabled ( true ) ;
jMenuNew . setEnabled ( true ) ;
@ -420,12 +461,12 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
String number = vprops . getString ( "BUILDNUMBER" ) ;
String number = vprops . getString ( "BUILDNUMBER" ) ;
String date = vprops . getString ( "BUILDDATE" ) ;
String date = vprops . getString ( "BUILDDATE" ) ;
JOptionPane . showMessageDialog ( this , " DungeonGenerator Version " + number + " \n"
JOptionPane . showMessageDialog ( this , " <html><b> DungeonGenerator Version " + number + " </b> \n"
+ " (compiled on " + date + ") \n"
+ " <html><i> (compiled on " + date + ") </i> \n"
+ "\n"
+ "\n"
+ " The MIT License (MIT)\n"
+ " <html><b> The MIT License (MIT)</b> \n"
+ "\n"
+ "\n"
+ " Copyright (c) 2016 Simon Moser IT \n"
+ " <html>Copyright © 2016 <a href='https://smoser.eu/'>Simon Moser IT</a> \n"
+ "\n"
+ "\n"
+ "Permission is hereby granted, free of charge, to any person\n"
+ "Permission is hereby granted, free of charge, to any person\n"
+ "obtaining a copy of this software and associated documentation\n"
+ "obtaining a copy of this software and associated documentation\n"
@ -448,13 +489,40 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
+ "ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n"
+ "ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n"
+ "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
+ "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
+ "\n"
+ "\n"
+ " Icons made by Revicon from www.flaticon.com ", "Über" , JOptionPane . QUESTION_MESSAGE ) ;
+ " <html>Icons made by <a href='http://www.flaticon.com/authors/revicon'>Revicon</a> ", "Über" , JOptionPane . QUESTION_MESSAGE ) ;
} //GEN-LAST:event_jMenuItemAboutActionPerformed
} //GEN-LAST:event_jMenuItemAboutActionPerformed
private void jCheckBoxExpActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jCheckBoxExpActionPerformed
private void jCheckBoxExpActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jCheckBoxExpActionPerformed
// TODO add your handling code here:
int a = JOptionPane . showConfirmDialog ( this , "Diese Option kann zu einer Endlosschleife führen" , "Achtung" , JOptionPane . OK_CANCEL_OPTION , JOptionPane . WARNING_MESSAGE ) ;
if ( a = = JOptionPane . CANCEL_OPTION ) {
jCheckBoxExp . setSelected ( false ) ;
}
} //GEN-LAST:event_jCheckBoxExpActionPerformed
} //GEN-LAST:event_jCheckBoxExpActionPerformed
private void jMenuItemContactActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jMenuItemContactActionPerformed
try {
Desktop . getDesktop ( ) . mail ( new URI ( "mailto:info@smoser.eu?subject=DungeonGenerator" ) ) ;
} catch ( URISyntaxException | IOException ex ) {
Logger . getLogger ( DungeonGeneratorUI . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ;
}
} //GEN-LAST:event_jMenuItemContactActionPerformed
private void jMenuItemHelpActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jMenuItemHelpActionPerformed
try {
Desktop . getDesktop ( ) . browse ( new URI ( "https://github.com/MrMcX/DungeonGenerator/issues" ) ) ;
} catch ( URISyntaxException | IOException ex ) {
Logger . getLogger ( DungeonGeneratorUI . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ;
}
} //GEN-LAST:event_jMenuItemHelpActionPerformed
private void jMenuItemGithubActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jMenuItemGithubActionPerformed
try {
Desktop . getDesktop ( ) . browse ( new URI ( "https://github.com/MrMcX/DungeonGenerator/" ) ) ;
} catch ( URISyntaxException | IOException ex ) {
Logger . getLogger ( DungeonGeneratorUI . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ;
}
} //GEN-LAST:event_jMenuItemGithubActionPerformed
/ * *
/ * *
* @param args the command line arguments
* @param args the command line arguments
* /
* /
@ -535,8 +603,10 @@ public class DungeonGeneratorUI extends javax.swing.JFrame {
private javax . swing . JMenu jMenuGraph ;
private javax . swing . JMenu jMenuGraph ;
private javax . swing . JMenu jMenuHelp ;
private javax . swing . JMenu jMenuHelp ;
private javax . swing . JMenuItem jMenuImage ;
private javax . swing . JMenuItem jMenuImage ;
private javax . swing . JMenuItem jMenuItem1 ;
private javax . swing . JMenuItem jMenuItemAbout ;
private javax . swing . JMenuItem jMenuItemAbout ;
private javax . swing . JMenuItem jMenuItemContact ;
private javax . swing . JMenuItem jMenuItemGithub ;
private javax . swing . JMenuItem jMenuItemHelp ;
private javax . swing . JMenuItem jMenuNew ;
private javax . swing . JMenuItem jMenuNew ;
private javax . swing . JMenuItem jMenuSave ;
private javax . swing . JMenuItem jMenuSave ;
private javax . swing . JPanel jPanelCardDraw ;
private javax . swing . JPanel jPanelCardDraw ;