Trying to create a map for a Zuul game using JFrame
I am new to java and need some help. I have a Zuul game and want to add a map class so that I can the map open in a Jframe while my game plays in the terminal window. I am trying to change the label of this JFrame but it is turning out to be very difficult and was wondering if anyone new of a better solution or could help me with this. Here is the map class code:
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class map
{
private JFrame frame;
/**
* Create an ImageViewer show it on screen.
*/
public map()
{
makeFrame();
}
// ---- swing stuff to build the frame and all its components ----
/**
* Create the Swing frame and its content.
*/
private void makeFrame()
{
frame = new JFrame("ImageViewer");
Container contentPane = frame.getContentPane();
JLabel label = new JLabel("This is a label");
contentPane.add(label);
frame.pack();
frame.setVisible(true);
}
}
I tried to add this map text to where it said "This is a label":
Code:
* zoolab preproom
* | | \
* | | \
* pub------------outside -------------theatre \
* \ | \
* \ | basement3
* \ | \
* \ lab--------------office \
* \ / \
* steamtunnel -- basement1 ----basement2--basementlab \
* | \ \
* | \ \
* | valveroom \
* "X" Room \ \
* \ \
* bottomroom--rocktunnel
* |
* darkroom
* |
* gem room--DragonRoom--DungeonRoom
I tried to use "\n" to separate out each row but nothing is helping. Let me know the best process for making a map using a jFrame or if there are better tools for this.