Okay, below is the code for the Character information area of my Inventory system for my game.
The problems im having are the following:
1. How in the world do I paint or write my strings to my panel?
2. How do i do it so i get a nice titled border layout like the equipable area and the inventory list?
Code>>>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| package com.inventory;
import java.awt.*; import javax.swing.*; import javax.swing.border.TitledBorder;
public class InvCharPane extends JPanel{ private String textString1 = new String(); public InvCharPane() { JLabel invCharText = new JLabel(); invCharText.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); invCharText.setText(textString1); JPanel charPanel = new JPanel(); TitledBorder charPanelTitle = BorderFactory.createTitledBorder("Character Information"); charPanel.setLayout(new BorderLayout()); charPanel.setPreferredSize(new Dimension(100, 480)); charPanel.add(invCharText); charPanel.setBorder(charPanelTitle); } public void paintComponent(Graphics charPane) { super.paintComponent(charPane); textString1 = "Character Pane Text"; charPane.drawString(textString1,10,10); }
}
|
here is a screen shot of the first rendered version of the inventory system in full. (minus of course the few bugs im working on above)

thanx for any help given!