/ *
* The MIT License
*
* Copyright 2016 mosers .
*
* Permission is hereby granted , free of charge , to any person obtaining a copy
* of this software and associated documentation files ( the "Software" ) , to deal
* in the Software without restriction , including without limitation the rights
* to use , copy , modify , merge , publish , distribute , sublicense , and / or sell
* copies of the Software , and to permit persons to whom the Software is
* furnished to do so , subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software .
*
* THE SOFTWARE IS PROVIDED "AS IS" , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY ,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER
* LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM ,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE .
* /
package eu.smoser.dungeongenerator.main ;
import eu.smoser.dungeongenerator.dungeon.objects.Treasure ;
/ * *
*
* @author mosers
* /
public class TreasureGenerator extends javax . swing . JFrame {
/ * *
* Creates new form TreasureGenerator
* /
public TreasureGenerator ( ) {
initComponents ( ) ;
}
/ * *
* This method is called from within the constructor to initialize the form .
* WARNING : Do NOT modify this code . The content of this method is always
* regenerated by the Form Editor .
* /
@SuppressWarnings ( "unchecked" )
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents ( ) {
jButtonStart = new javax . swing . JButton ( ) ;
jPanel1 = new javax . swing . JPanel ( ) ;
filler1 = new javax . swing . Box . Filler ( new java . awt . Dimension ( 0 , 0 ) , new java . awt . Dimension ( 0 , 0 ) , new java . awt . Dimension ( 32767 , 0 ) ) ;
jSpinner = new javax . swing . JSpinner ( ) ;
jLabel1 = new javax . swing . JLabel ( ) ;
filler2 = new javax . swing . Box . Filler ( new java . awt . Dimension ( 0 , 0 ) , new java . awt . Dimension ( 0 , 0 ) , new java . awt . Dimension ( 32767 , 0 ) ) ;
jScrollPane1 = new javax . swing . JScrollPane ( ) ;
jText = new javax . swing . JTextArea ( ) ;
setDefaultCloseOperation ( javax . swing . WindowConstants . DISPOSE_ON_CLOSE ) ;
setTitle ( "Schätze generieren" ) ;
setMinimumSize ( new java . awt . Dimension ( 800 , 600 ) ) ;
jButtonStart . setText ( "Schatz generieren" ) ;
jButtonStart . setToolTipText ( "" ) ;
jButtonStart . addActionListener ( new java . awt . event . ActionListener ( ) {
public void actionPerformed ( java . awt . event . ActionEvent evt ) {
jButtonStartActionPerformed ( evt ) ;
}
} ) ;
getContentPane ( ) . add ( jButtonStart , java . awt . BorderLayout . PAGE_END ) ;
jPanel1 . setLayout ( new java . awt . GridLayout ( 1 , 4 ) ) ;
jPanel1 . add ( filler1 ) ;
jSpinner . setModel ( new javax . swing . SpinnerNumberModel ( 1 , 1 , null , 1 ) ) ;
jPanel1 . add ( jSpinner ) ;
jLabel1 . setText ( "Handvoll" ) ;
jPanel1 . add ( jLabel1 ) ;
jPanel1 . add ( filler2 ) ;
getContentPane ( ) . add ( jPanel1 , java . awt . BorderLayout . PAGE_START ) ;
jText . setColumns ( 20 ) ;
jText . setRows ( 5 ) ;
jScrollPane1 . setViewportView ( jText ) ;
getContentPane ( ) . add ( jScrollPane1 , java . awt . BorderLayout . CENTER ) ;
pack ( ) ;
} // </editor-fold>//GEN-END:initComponents
private void jButtonStartActionPerformed ( java . awt . event . ActionEvent evt ) { //GEN-FIRST:event_jButtonStartActionPerformed
String text = "" ;
for ( int i = 1 ; i < = ( int ) jSpinner . getValue ( ) ; i + + ) {
text + = i + " Handvoll:\n" + Treasure . DetailedTreasure ( ) + "\n\n" ;
}
jText . setText ( text ) ;
} //GEN-LAST:event_jButtonStartActionPerformed
/ * *
* @param args the command line arguments
* /
public static void main ( String args [ ] ) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/ * If Nimbus ( introduced in Java SE 6 ) is not available , stay with the default look and feel .
* For details see http : //download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
* /
try {
for ( javax . swing . UIManager . LookAndFeelInfo info : javax . swing . UIManager . getInstalledLookAndFeels ( ) ) {
if ( "Nimbus" . equals ( info . getName ( ) ) ) {
javax . swing . UIManager . setLookAndFeel ( info . getClassName ( ) ) ;
break ;
}
}
} catch ( ClassNotFoundException ex ) {
java . util . logging . Logger . getLogger ( TreasureGenerator . class . getName ( ) ) . log ( java . util . logging . Level . SEVERE , null , ex ) ;
} catch ( InstantiationException ex ) {
java . util . logging . Logger . getLogger ( TreasureGenerator . class . getName ( ) ) . log ( java . util . logging . Level . SEVERE , null , ex ) ;
} catch ( IllegalAccessException ex ) {
java . util . logging . Logger . getLogger ( TreasureGenerator . class . getName ( ) ) . log ( java . util . logging . Level . SEVERE , null , ex ) ;
} catch ( javax . swing . UnsupportedLookAndFeelException ex ) {
java . util . logging . Logger . getLogger ( TreasureGenerator . class . getName ( ) ) . log ( java . util . logging . Level . SEVERE , null , ex ) ;
}
//</editor-fold>
/* Create and display the form */
java . awt . EventQueue . invokeLater ( new Runnable ( ) {
public void run ( ) {
new TreasureGenerator ( ) . setVisible ( true ) ;
}
} ) ;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax . swing . Box . Filler filler1 ;
private javax . swing . Box . Filler filler2 ;
private javax . swing . JButton jButtonStart ;
private javax . swing . JLabel jLabel1 ;
private javax . swing . JPanel jPanel1 ;
private javax . swing . JScrollPane jScrollPane1 ;
private javax . swing . JSpinner jSpinner ;
private javax . swing . JTextArea jText ;
// End of variables declaration//GEN-END:variables
}