1
0
Fork 0
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

59 Zeilen
2.0 KiB
Java

package eu.smoser.dungeongenerator.main;
import eu.smoser.dungeongenerator.dungeon.objects.Treasure;
import javax.swing.*;
/**
*
* @author mosers
*/
public class TreasureGenerator extends AGenerator {
/**
* This method is called from within the constructor to initialize the form.
*/
@Override
void cInitComponents(JButton jButtonStart, JLabel jLabel1, JPanel jPanel1) {
setTitle("Schätze generieren");
setMinimumSize(new java.awt.Dimension(800, 600));
jButtonStart.setText("Schatz generieren");
jButtonStart.setToolTipText("");
jLabel1.setText("Handvoll");
}
@Override
String getText() {
StringBuilder text = new StringBuilder();
for(int i = 1; i <= (int) jSpinner.getValue(); i++){
text.append(i);
text.append(". Handvoll:\n");
text.append(Treasure.DetailedTreasure());
text.append("\n\n");
}
return text.toString();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
/* Set the Nimbus look and feel */
/* 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 (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException ex) {
java.util.logging.Logger.getLogger(TreasureGenerator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> new TreasureGenerator().setVisible(true));
}
}